How to setup the Oracle Dataguard with Oracle docker images

  1. Login on docker with Oracle registry for pull the image
docker login container-registry.oracle.com

2. Pull the enterprise image from the Oracle Registry site

docker pull container-registry.oracle.com/database/enterprise:latest
example:
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker pull container-registry.oracle.com/database/enterprise:latest
latest: Pulling from database/enterprise
d480f047babc: Pulling fs layer
41fec24cd635: Pulling fs layer
26914f5ddca6: Pulling fs layer
----------
b153cc74d7e: Pull complete
f1d3ae666fec: Pull complete
0914dfef6d23: Pull complete
989a99cbd1fd: Pull complete
0c1525f69360: Pull complete
Digest: sha256:224c51ce1555ff7b75882a84b621c52b6d5ece00c96b0c5cd84e667333ad5cd7
Status: Downloaded newer image for container-registry.oracle.com/database/enterprise:latest
container-registry.oracle.com/database/enterprise:latest

After download the images of Oracle EE edition in Docker, I will create two container from which one is used as Primary database and second is Standby database.

  • Container 1 → Primary DB
  • Container 2 → Standby DB
  • Same Docker host or different hosts with network access

Example:

RoleContainerDB NameHostname
Primaryoracle-primaryORCLprimary
Standbyoracle-standbyORCLstandby

Step 3: Create a docker network

Note: Both containers must communicate.
#docker network create oracle-net
Example:
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker network create oracle-net
6521bbfd072f9b3e95f080c9ba79b02a82358ac594be36c826362f013c270457

Step 4: Create docker volume used by Primary and Standby database

docker volume create primary_oradata
docker volume create standby_oradata
Example:
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker volume create primary_oradata
primary_oradata
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker volume create standby_oradata
standby_oradata

Step 5: Verify the volumnes and network

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker volume ls
DRIVER VOLUME NAME
local 1a28799731415b24072a5955b0547c727b3133aa82f717fd3b7205b22ecfeb9d
local 9e80451532d8baa39ea981df5ae6804e20e146a464ae7a819290f8b61134aea8
local 39b57a53196b8782f11769a27b6c83100a47994efc51a3184c44d8cd70f4ea99
local 46e60a1173d0315167cc6f4ca2f99b33674ac84e8417cf0fe3220268e6633f7b
local 70ed0e47878140ec6d1d5d93c97a7362ff8124344890ae331f74b021f6d005e7
local 35780d8b81fe3e283d2385e0cb0ea87c63b70b5f587c8b7da491dd93a94fcfdc
local ORACLE_DATA
local primary_oradata
local standby_oradata
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker network ls
NETWORK ID NAME DRIVER SCOPE
1d0052991f64 bridge bridge local
11f5361c20ae host host local
4f350cd06c59 none null local
6521bbfd072f oracle-net bridge local

Step 6: Start the container with Volume and with following setting:

Explanation:

OptionPurpose
-v primary_oradata:/opt/oracle/oradataStores DB files in volume
--network oracle-netEnables container communication
--hostname primaryUsed in TNS configuration
Command:
docker run -d \
--name oracle-primary \
--hostname primary \
--network oracle-net \
-p 1521:1521 \
-v primary_oradata:/opt/oracle/oradata \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=Oracle123 \
-e ENABLE_ARCHIVELOG=true \
container-registry.oracle.com/database/enterprise:latest

Example:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$
docker run -d \
--name oracle-primary \
--hostname primary \
--network oracle-net \
-p 1521:1521 \
-v primary_oradata:/opt/oracle/oradata \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=Oracle123 \
-e ENABLE_ARCHIVELOG=true \
container-registry.oracle.com/database/enterprise:latest
2bf9547103361dc36fb902683ef77e538d35f876b5340595c3ae2110d922982f

Step 7: Run the Standby database container with volume

docker run -d \
--name oracle-standby \
--hostname standby \
--network oracle-net \
-p 1522:1521 \
-v standby_oradata:/opt/oracle/oradata \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=Oracle123 \
-e ENABLE_ARCHIVELOG=true \
container-registry.oracle.com/database/enterprise:latest

