Thursday, October 5, 2017

Manual role switch over in Data Guard Environment


The steps below outline what commands must be issued to perform a switchover operation. In this examble, boston is initially the primary database and la is initially the standby database. la will become the primary database and boston will become the standby database.

Step 1: End Read or Update Activity on the Primary and Standby Databases.

Exclusive database access is required by the DBA before beginning a switchover operation. Ask users to log off the primary and stnadby databases or query the V$SESSION view to identify users that are connected to the database and close all open sessions except the SQL*Plus session from which you are going to issue the switchover command.

Step 2: Prepare the Primary Database for Switchover

On the primary database, boston, execute the following statement:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;
This statement does the following:

Closes the primary database
Archives any unarchived log files and applies them to the standby database, la
Adds an end-of-redo marker to the header of the last log file being archived
Creates a backup of the current control file
Converst the current control file into a standby control file

Step 3: Shut Down and Start Up the Former Primary Instance Without Mounting the Database

Execute the following statement on boston:

SQL> SHUTDOWN NORMAL;
SQL> STARTUP NOMOUNT;

Step 4: Mount the Former Primary Database in the Standby Database Role

Execute the followint statement on boston:

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;


Step 5: Prepare the Former Standby Database to Switch to the Primary Database Role

Execute the following statement on la:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

This statement does the following:

Makes sure the last log file has been received and applied through the end-of-redo marker
Closes the database if it has been opened for read-only transactions
Converts the standby control file to the current control file


Step 6: Shut Down the Database

Execute the following statement on la:

SQL> SHUTDOWN;

Step 7: Start Up the Database in the Primary Role

Execute the following statement on la:

SQL> STARTUP;


Step 8: Put the Standby Database in Managed Recovery Mode

Execute the following statement on the standby database, boston, to place it in managed recovery mode:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


Step 9: Start Archiving Logs from the Primary Database to the Standby Database

Execute the following statement on the primary database, la:

SQL> ALTER SYSTEM ARCHIVE LOG START;

SQL> ALTER SYSTEM SWITCH LOGFILE;

No comments:

Post a Comment