These are all the instructions needed to setup two oracle XE 11g instances setup as Master Standby replication configured on two Docker containers.
docker-compose up -d
docker-compose ps
ssh root@localhost -p 49822
ssh root@oraclexe_db_standby_1
- Exchange SSH keys between master and standby
- Install rsync (apt-get install rsync) on both servers
- Amend STANDBY variable inside step_3_master_xferfiles.sh and ship_logs.sh to reflect name of your standby container
scp -P49522 step_1_master_prep.sh step_3_master_xferfiles.sh ship_logs.sh switch_log.sql root@localhost:/tmp
scp -P49622 step_2_standby_prep.sh step_4_standby_startup_standby.sh apply_logs.sh root@localhost:/tmp
ssh root@localhost -p 49522
cd /tmp
./step_1_master_prep.sh
ssh root@localhost -p 49622
cd /tmp
./step_2_standby_prep.sh
ssh root@localhost -p 49522
cd /tmp
./step_3_master_xferfiles.sh
ssh root@localhost -p 49622
cd /tmp
./step_4_standby_startup_standby.sh
ssh root@localhost -p 49522
su - oracle
cd /tmp
./ship_logs.sh
ssh root@localhost -p 49622
su - oracle
cd /tmp
./apply_logs.sh
sqlplus sys/oracle as sysdba
shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
mkdir /archivelog
chown oracle:dba /archivelog/
sqlplus sys/oracle as sysdba
alter system set db_recovery_file_dest='/archivelog' scope=both;
shutdown immediate;
create pfile=‘/archivelog/initXE.ora’ from spfile;
pushd /u01/app/oracle/oradata/XE/ ; tar zcvf masterdata.tgz *.dbf; popd
alter database create standby controlfile as '/archivelog/stbycf.ctl';
mkdir /archivelog
chown oracle:dba /archivelog/
shutdown immediate;
pushd /u01/app/oracle/
mv oradata/ oradata_original
mkdir oradata; mkdir oradata/XE; chown -R oracle:dba oradata
popd
scp /archivelog/masterdata.tgz root@oraclexe_db_standby_1:/u01/app/oracle/oradata/XE/
scp stbycf.ctl root@oraclexe_db_standby_1:/u01/app/oracle/oradata/XE/
scp initXE.ora root@oraclexe_db_standby_1:/archivelog/
chown -R oracle:dba /u01/app/oracle/oradata/XE/
chown -R oracle:dba /archivelog/
Amend pfile (/archivelog/initXE.ora/) to reflect standby controlfile (/u01/app/oracle/oradata/XE/stbycf.ctl)
startup nomount pfile='/archivelog/initXE.ora';
alter database mount standby database;
And we now have a standby database too!
./ship_logs.sh
./apply_logs.sh
Check out the demo movie to see this working in action.