Showing posts with label ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION. Show all posts
Showing posts with label ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION. Show all posts

Friday, April 24, 2015

How to Bounce Oracle11g Active Data Guard Standby Database?

This post is tested in Oracle 11.2.0.4 Active Data Guard instance.  This step works on 11.1.0.7, 11.2.0.2, 11.2.0.4 as well.  Let us assume, we have primary and standby database and we need to shutdown the standby database for maintenance schedule.


Step1
Tail the alert log on  both primary and standby for monitoring the database.
tail -f  alert_$ORACLE_SID.log

Defer  the log shipping in primary database.
Login to primary database and run the below command to defer the log shipping. Assuming, log_archive_dest_state_2 is standby location.

alter system set log_archive_dest_state_2='DEFER' scope=both;


Step2
Login to standby database and shutdown the database.

alter database recover managed standby database cancel;
shutdown immediate

After the maintenance schedule is over, then bring the standby instance.

Step3
Login to primary instance and enable the log shipping.

alter system set log_archive_dest_state_2='ENABLE' scope=both;

Step4
Login to standby instance, run the below command.

startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session;

Leave the standby instance for few min to catch up the logs and run the rest of the commands.

alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect;

Check the alert logs on the both primary and standby and make sure no errors.

Please remember, It will be different steps to bounce the Oracle10g  standby database. Since Oracle10g is not an active Data Guard.  Please click here to view the steps to bounce the Oracle10g data guard standby database.

Friday, September 12, 2008

Shutdown startup procedure for Standby database

This article is written  and tested in oracle 9.2.0.8. Please remember, Oracle11g has Active Data Guard and it will be different steps. Please do not follow this topic for Oracle 11g and above version!

Please refer Click for Oracle11g standby database bounce.

Startup and shutdown the standby database is different then the Primary database. If we want to shutdown the primary and standby database both, it would be better to shutdown primary DB first, then shutdown the standby DB. If we shutdown the PRIMARY DB first, then all the changes will be shipped to standby.
Shutdown procedure for Primary/standby
Step1 : Tail the alert log for primary and standby.
Login to primary and standby server and tail the alert log as below.
tail -f  alert_$ORACLE_SID.log

Step2 : Make sure application is down and no activity on the database.

Step3 :  To be safer side, switch the log file few times and flush out the redo logs. Then shutdown the primary database.
alter system archive log current;
alter system archive log current;
alter system archive log current;
shutdown immediate;
Just make sure all the archive logs are shipped to standby.

Step4 : Once the primary DB shutdown is successful, then steps to shutdown standby DB.
alter database recover managed standby database cancel;
shutdown immediate

Startup procedure for Primary/standby
Step1 :  Start the primary database
startup
Application team can start the application against the primary database.
Enable the log shipping in primary database.
alter system set log_archive_dest_state_2='ENABLE' scope=both;
At this point, you might see some error message on alert log. since primary is trying to connect standby and still standby is not yet up and running.

Step2 : Start the standby database
startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect from session

Watch out the alert log and make sure log shipping is working fine and no error on the alert log. Verify the v$archived_log and make sure archive logs are applying on standby database.
Please remember, the above steps works till Oracle10g. Starting from Oracle11g, Oracle introduced Active Data Guard and it will be different steps to bounce the standby data base. Please click here to view the steps to bounce the Oracle11g Active Data Guard.