ORACLE 12C ADG 之二十二 (ADG 环境重建备库)

步驟1 停快速故障轉移功能

DGMGRL>stop observer
DGMGRL>disable fast_start failover;

步驟2 主機

[oracle@DB196 backupset]$ sqlplus / as sysdba
SQL> startup;
SQL> exit

步驟3 備機

[oracle@DB197 backupset]$ sqlplus / as sysdba
SQL> shutdown immediate;
备库OS 上删除数据文件
SQL> startup nomount;
SQL> exit

步驟4 在主庫通过Rman Duplicate创建备库,在主庫上执行如下命令

[oracle@DB196 ~]$ rman target sys/123456@PL auxiliary sys/123456@SL nocatalog

Recovery Manager: Release 12.2.0.1.0 - Production on Sat Oct 13 22:42:00 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: MPCDB (DBID=3275999777)
using target database control file instead of recovery catalog
connected to auxiliary database: MPCDB (not mounted)

RMAN> duplicate target database for standby from active database nofilenamecheck;

Starting Duplicate Db at 2018:10:13 22:42:54
...
input datafile copy RECID=10 STAMP=989448302 file name=/u01/app/oracle/oradata/MPCDB/pdbseed/undotbs01.dbf
ORACLE error from auxiliary database: ORA-01156: recovery or flashback in progress may need access to files

RMAN-05535: warning: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01156: recovery or flashback in progress may need access to files

RMAN-05535: warning: All redo log files were not defined properly.
Finished Duplicate Db at 2018:10:13 22:45:27

步驟5 備機

[oracle@DB197 backupset]$ sqlplus / as sysdba
SQL> alter database open;
SQL> select tablespace_name,file_name from dba_temp_files;
                                                         *
ERROR at line 1:
ORA-01187: cannot read from file  because it failed verification tests
ORA-01110: data file 201: '/u01/app/oracle/oradata/MPCDB/temp01.dbf'


SQL> alter database tempfile '/u01/app/oracle/oradata/MPCDB/temp01.dbf' drop;

Database altered.

SQL> alter tablespace temp add tempfile '/u01/app/oracle/oradata/MPCDB/temp01.dbf' size 33m reuse;         

Tablespace altered.

SQL> select tablespace_name,file_name from dba_temp_files;

TEMP  /u01/app/oracle/oradata/MPCDB/temp01.dbf

DGMGRL> show configuration

Configuration - ADGbroker

  Protection Mode: MaxAvailability
  Members:
  MPCDB196 - Primary database
    MPCDB197 - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 50 seconds ago)

步驟6 启动快速故障转移

DGMGRL> enable fast_start failover;
Warning: ORA-16827: Flashback Database is disabled

#备库
SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active

DGMGRL> edit database 'MPCDB197' set state="APPLY-OFF";

#备库
SQL> alter database flashback on;
Database altered.

DGMGRL> edit database 'MPCDB197' set state="APPLY-ON";
DGMGRL> enable fast_start failover;
DGMGRL> start observer

DGMGRL> show configuration
Configuration - ADGbroker
  Protection Mode: MaxAvailability
  Members:
  MPCDB196 - Primary database
    MPCDB197 - (*) Physical standby database 
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS   (status updated 17 seconds ago)

DGMGRL> switchover to 'MPCDB197';
Performing switchover NOW, please wait...
Operation requires a connection to database "MPCDB197"
Connecting ...
Connected to "MPCDB197"
Connected as SYSDBA.
New primary database "MPCDB197" is opening...
Operation requires start up of instance "MPCDB" on database "MPCDB196"
Starting instance "MPCDB"...
ORACLE instance started.
Database mounted.
Database opened.
Connected to "MPCDB196"
Switchover succeeded, new primary is "MPCDB197"

DGMGRL> show configuration
Configuration - ADGbroker
  Protection Mode: MaxAvailability
  Members:
  MPCDB197 - Primary database
    MPCDB196 - (*) Physical standby database 
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS   (status updated 32 seconds ago)

DGMGRL> switchover to 'MPCDB196';

你可能感兴趣的:(ORACLE 12C ADG 之二十二 (ADG 环境重建备库))