# connect to DC // Production
sqlplus sys/S_Passw0rd@mmoney as sysdba << EOF
select DATABASE_ROLE, switchover_status from v$database;
alter database commit to switchover to standby with session shutdown;
shutdown immediate
SQL> select DATABASE_ROLE, switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SQL> alter database commit to switchover to standby with session shutdown;
Database altered.
SQL>
oracle@cstsp-05:/d01/product/oracle/diag/rdbms/martstby/PROD/trace$ ls -ltrh alert*.log
-rw-r----- 1 oracle oinstall 449K Apr 14 00:37 alert_PROD.log
oracle@cstsp-05:/d01/product/oracle/diag/rdbms/PROD/PROD/trace$ tail -f alert_PROD.log
Switchover: Primary controlfile converted to standby controlfile succesfully.
Switchover: Complete - Database shutdown required
USER (ospid: 9094): terminating the instance
Sat Apr 14 00:37:57 2018
Instance terminated by USER, pid = 9094
Completed: alter database commit to switchover to standby with session shutdown
Shutting down instance (abort)
License high water mark = 24
Sat Apr 14 00:37:57 2018
Instance shutdown complete
# CONNECT TO DR
sqlplus sys/S_Passw0rd@mmoneydr as sysdba << EOF
select switchover_status from v$database;
alter database commit to switchover to primary;
alter database open;
select DATABASE_ROLE, switchover_status from v$database;
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
SQL> alter database commit to switchover to primary;
Database altered.
SQL> alter database open;
Database altered.
SQL> select DATABASE_ROLE, switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY FAILED DESTINATION
SQL> /
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SQL>
sqlplus sys/S_Passw0rd@mmoney as sysdba << EOF
select DATABASE_ROLE, switchover_status from v$database;
alter database commit to switchover to standby with session shutdown;
shutdown immediate
SQL> select DATABASE_ROLE, switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SQL> alter database commit to switchover to standby with session shutdown;
Database altered.
SQL>
oracle@cstsp-05:/d01/product/oracle/diag/rdbms/martstby/PROD/trace$ ls -ltrh alert*.log
-rw-r----- 1 oracle oinstall 449K Apr 14 00:37 alert_PROD.log
oracle@cstsp-05:/d01/product/oracle/diag/rdbms/PROD/PROD/trace$ tail -f alert_PROD.log
Switchover: Primary controlfile converted to standby controlfile succesfully.
Switchover: Complete - Database shutdown required
USER (ospid: 9094): terminating the instance
Sat Apr 14 00:37:57 2018
Instance terminated by USER, pid = 9094
Completed: alter database commit to switchover to standby with session shutdown
Shutting down instance (abort)
License high water mark = 24
Sat Apr 14 00:37:57 2018
Instance shutdown complete
# CONNECT TO DR
sqlplus sys/S_Passw0rd@mmoneydr as sysdba << EOF
select switchover_status from v$database;
alter database commit to switchover to primary;
alter database open;
select DATABASE_ROLE, switchover_status from v$database;
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
SQL> alter database commit to switchover to primary;
Database altered.
SQL> alter database open;
Database altered.
SQL> select DATABASE_ROLE, switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY FAILED DESTINATION
SQL> /
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SQL>
# CONNECT TO DC
sqlplus sys/S_Passw0rd@mmoney as sysdba << EOF
startup mount;
alter database open read only;
recover managed standby database using current logfile disconnect;
select DATABASE_ROLE, switchover_status from v$database;
select sequence#,process,status from v$managed_standby;
EOF
SQL> startup mount
ORACLE instance started.
Total System Global Area 5150605312 bytes
Fixed Size 3711144 bytes
Variable Size 2013273944 bytes
Database Buffers 3120562176 bytes
Redo Buffers 13058048 bytes
Database mounted.
SQL> alter database open read only;
Database altered.
SQL>
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> select DATABASE_ROLE, switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED
SQL> select sequence#,process,status from v$managed_standby;
SEQUENCE# PROCESS STATUS
---------- --------- ------------
0 ARCH CONNECTED
5703 ARCH CLOSING
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 ARCH CONNECTED
0 RFS IDLE
SEQUENCE# PROCESS STATUS
---------- --------- ------------
5704 RFS IDLE
0 RFS IDLE
5704 MRP0 APPLYING_LOG
14 rows selected.
SQL>
Note : In case of RAC switchover just keep up primary up and shutdown rest instances.
No comments:
Post a Comment