Example:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker run -d \
--name oracle-standby \
--hostname standby \
--network oracle-net \
-p 1522:1521 \
-v standby_oradata:/opt/oracle/oradata \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=Oracle123 \
-e ENABLE_ARCHIVELOG=true \
container-registry.oracle.com/database/enterprise:latest
07a7b7ee0072da48957f5a07143c484105360a9d9d265030622cfac87a9f349d

Step 8: Verify that both container are creating or any error by logs command:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker logs oracle-primary
[2026:03:16 05:41:50]: Acquiring lock .ORCL.create_lck with heartbeat 30 secs
[2026:03:16 05:41:50]: Lock acquired
[2026:03:16 05:41:50]: Starting heartbeat
[2026:03:16 05:41:50]: Lock held .ORCL.create_lck
ORACLE EDITION: ENTERPRISE
Prepare for db operation
8% complete
Copying database files
----
----
----
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
2026-03-16T05:58:05.075715+00:00
ORCLPDB1(3):CREATE BIGFILE TABLESPACE "USERS" LOGGING DATAFILE SIZE 7M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
ORCLPDB1(3):Tablespace created: USERS ts# 6
ORCLPDB1(3):Completed: CREATE BIGFILE TABLESPACE "USERS" LOGGING DATAFILE SIZE 7M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
ORCLPDB1(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
ORCLPDB1(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
2026-03-16T05:58:09.017017+00:00
ALTER SYSTEM SET local_listener='' SCOPE=BOTH;
ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker logs oracle-standby
[2026:03:16 05:45:12]: Acquiring lock .ORCL.create_lck with heartbeat 30 secs
[2026:03:16 05:45:12]: Lock acquired
[2026:03:16 05:45:12]: Starting heartbeat
[2026:03:16 05:45:12]: Lock held .ORCL.create_lck
ORACLE EDITION: ENTERPRISE

Note: When you see in the log that database is ready to use then you can use continue with following steps:

Step 9: We need to wait until both database are come in open state:

-- Check the primary database first:
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker exec -it oracle-primary bash
bash-4.4$ sqlplus / as sysdba
SQL*Plus: Release 23.26.1.0.0 - Production on Mon Mar 16 05:48:15 2026
Version 23.26.1.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
SQL> select status from v$instance;
STATUS
------------
OPEN

Step 10: Check the database in Archive mode

archive log list;
ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker exec -it oracle-primary bash
bash-4.4$ sqlplus / as sysdba
SQL*Plus: Release 23.26.1.0.0 - Production on Mon Mar 16 06:26:15 2026
Version 23.26.1.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/oracle/oradata/ORCL/archive_logs
Oldest online log sequence 2
Next log sequence to archive 2
Current log sequence 1

Step 11: Put the primary database container to force logging mode.

SQL> alter database force logging;
Database altered.

Step 12: Create standby redo log files in Primary database container:

-- Check the Redo Logs files present:
set line 200 pages 200
col file_name for a60
SELECT a.GROUP#,(a.BYTES/1024/1024) AS SIZE_MB, b.MEMBER AS FILE_NAME
FROM v$log a JOIN v$logfile b ON a.Group#=b.Group#
ORDER BY a.GROUP#;
Example:
SQL> set line 200 pages 200
col file_name for a60
SELECT a.GROUP#,(a.BYTES/1024/1024) AS SIZE_MB, b.MEMBER AS FILE_NAME
FROM v$log a JOIN v$logfile b ON a.Group#=b.Group#
ORDER BY a.GROUP#;SQL> SQL> 2 3
GROUP# SIZE_MB FILE_NAME
---------- ---------- ------------------------------------------------------------
1 200 /opt/oracle/oradata/ORCL/onlinelog/o1_mf_1_nvh6dmgp_.log
2 200 /opt/oracle/oradata/ORCL/onlinelog/o1_mf_2_nvh6dmvb_.log
3 200 /opt/oracle/oradata/ORCL/onlinelog/o1_mf_3_nvh6dnxl_.log

Add the standby log files:

alter database add standby logfile group 4 ('/opt/oracle/oradata/ORCL/srl04.log') size 200M;
alter database add standby logfile group 5 ('/opt/oracle/oradata/ORCL/srl05.log') size 200M;
alter database add standby logfile group 6 ('/opt/oracle/oradata/ORCL/srl06.log') size 200M;
alter database add standby logfile group 7 ('/opt/oracle/oradata/ORCL/srl07.log') size 200M;
Verify the standby redo log files:
SQL> SELECT GROUP#, THREAD#, SEQUENCE#, BYTES, ARCHIVED, STATUS FROM V$STANDBY_LOG
ORDER BY THREAD#, GROUP#;
GROUP# THREAD# SEQUENCE# BYTES ARC STATUS
---------- ---------- ---------- ---------- --- ----------
4 0 0 209715200 YES UNASSIGNED
5 0 0 209715200 YES UNASSIGNED
6 0 0 209715200 YES UNASSIGNED
7 0 0 209715200 YES UNASSIGNED

Step 13: Configure the TNSNAMES.ora file for both Primary and Standby entry

vi /opt/oracle/product/26ai/dbhome_1/network/admin/tnsnames.ora
PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)

Test the ping command:

bash-4.4$ tnsping standby
TNS Ping Utility for Linux: Version 23.26.1.0.0 - Production on 16-MAR-2026 07:13:59
Copyright (c) 1997, 2026, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/26ai/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (10 msec)
bash-4.4$ tnsping primary
TNS Ping Utility for Linux: Version 23.26.1.0.0 - Production on 16-MAR-2026 07:14:48
Copyright (c) 1997, 2026, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/26ai/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (10 msec)

Note: Both the machine run on docker at time of testing.

Step 14: Add the Dataguard parameter on the primary container:

alter system set db_unique_name=PRIMARY scope=spfile;
-- After setting first parameter need to reboot the Primary container
# Docker stop oracle-primary
# Docker start oracle-primary
alter system set log_archive_config='DG_CONFIG=(PRIMARY,STANDBY)' scope=both;
alter system set log_archive_dest_1='LOCATION=/opt/oracle/oradata/ORCL/archive_logs VALID_FOR=(ALL_LOGFILES,ALL_ROLES DB_UNIQUE_NAME=PRIMARY' scope=both;
alter system set log_archive_dest_2='SERVICE=STANDBY ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STANDBY' scope=both;
alter system set standby_file_management=AUTO scope=both;
alter system set fal_server=STANDBY scope=both;
alter system set fal_client=PRIMARY scope=both;

Prepare the Standby Database:

Step 15: Open the Standby database in nomount state:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker exec -it oracle-standby bash
bash-4.4$ sqlplus / as sysdba
SQL*Plus: Release 23.26.1.0.0 - Production on Mon Mar 16 07:29:01 2026
Version 23.26.1.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1607700512 bytes
Fixed Size 5009440 bytes
Variable Size 452984832 bytes
Database Buffers 1140850688 bytes
Redo Buffers 8855552 bytes
SQL>

Step 16: Configure the TNSNAMES.ORA for both entry in Standby Database Server or Container. Check the path of network folder from lsnrctl status command

vi /opt/oracle/product/26ai/dbhome_1/network/admin/tnsnames.ora
Enter the following entries:
PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)

