RMAN duplicate Database for Data Guard ( 19c )

This article lists the command RMAN to create a standby database from active database within Oracle Database 19c.

After the creation of all Oracle Services naming for both instance Active/Standby and after adding Database services within the Listener, we are going to clone the active database to create a standby database.

Run RMAN command

$ rman target sys/password@wadodb auxiliary sys/password@wadodbsb
Recovery Manager: Release 19.0.0.0.0 - Production on Sat May 13 23:49:50 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: WADODB (DBID=1714169206)
connected to auxiliary database: WADODB (not mounted)
RMAN> duplicate target database for standby from active database dorecover nofilenamecheck;
Starting Duplicate Db at 13-MAY-23
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=870 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
passwordfile auxiliary format '/u01/app/oracle/product/19c/dbhome_1/dbs/orapwwadodbsb' ;
}
executing Memory Script
Starting backup at 13-MAY-23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=889 device type=DISK
Finished backup at 13-MAY-23
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location
contents of Memory Script:
{
restore clone from service 'wadodb' standby controlfile;
}
executing Memory Script
Starting restore at 13-MAY-23
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 wadodb
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/data/wadodb/control01.ctl
output file name=/backup/wadodb/control02.ctl
Finished restore at 13-MAY-23
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;
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 5 to new;
set newname for clone datafile 7 to new;
set newname for clone datafile 8 to new;
set newname for clone datafile 9 to new;
restore
from nonsparse from service
'wadodb' clone database
;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /data/wadodb/WADODBSB/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
Starting restore at 13-MAY-23
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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /data/wadodb/WADODBSB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_%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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /data/wadodb/WADODBSB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /data/wadodb/WADODBSB/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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /data/wadodb/WADODBSB/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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /data/wadodb/WADODBSB/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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to /data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_%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 wadodb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_%u_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 13-MAY-23
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'wadodb'
archivelog from scn 2481949;
switch clone datafile all;
}
executing Memory Script
Starting restore at 13-MAY-23
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 wadodb
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=17
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 wadodb
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=18
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 13-MAY-23
datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_system_l601jo74_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_l601jwcg_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_sysaux_l601jxjc_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_undotbs1_l601k0nb_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l601k1on_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=14 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l601k2sg_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=15 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l601k3w8_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=16 STAMP=1136764234 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l601k503_.dbf
contents of Memory Script:
{
set until scn 2482056;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 13-MAY-23
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 17 is already on disk as file /backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_17_l601k7yo_.arc
archived log for thread 1 with sequence 18 is already on disk as file /backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_18_l601k95k_.arc
archived log file name=/backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_17_l601k7yo_.arc thread=1 sequence=17
archived log file name=/backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_18_l601k95k_.arc thread=1 sequence=18
media recovery complete, elapsed time: 00:00:00
Finished recover at 13-MAY-23
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=889 device type=DISK
deleted archived log
archived log file name=/backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_17_l601k7yo_.arc RECID=1 STAMP=1136764231
deleted archived log
archived log file name=/backup/WADODBSB/archivelog/2023_05_13/o1_mf_1_18_l601k95k_.arc RECID=2 STAMP=1136764233
Deleted 2 objects
Finished Duplicate Db at 13-MAY-23
RMAN>

Enjoy!

Bookmark the permalink.
Loading Facebook Comments ...

Leave a Reply