Switchover DATABASE from production to DR
1. ############### Perform on Production Database 192.168.5.132 ###############
PRODUCTION IP: 192.168.5.132
DR IP: 192.168.5.138
SQL> sqlplus / as sysdba
SQL> select status, error from v$archive_dest where dest_id = 2;
STATUS ERROR
--------- -----------------------------------------------------------------
VALID
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
SQL> alter database commit to switchover to physical standby with session shutdown;
Database altered.
SQL> shutdown immediate;
ORA-01012: not logged on
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@oraprd01:/export/home/oracle/Scripts1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 4 21:55:33 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 2572910592 bytes
Fixed Size 2184312 bytes
Variable Size 788532104 bytes
Database Buffers 1761607680 bytes
Redo Buffers 20586496 bytes
Database mounted.
3. #################### Perform on DR Database 192.168.5.138 #################
SQL> sqlplus / as sysdba
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to primary with session shutdown;
SQL> shutdown immediate;
SQL> startup;
4. ##############DISCONNECT on PRIMARY 192.168.5.132 ###############
SQL> sqlplus / as sysdba
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> select process,status from v$managed_standby;
SQL> SELECT THREAD#, MAX(SEQUENCE#)
FROM V$LOG_HISTORY
WHERE RESETLOGS_CHANGE# =
(SELECT RESETLOGS_CHANGE#
FROM V$DATABASE_INCARNATION
WHERE STATUS = 'CURRENT')
GROUP BY THREAD#;
################################# Revert Back ##############################
########## Perform on DR 192.168.5.138 ###################
SQL> sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> sqlplus / as sysdba
SQL> select status, error from v$archive_dest where dest_id = 2;
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> shutdown immediate;
SQL> startup mount;
##################### Perform on PRD 192.168.5.132 #####################
SQL> sqlplus / as sysdba
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to primary with session shutdown;
SQl> shutdown immediate;
SQL> startup;
###################### Disconnect on DR 192.168.5.138 ##########################
SQL> sqlplus / as sysdba
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
RFS IDLE
RFS IDLE
RFS RECEIVING
MRP0 APPLYING_LOG
#################### PRODUCTION 192.168.5.132 ###########################
Please validate the replication.
SQL>SELECT THREAD#, MAX(SEQUENCE#)
FROM V$LOG_HISTORY
WHERE RESETLOGS_CHANGE# =
(SELECT RESETLOGS_CHANGE#
FROM V$DATABASE_INCARNATION
WHERE STATUS = 'CURRENT')
GROUP BY THREAD#;
THREAD# MAX(SEQUENCE#)
---------- --------------
1 1460
##################### DR DATABASE 192.168.5.138 ########################
SQL>SELECT al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" FROM (select thread# thrd, MAX(sequence#) almax FROM v$archived_log
WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) al, (SELECT thread# thrd, MAX(sequence#) lhmax
FROM v$log_history WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) lh WHERE al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 1460 1460
################################################################################
1. ############### Perform on Production Database 192.168.5.132 ###############
PRODUCTION IP: 192.168.5.132
DR IP: 192.168.5.138
SQL> sqlplus / as sysdba
SQL> select status, error from v$archive_dest where dest_id = 2;
STATUS ERROR
--------- -----------------------------------------------------------------
VALID
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
SQL> alter database commit to switchover to physical standby with session shutdown;
Database altered.
SQL> shutdown immediate;
ORA-01012: not logged on
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@oraprd01:/export/home/oracle/Scripts1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 4 21:55:33 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 2572910592 bytes
Fixed Size 2184312 bytes
Variable Size 788532104 bytes
Database Buffers 1761607680 bytes
Redo Buffers 20586496 bytes
Database mounted.
3. #################### Perform on DR Database 192.168.5.138 #################
SQL> sqlplus / as sysdba
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to primary with session shutdown;
SQL> shutdown immediate;
SQL> startup;
4. ##############DISCONNECT on PRIMARY 192.168.5.132 ###############
SQL> sqlplus / as sysdba
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> select process,status from v$managed_standby;
SQL> SELECT THREAD#, MAX(SEQUENCE#)
FROM V$LOG_HISTORY
WHERE RESETLOGS_CHANGE# =
(SELECT RESETLOGS_CHANGE#
FROM V$DATABASE_INCARNATION
WHERE STATUS = 'CURRENT')
GROUP BY THREAD#;
################################# Revert Back ##############################
########## Perform on DR 192.168.5.138 ###################
SQL> sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> sqlplus / as sysdba
SQL> select status, error from v$archive_dest where dest_id = 2;
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> shutdown immediate;
SQL> startup mount;
##################### Perform on PRD 192.168.5.132 #####################
SQL> sqlplus / as sysdba
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to primary with session shutdown;
SQl> shutdown immediate;
SQL> startup;
###################### Disconnect on DR 192.168.5.138 ##########################
SQL> sqlplus / as sysdba
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
RFS IDLE
RFS IDLE
RFS RECEIVING
MRP0 APPLYING_LOG
#################### PRODUCTION 192.168.5.132 ###########################
Please validate the replication.
SQL>SELECT THREAD#, MAX(SEQUENCE#)
FROM V$LOG_HISTORY
WHERE RESETLOGS_CHANGE# =
(SELECT RESETLOGS_CHANGE#
FROM V$DATABASE_INCARNATION
WHERE STATUS = 'CURRENT')
GROUP BY THREAD#;
THREAD# MAX(SEQUENCE#)
---------- --------------
1 1460
##################### DR DATABASE 192.168.5.138 ########################
SQL>SELECT al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" FROM (select thread# thrd, MAX(sequence#) almax FROM v$archived_log
WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) al, (SELECT thread# thrd, MAX(sequence#) lhmax
FROM v$log_history WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) lh WHERE al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 1460 1460
################################################################################
No comments:
Post a Comment