Wednesday, November 18, 2009

How to Start Databases Automatically in Correct Mode and Start Recovery on Standby After O.S. Reboot


How to Start Databases Automatically in Correct Mode and Start Recovery on Standby After O.S. Reboot

Doc ID:
883196.1
Type:
HOWTO

Modified Date:
05-SEP-2009
Status:
MODERATED
In this Document
  Goal
  
Solution
Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 11.1.0.6
Information in this document applies to any platform.

Goal
How to Start Databases Automatically Correct Mode and Start Recovery on Standby After O.S. Reboot.
Solution
Use DGMGRL to start the database.
Note: In order to use DGMGRL to start the database, you must have parameter dg_broker_start=true,
You can set it to true using:

SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH;

When database is started from DGMGRL, it starts the database in mode according to database_role.

For Primary, it will start database in open read write stage.
For Physical Standby, it will start database in mount stage and also start the managed recovery.
For Logical Standby, it will start database in open stage and also start the SQL apply.

On Windows:
++ Set ORA_SID_AUTOSTART to false in windows registry.

++ Create a batch job on the both primary and standby database:

start1.bat
=========
set ORACLE_SID=
dgmgrl / "startup"

start2.bat
======
set ORACLE_SID=
dgmgrl sys/ "startup"

++ Use either of 2 (start1.bat or start2.bat), only difference in these is OS and database authentication.
++ Now schedule this bat file to execute automatically at the system reboot to start the database automatically.

On Unix Based Systems.

++ Specify "N" for startup field in the oratab file for SID.

++ Create a .ksh script on the both primary and standby database:

dg_start1.ksh
============
#! /bin/ksh
export ORACLE_SID=
dgmgrl /
startup;
EOF

dg_start2.ksh
==============
#! /bin/ksh
export ORACLE_SID=
dgmgrl sys/
startup;
EOF

++ Now change permission of "dg_start1.ksh" or "dg_start2.ksh", depending on script you want to use.

$chmod u+x dg_start1.ksh

$chmod u+x dg_start2.ksh

++ Use either of 2 (dg_start1.ksh or dg_start2.ksh), only difference in these is OS and database authentication.
++ Now schedule this ksh file to execute automatically at the system reboot to start the database automatically.

Please take help of your system administrator to schedule bat or ksh script.

No comments:

Post a Comment