Oracle Data Guard is a robust disaster recovery and high availability solution that ensures data protection and availability across primary and standby databases. As a DBA, you may sometimes need to shutdown or startup the Data Guard configuration—for example, during maintenance, patching, or system upgrades.
đź”» Shutting Down Data Guard Configuration
When shutting down Data Guard, we need to carefully stop log apply on the standby, stop log shipping from the primary, and then bring down both databases in the correct sequence.
Steps to Shutdown:
1. Stop log apply service on the standby database
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2. Shutdown the standby database
SHUT IMMEDIATE;
3. Stop log shipping from the primary database
ALTER SYSTEM SET log_archive_dest_state_2='DEFER';
4. Shutdown the primary database
SHUT IMMEDIATE;
Starting Up Data Guard Configuration
When starting up, the order is reversed: we bring up the primary first, enable log shipping, then mount the standby, and finally start managed recovery.
Steps to Startup:
1. Startup the primary database
STARTUP;
2. Enable log shipping from the primary
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE';
3. Startup the standby database and mount it
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;
4. Start the managed recovery process (MRP) on the standby
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;