Steps to Startup & Shutdown Oracle Data Guard !
2 min readTo start a physical standby database, follow these steps using SQL*Plus with administrator privileges:
Start the database in NOMOUNT mode:
- Use the
STARTUP NOMOUNT
command to initialize the standby database. - The
NOMOUNT
option is mandatory when starting a standby database.
SQL> STARTUP NOMOUNT;
Mount the standby database:
- After starting, mount the database in standby mode to allow it to receive archived redo data from the primary database.
SQL> ALTER DATABASE MOUNT STANDBY DATABASE;
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY MOUNTED
Start managed recovery (optional):
- Typically, after mounting, you start the managed recovery process to apply redo logs.
- The following command initiates recovery and runs in the background:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Start the DB with SRVCTL commands
-- SYNTAX FOR START DB
srvctl start database -d db_name [-o start_options]
where start_option is nomount/mount/open(default)
e.g
srvctl start database -d CERTDB -o nomount
srvctl start database -d CERTDB -o mount
srvctl start database -d CERTDB -o open
To safely shut down a physical standby database, follow these steps:
Check if Managed Recovery is Active:
- First, check whether the standby database is performing managed recovery. If the MRP0 or MRP process is running, it indicates that the managed recovery is active.
SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
Cancel Managed Recovery:
- If managed recovery is active, you need to cancel it before proceeding with the shutdown
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Shut Down the Standby Database:
- After canceling managed recovery and deferring the archive log destination (if needed), proceed with shutting down the standby database.
SQL> SHUTDOWN IMMEDIATE;
Stop the DB with SRVCTL Commands
-- SYNTAX FOR STOP DB
srvctl stop database -d db_name [-o stop_options]
where stop_options is normal/immediate(default)/transactional/abort
e.g
srvctl stop database -d PRODB -o normal
srvctl stop database -d PRODB -o immediate
srvctl stop database -d PRODB -o transactional
srvctl stop database -d PRODB -o abort
Hope it helped !! 🙂