RMAN duplicate to create a clone database READ/Write

This tutorial explains the steps to to clone an existing Oracle database to new server .

$ rman target sys/password@wadodb auxiliary sys/password@wadodbsb
Recovery Manager: Release 19.0.0.0.0 - Production on Sun April 30 23:39:09 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: WADODBSB (not mounted)
RMAN> duplicate database to wadodbsb from active database nofilenamecheck;
Starting Duplicate Db at 30-APRIL-23
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=410 device type=DISK
current log archived
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1073737776 bytes
Fixed Size 8933424 bytes
Variable Size 658505728 bytes
Database Buffers 398458880 bytes
Redo Buffers 7839744 bytes
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 db_name =
''WADODB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''wadodbsb'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone from service 'wadodb' primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''WADODB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''wadodbsb'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1073737776 bytes
Fixed Size 8933424 bytes
Variable Size 658505728 bytes
Database Buffers 398458880 bytes
Redo Buffers 7839744 bytes
Starting restore at 30-APRIL-23
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=409 device type=DISK
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 30-APRIL-23
database mounted
contents of Memory Script:
{
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
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 30-APRIL-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:07
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: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 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:02
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 30-APRIL-23
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'wadodb'
archivelog from scn 2380431;
switch clone datafile all;
}
executing Memory Script
Starting restore at 30-APRIL-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=12
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=13
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 30-APRIL-23
datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_system_l600y55n_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_l600ydg8_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_sysaux_l600yfp9_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_undotbs1_l600ynv8_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600yqxh_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=14 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600ys1p_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=15 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yt48_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=16 STAMP=1136763648 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yv86_.dbf
contents of Memory Script:
{
set until scn 2380561;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 30-APRIL-23
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 12 is already on disk as file /backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_12_l600yy7y_.arc
archived log for thread 1 with sequence 13 is already on disk as file /backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_13_l600yzgl_.arc
archived log file name=/backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_12_l600yy7y_.arc thread=1 sequence=12
archived log file name=/backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_13_l600yzgl_.arc thread=1 sequence=13
media recovery complete, elapsed time: 00:00:00
Finished recover at 30-APRIL-23
contents of Memory Script:
{
delete clone force archivelog all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=890 device type=DISK
deleted archived log
archived log file name=/backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_12_l600yy7y_.arc RECID=1 STAMP=1136763646
deleted archived log
archived log file name=/backup/WADODBSB/archivelog/2023_04_30/o1_mf_1_13_l600yzgl_.arc RECID=2 STAMP=1136763647
Deleted 2 objects
Oracle instance started
Total System Global Area 1073737776 bytes
Fixed Size 8933424 bytes
Variable Size 658505728 bytes
Database Buffers 398458880 bytes
Redo Buffers 7839744 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''WADODBSB'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script
sql statement: alter system set db_name = ''WADODBSB'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started
Total System Global Area 1073737776 bytes
Fixed Size 8933424 bytes
Variable Size 658505728 bytes
Database Buffers 398458880 bytes
Redo Buffers 7839744 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "WADODBSB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 200 M ,
GROUP 2 SIZE 200 M ,
GROUP 3 SIZE 200 M
DATAFILE
'/data/wadodb/WADODBSB/datafile/o1_mf_system_l600y55n_.dbf'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
catalog clone datafilecopy "/data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_l600ydg8_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_sysaux_l600yfp9_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_undotbs1_l600ynv8_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_users_l600yqxh_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_users_l600ys1p_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yt48_.dbf",
"/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yv86_.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /data/wadodb/WADODBSB/datafile/o1_mf_temp_%u_.tmp in control file
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_l600ydg8_.dbf RECID=1 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_sysaux_l600yfp9_.dbf RECID=2 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_undotbs1_l600ynv8_.dbf RECID=3 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600yqxh_.dbf RECID=4 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600ys1p_.dbf RECID=5 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yt48_.dbf RECID=6 STAMP=1136763681
cataloged datafile copy
datafile copy file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yv86_.dbf RECID=7 STAMP=1136763681
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_asyw_tbs_l600ydg8_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_sysaux_l600yfp9_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_undotbs1_l600ynv8_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600yqxh_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=5 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_users_l600ys1p_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=6 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yt48_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=7 STAMP=1136763681 file name=/data/wadodb/WADODBSB/datafile/o1_mf_wado_tbs_l600yv86_.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Cannot remove created server parameter file
Finished Duplicate Db at 30-APRIL-23
RMAN>

Enjoy!

Bookmark the permalink.
Loading Facebook Comments ...

Leave a Reply