Start DG Database Automatically

In order to start a DG database automatically you can use DGMGRL. 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.

Steps for Windows:
1- Set ORA_SID_AUTOSTART to false in windows registry.

2- 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.

3- Now schedule this bat file to execute automatically at the system reboot to start the database automatically

For UNIX

++ 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.

Leave a Reply

Your email address will not be published. Required fields are marked *