Data Guard - Shutdown Dataguard/Standby DB

Steps to shutdown Dataguard/Standby database for maintenance work

In our office there are certain situations where we have to shutdown Dataguard site, mostly for maintenance work, such as shared disk, server's hardware or any general maintenance at our DR (Disaster Recovery) site.

Point behind shutdown/startup of Dataguard is when Dataguard/Standby database come online it should get synchronized to Production/Primary site.

There may be many ways to achieve our goal, here is my recipe:

SHUTDOWN STANDBY DATABASE
step 1: Disable standby archive writing:
at primary/production database 

SQL> alter system set log_archive_dest_state_2=defer scope = both sid = '*';

PS: in case of RAC: this step should be done at just ONE of the RAC node.

step 2: Disable auto recovery at standby site:
at secondary/DR database

SQL> alter database recover managed standby database cancel;
PS: In case of RAC: above command should run on just ONE of the standby RAC node.

SQL> shutdown immediate
PS: in case of RAC: shutdown should be done on ALL standby RAC nodes.

STARTUP STANDBY DATABASE

Step 1: Coping all archive from primary to DR generated during shutdown.

in this step we will copy all archive those were generated after standby database was taken down.

$scp /opt/oracle/archive/*.arc oracle@DR-Site-IP:/opt/oracle/archive

Step 2: 
Startup standby database and configure automatic recovery:


SQL> startup nomount

SQL> alter database mount standby database;
SQL> alter database recover managed standby database disconnect from session;

PS: in case of RAC: repeat following commands on all standby nodes.

SQL> startup nomount
SQL> alter database mount standby database;step 3: Enable standby archive writing:
at primary/production database 
SQL> alter system set log_archive_dest_state_2=enable scope = both sid = '*';
PS: in case of RAC: this step should be done at just ONE of the RAC node.

No comments: