Skip to content

Standby Database Creation (Backup Mode)

1. Prepare

  • 1.1 Login PRD server and enter PRD DB, then setup DB to backup mode
export ORACLE_SID=WZSDW
sqlplus / as sysdba

change PRD DB mode to backup

alter database begin backup;

image-20251001190729351

2. Copy Data

  • 2.1 Copy PRD DB data to STB server

copy data file / redolog to STB DB server

scp -rp /oradata/WZSDW/ oracle@STB-SERVER-IP:/oradata/

image-20251002003415280

copy archive log to STB DB server (if archive under /oradata/WZSDW, you can ignore this step)

copy dbs file (pfile/spfile...) to STB DB Server

scp -p /oracle/ora19c/dbs/*WZSDW* oracle@STB-SERVER-IP:/oracle/ora19c/dbs/

image-20251002003240791

3. Create control file

  • 3.1 End PRD DB backup mode
export ORACLE_SID=WZSDW
sqlplus / as sysdba
alter database end backup;
  • 3.2 Create STB control file @PRD DB
alter database create standby controlfile as '/tmp/WZSDW-stb.ctl';
exit

image-20251002162136428

  • 3.3 Copy control file to STB DB server
scp -p /tmp/WZSDW-stb.ctl oracle@STB-SERVER-IP:/tmp/

image-20251002162314913

4. Start STB DB

  • 4.1 Login STB DB server, and make sure STB all foler created

If there is anything missing, please create it first

mkdir -p /oradata/DB_AUDIT/WZSDW

image-20251002162740708

  • 4.2 Replace stb control file
cp -a /tmp/WZSDW-stb.ctl /oradata/WZSDW/control01.ctl 
cp -a /tmp/WZSDW-stb.ctl /oradata/WZSDW/origlog/control02.ctl 
cp -a /tmp/WZSDW-stb.ctl /oradata/WZSDW/mirrlog/control03.ctl

image-20251002163132595

  • 4.3 Start STB DB, and manual execution standby db recover
export ORACLE_SID=WZSDW
sqlplus / as sysdba
startup nomount;
alter database mount standby database;
recover standby database;

image-20251002164436877

5. Config Sync script

  • Prepare PRD DB server script

Download oracle DB script from gitlab, and modify configure file

vim /home/oracle/Manual_PRD_Sync/SYNC_PRD_WZSDW.ini

image-20251002170642239

Setup the cron job to sync archive log regularly

crontab -e

image-20251002165827110

  • Prepare STB DB server script

Download oracle DB script from gitlab, and modify configure file

vim /home/oracle/Manual_STB_Sync/RECOVER_STB_WZSDW.ini

image-20251002170407933

Setup the cron job to sync archive log regularly

crontab -e

image-20251002170848844