User:Ramkrishna009/sandbox

Legalmart Failover SMOP from WC to CH servers

Description: There are 1 primary database plmtpr and 2 physical standby databases lmtprs2 and clmtprdbs. Database Unique Name	Database Role	Database instances	2-node ORACLE RAC Servers	Server location PLMTPR	primary	plmtpr1 plmtpr2	lmdb-wc-a1p.sys.comcast.net lmdb-wc-a2p.sys.comcast.net WC lmtprs2	physical Standby	plmtpr1 plmtpr2	lmdb-ch2-b1p.sys.comcast.net lmdb-ch2-b2p.sys.comcast.net	CH CLMTPRDBS	physical Standby	clmtprdbs1 clmtprdbs2	lmdb-po-a1p.sys.comcast.net lmdb-po-a2p.sys.comcast.net	PO

With DG Broker: Steps for performing fail-over to standby database using DG broker: •	Make sure the primary and standby sites are in sync. If not, estimate the data loss and get the approval from L3 for the same. •	Shutdown all the instance on Primary except one instance. •	Shutdown all the instance on Standby except one instance. •	Connect to dgmgrl on primary. •	Execute “failover to lmtprs2” on dgmgrl. •	Modify the database configuration in OCR with their appropriate role and start options using “srvctl modify database” •	Start all other instances and services. •	Check “select name, database_role, log_mode, force_logging from v$database;” on both the sites.


 * After opening standby database as primary with failover you must take full backup.

Without DG Broker: Steps for performing fail-over to standby database without DG broker:

1.	Make sure the primary and standby sites are in sync. If not, estimate the data loss and get the approval from L3 for the same. 2.	If the primary database is accessible and running, sync up all the archives.

SQL> alter system flush redo to lmtprs2;

SQL> alter system archive log current;

3.	On standby, get the last applied archive log sequence number.

SQL> SELECT UNIQUE THREAD# AS THREAD, MAX (SEQUENCE#) OVER (PARTITION BY thread#) AS LAST from V$ARCHIVED_LOG;

4.	If you can access archive logs which are not copied to standby then copy archives to standby. After copy archive log files we must register them to standby database. This operation must be done for every thread.

SQL> alter database register physical logfile '/tmp/archive.arc’

5.	Check the standby database for redo gap. If there is a gap then we must copy archive log files and register.

SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP; SQL> alter database register physical logfile '/tmp/archive.arc '; 6.	Stop the redo apply process in standby database.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

7.	Finish to apply archive logs copied from primary.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH; If you get an error, it means there are redo logs not applied. Check the gap and sync up as above. You can also continue with following command; Verify apply of logs by the sql. select A.*,B.Applied "Last Standby Seq Applied", A.Received - B.Applied   "Gap" from (select thread#, max(sequence#) Received from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread#) A, (select thread#, max(sequence#) Applied from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# and val.applied='YES' group by thread# ) B where A.thread#=B.thread# order by 1;

8.	Failover standby database to primary database.

SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;

9. Open database. SQL> ALTER DATABASE OPEN; 10. After opening standby database as primary with failover you must take full backup.