Verify the tnsping command for both

bash-4.4$ tnsping standby
TNS Ping Utility for Linux: Version 23.26.1.0.0 - Production on 16-MAR-2026 07:41:40
Copyright (c) 1997, 2026, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/26ai/dbhome_1/network/admin/sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=tcp)(HOST=172.18.0.3)(PORT=1521)))
OK (0 msec)
bash-4.4$ tnsping primary
TNS Ping Utility for Linux: Version 23.26.1.0.0 - Production on 16-MAR-2026 07:47:13
Copyright (c) 1997, 2026, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/26ai/dbhome_1/network/admin/sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=tcp)(HOST=172.18.0.2)(PORT=1521)))
OK (0 msec)

Step 17: Empty the standby by ORCL folder

rm -rf /opt/oracle/oradata/ORCL/

Step 18: Run the RMAN backup for duplicate command to create a standby database as primary

rman target sys/Oracle123@PRIMARY auxiliary sys/Oracle123@STANDBY
RMAN> duplicate target database
for standby
from active database
dorecover
no filenamecheck;

Example:



RMAN> duplicate target database
for standby
from active database
dorecover
no filenamecheck;duplicate target database
2> for standby
3> from active database
4> dorecover
;  
;
Starting Duplicate Db at 16-MAR-26
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=146 device type=DISK
^C
user interrupt received
Oracle error from target database: 
ORA-16038: log 3 sequence# 3 cannot be archived
ORA-01013: User requested cancel of current operation.
ORA-00312: online log 3 thread 1: '/opt/oracle/oradata/ORCL/onlinelog/o1_mf_3_nvh6dnxl_.log'
Help: https://docs.oracle.com/error-help/db/ora-16038/


