This guide assumes you are setting up a physical standby database.
Step 1: Pre-Requisites
Prepare the Environment:
Ensure both the primary and standby servers have compatible Oracle versions and configurations.
Configure Oracle Grid Infrastructure and RAC on both primary and standby sites.
Network Configuration:
Set up connectivity between the primary and standby servers (e.g., configure tnsnames.ora and listener.ora).
Ensure SSH connectivity between nodes.
Enable Force Logging on the Primary Database:
Run the following on the primary database:
ALTER DATABASE FORCE LOGGING;
Check Archivelog Mode:
Ensure the primary database is in ARCHIVELOG mode:
SELECT LOG_MODE FROM V$DATABASE;
If not, enable ARCHIVELOG mode:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
Setup Standby Redo Logs (Optional):
Add standby redo logs to the primary database (recommended for real-time apply):
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 (”) SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 (”) SIZE 500M;
Step 2: Prepare the Primary Database
Create a Backup of the Primary Database:
Use RMAN to take a full backup of the primary database:
rman target /
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Generate a Parameter File (PFILE):
CREATE PFILE=’/tmp/initprimary.ora’ FROM SPFILE;
Record the DB Unique Name:
Update the DB_UNIQUE_NAME parameter in the PFILE to reflect the primary database name (e.g., PRIMARY).
Step 3: Prepare the Standby Database
Transfer Files to the Standby Server:
Copy the RMAN backup, the PFILE, and the tnsnames.ora to the standby server.
Create the Standby Instance:
Create a new PFILE for the standby database based on the primary PFILE:
cp /tmp/initprimary.ora /tmp/initstandby.ora
Edit the PFILE to reflect the standby database parameters:
text
Copy code
*.DB_UNIQUE_NAME=’STANDBY’
*.LOG_ARCHIVE_DEST_1=’LOCATION=/u01/app/oracle/arch’
*.LOG_ARCHIVE_DEST_2=’SERVICE=PRIMARY VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)’
*.FAL_SERVER=’PRIMARY’
*.FAL_CLIENT=’STANDBY’
*.DB_FILE_NAME_CONVERT=(‘/primary_path/’,’/standby_path/’)
*.LOG_FILE_NAME_CONVERT=(‘/primary_path/’,’/standby_path/’)
*.STANDBY_FILE_MANAGEMENT=AUTO
Start the Standby Instance in NOMOUNT Mode:
export ORACLE_SID=
sqlplus / as sysdba
STARTUP NOMOUNT PFILE=’/tmp/initstandby.ora’;
Restore the Standby Database:
Use RMAN to restore the database from the backup:
rman target /
RMAN> CONNECT AUXILIARY sys/@;
RMAN> RESTORE STANDBY DATABASE FROM SERVICE ;
RMAN> RECOVER DATABASE;
Step 4: Configure Redo Transport
Set Up Archivelog Shipping from Primary to Standby:
Update the LOG_ARCHIVE_DEST_2 parameter on the primary database:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=’SERVICE=STANDBY VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STANDBY’;
Enable Remote Archiving:
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG=’DG_CONFIG=(PRIMARY,STANDBY)’;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
Validate Listener Connectivity:
Ensure the tnsnames.ora and listener.ora configurations on both sites are correct. Test connectivity using:
tnsping STANDBY
tnsping PRIMARY
Step 5: Start Managed Recovery on Standby
On the standby database, start managed recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Step 6: Verify Configuration
Check Log Shipping:
Query the primary database to ensure logs are being shipped:
SELECT DEST_NAME, STATUS, ERROR FROM V$ARCHIVE_DEST;
Verify Apply Status on Standby:
Check if logs are being applied on the standby database:
SELECT THREAD#, SEQUENCE#, APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
Perform Switchover Test:
Test switchover to validate the DR setup (optional).
💡 Pro Tip: Automate backups, log shipping, and monitoring scripts to ensure a robust DR solution
Implement periodic DR drills to ensure your team is ready to handle real-time disaster scenarios.
Always maintain backups of critical DR configurations.