Prerequisites- Primary Database: Ensure the primary database is in
ARCHIVELOG
mode and hasFORCE LOGGING
enabled. - Network Configuration: Ensure proper network connectivity between the primary and standby sites.
- Oracle Software: Install the same version of Oracle software on the standby server.
- Storage: Ensure sufficient storage is available on the standby server.
Steps to Create a Standby Database
1. Enable Archiving and Force Logging on the Primary Database
-- Connect to the primary database as SYSDBA SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT; SQL> ALTER DATABASE ARCHIVELOG; SQL> ALTER DATABASE OPEN; SQL> ALTER DATABASE FORCE LOGGING;
2. Create a Password File on the Primary Database
Ensure the primary database has a password file. If not, create one:
orapwd file=$ORACLE_HOME/dbs/orapw
password= entries=10
3. Configure the Primary Database for Data Guard
Add the following parameters to the primary database's
spfile
orpfile
:ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary_db,standby_db)'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby_db VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby_db'; ALTER SYSTEM SET FAL_SERVER=standby_db; ALTER SYSTEM SET FAL_CLIENT=primary_db; ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
4. Create a Backup of the Primary Database
Use RMAN to create a backup of the primary database:
rman target / RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
5. Copy the Backup to the Standby Server
Transfer the backup files to the standby server using
scp
,rsync
, or any other file transfer method.6. Create an Initialization Parameter File for the Standby Database
Create a
pfile
for the standby database:CREATE PFILE='/path/to/standby_init.ora' FROM SPFILE;
Edit the
pfile
to reflect the standby database's settings - Primary Database: Ensure the primary database is in
-