contents of Memory Script:
{
   backup as copy reuse
   passwordfile auxiliary format  '/opt/oracle/product/26ai/dbhome_1/dbs/orapwORCL'   ;
}
executing Memory Script

Starting backup at 16-MAR-26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
Finished backup at 16-MAR-26
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location

contents of Memory Script:
{
   sql clone "alter system set  control_files = 
  ''/opt/oracle/oradata/ORCL/controlfile/o1_mf_nvhcm95q_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   restore clone from service  'PRIMARY' standby controlfile;
}
executing Memory Script

sql statement: alter system set  control_files =   ''/opt/oracle/oradata/ORCL/controlfile/o1_mf_nvhcm95q_.ctl'' comment= ''Set by RMAN'' scope=spfile

Starting restore at 16-MAR-26
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/opt/oracle/oradata/ORCL/controlfile/o1_mf_nvhcm95q_.ctl
Finished restore at 16-MAR-26

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   set newname for clone tempfile  2 to new;
   set newname for clone tempfile  3 to new;
   switch clone tempfile all;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  7 to new;
   set newname for clone datafile  9 to new;
   set newname for clone datafile  11 to new;
   set newname for clone datafile  12 to new;
   set newname for clone datafile  13 to new;
   set newname for clone datafile  14 to new;
   set newname for clone datafile  15 to new;
   restore
   from  nonsparse   from service 
 'PRIMARY'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /opt/oracle/oradata/ORCL/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 2 to /opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_temp_%u_.tmp in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 16-MAR-26
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /opt/oracle/oradata/ORCL/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /opt/oracle/oradata/ORCL/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /opt/oracle/oradata/ORCL/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00011 to /opt/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00012 to /opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00013 to /opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00014 to /opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00015 to /opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 16-MAR-26

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
   restore clone force from service  'PRIMARY' 
           archivelog from scn  2086240;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 16-MAR-26
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=3
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=4
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PRIMARY
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 16-MAR-26

datafile 1 switched to datafile copy
input datafile copy RECID=12 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/datafile/o1_mf_system_nvht6kkv_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=13 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_system_nvht7c4v_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=14 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/datafile/o1_mf_sysaux_nvht7lbt_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=15 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_sysaux_nvht81oc_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/datafile/o1_mf_users_nvht88x8_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=17 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/48945B67D122C623E063399B5E6478E6/datafile/o1_mf_undotbs1_nvht8b4h_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=18 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_nvht8cfv_.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=19 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_system_nvht8dp9_.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=20 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_sysaux_nvht8myn_.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=21 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_undotbs1_nvht8v7k_.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=22 STAMP=1228044450 file name=/opt/oracle/oradata/ORCL/4D1EE33C748411B2E063020012AC5D89/datafile/o1_mf_users_nvht8wdz_.dbf

contents of Memory Script:
{
   set until scn  2103559;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause (SCN)

Starting recover at 16-MAR-26
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file /opt/oracle/oradata/ORCL/archive_logs1_4_1228024083.dbf
archived log for thread 1 with sequence 5 is already on disk as file /opt/oracle/oradata/ORCL/archive_logs1_5_1228024083.dbf
recovery status time_needed 2026-03-16 11:25:57
archived log file name=/opt/oracle/oradata/ORCL/archive_logs1_4_1228024083.dbf thread=1 sequence=4
recovery status time_needed 2026-03-16 11:27:25
archived log file name=/opt/oracle/oradata/ORCL/archive_logs1_5_1228024083.dbf thread=1 sequence=5
media recovery complete, elapsed time: 00:00:01
Finished recover at 16-MAR-26

contents of Memory Script:
{
   delete clone force archivelog all;
}
executing Memory Script

released channel: ORA_DISK_1
released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
deleted archived log
archived log file name=/opt/oracle/oradata/ORCL/archive_logs1_3_1228024083.dbf RECID=1 STAMP=1228044446
deleted archived log
archived log file name=/opt/oracle/oradata/ORCL/archive_logs1_4_1228024083.dbf RECID=2 STAMP=1228044447
deleted archived log
archived log file name=/opt/oracle/oradata/ORCL/archive_logs1_5_1228024083.dbf RECID=3 STAMP=1228044449
Deleted 3 objects

Finished Duplicate Db at 16-MAR-26


RMAN> 


Set the parameter on Standby database:

alter system set db_file_name_convert='/opt/oracle/oradata/ORCL','/opt/oracle/oradata/ORCL';
alter system set log_file_name_convert='/opt/oracle/oradata/ORCL','/opt/oracle/oradata/ORCL';
alter system set log_archive_config='DG_CONFIG=(PRIMARY,STANDBY)' scope=both;
alter system set log_archive_dest_1='LOCATION=/opt/oracle/oradata/ORCL/archive_logs VALID_FOR=(ALL_LOGFILES,ALL_ROLES DB_UNIQUE_NAME=STANDBY' scope=both;
alter system set log_archive_dest_2='SERVICE=PRIMARY ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRIMARY' scope=both;
alter system set fal_server=PRIMARY scope=both;
alter system set fal_client=STANDBY scope=both;
alter system set standby_file_management='AUTO' scope=both;

Start the replication service of dataguard:

alter database recover managed standby database disconnect from session;
Select name,open_mode,database_role from v$database;

I am facing challegne in docker for passward files to copy paste and keep it same permission in the image here is the solution

-- Create a new password file with format specify on primary database
orapwd file=/opt/oracle/product/26ai/dbhome_1/dbs/orapwORCL password=Someone#369 format=12
-- Copy paste the password file to host machine where docker running then move to standby docker container
docker cp oracle-primary:/opt/oracle/product/26ai/dbhome_1/dbs/orapwORCL .
-- Copy from host machine to standby machine
docker cp orapwORCL oracle-standby:/opt/oracle/product/26ai/dbhome_1/dbs/
-- now change the owner and group as it is presnet for old files
docker exec -u root oracle-standby chown oracle:dba /opt/oracle/product/26ai/dbhome_1/dbs/orapwORCL
-- now change the owner and group for primary
docker exec -u root oracle-primary chown oracle:dba /opt/oracle/product/26ai/dbhome_1/dbs/orapwORCL
-- Now down both the machine
docker stop oracle-standby
docker stop oracle-primary
docker start oracle-primary
docker start oracle-standby
-- Start the recovery processes:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Example:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker run -d \
--name oracle-standby \
--hostname standby \
--network oracle-net \
-p 1522:1521 \
-v standby_oradata:/opt/oracle/oradata \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=Oracle123 \
-e ENABLE_ARCHIVELOG=true \
container-registry.oracle.com/database/enterprise:latest
ed6030c2145838f5902fd6dbccbcb7a0a450f2ff6bfe2f94d3c39b75101bac7c
ubuntu01@ubuntu01-VirtualBox:~/Desktop$

Step 8: Verify the containers:

docker ps

Example:

ubuntu01@ubuntu01-VirtualBox:~/Desktop$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ed6030c21458 container-registry.oracle.com/database/enterprise:latest "/bin/sh -c 'exec $O…" About a minute ago Up About a minute (health: starting) 0.0.0.0:1522->1521/tcp, [::]:1522->1521/tcp oracle-standby
57712a13a506 container-registry.oracle.com/database/enterprise:latest "/bin/sh -c 'exec $O…" 3 minutes ago Up 3 minutes (health: starting) 0.0.0.0:1521->1521/tcp, [::]:1521->1521/tcp oracle-primary

Note: Both containers are running the same version

Step 9: Enter the primary container

docker exec -it oracle-primary bash
Login with SQLPLUS
sqlplus / as sysdba

Step 10: Enable the archive mode in Primary Container

shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
Archive log list;