Sometimes we have to create a replica of production database to perform some test in it. we can create that replica using RMAN Duplicate command.
We can create this replica using Backups of production database as well as from Active production Database. RMAN Duplicate command gives us facility to create a replica of Production Database without backup.
We can do below mentioned things using RMAN Duplicate command :-
1. Duplicate a Production database on same host with different directory structure.
2. Duplicate a Production database on another host with same directory structure.
3. Duplicate a Production database on another host with different directory structure.
Duplicate of production database can be doe using below mention methods :-
1. Backup Based Duplication
2. Active Database Duplication
In this article I will show you how to do Duplicate using Active Database duplication.
PFB steps to Duplicate a Production database on another host with different directory structure using Active database Duplication :-
1. Check that primary database is up and running in Archivelog mode :-
SQL> select name,open_mode,LOG_MODE from v$database;
NAME OPEN_MODE LOG_MODE
--------- -------------------- ------------
AMIT READ WRITE ARCHIVELOG
2. Add the tns details of target and auxiliary in both server(Target, Auxiliary)
AMIT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.20.12)(PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = amit.db.com)
)
)
AMIT_DUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.20.14)(PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = amit.db.com)
)
)
3. Add the static entry of Auxiliary instance in listener.ora file
(SID_DESC =
(GLOBAL_DBNAME = amit.db.com)
(SID_NAME = TEST)
(ORACLE_HOME = /opt/oracle/product/database/11.2.0.4)
)
4. On Target host create pfile for Auxiliary Database :-
*.audit_file_dest='/ora_backup/TEST/duplicate_test/AMIT/adump'
*.audit_trail='DB'
*.compatible='11.2.0.4.0'
*.control_files='/ora_backup/TEST/duplicate_test/AMIT/control01.ctl','/ora_backup/TEST/duplicate_test/AMIT/control02.ctl'
*.db_block_size=16384
*.db_file_name_convert='/ora_backup/TEST1/restore_test/AMIT/DATA','/ora_backup/TEST/duplicate_test/AMIT/DATA/'
*.log_file_name_convert='/ora_backup/TEST1/restore_test/AMIT/','/ora_backup/TEST/duplicate_test/AMIT/'
*.db_create_online_log_dest_1='/ora_backup/TEST/duplicate_test/AMIT/LOG/'
*.db_create_file_dest='/ora_backup/TEST/duplicate_test/AMIT/DATA/'
*.db_domain='mydb.domain'
*.db_name='AMIT'
*.db_recovery_file_dest='/ora_backup/TEST/duplicate_test/AMIT/FRA'
*.db_recovery_file_dest_size=65G
*.log_archive_dest_1='location=/ora_backup/TEST/duplicate_test/AMIT/FRA/'
*.diagnostic_dest='/ora_backup/TEST/duplicate_test/AMIT/diag'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1061607680
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
Above parameters in Green has to be modified according to the auxiliary server.
5. Start the auxiliay Instance in nomount mode :-
We can create this replica using Backups of production database as well as from Active production Database. RMAN Duplicate command gives us facility to create a replica of Production Database without backup.
We can do below mentioned things using RMAN Duplicate command :-
1. Duplicate a Production database on same host with different directory structure.
2. Duplicate a Production database on another host with same directory structure.
3. Duplicate a Production database on another host with different directory structure.
Duplicate of production database can be doe using below mention methods :-
1. Backup Based Duplication
2. Active Database Duplication
In this article I will show you how to do Duplicate using Active Database duplication.
PFB steps to Duplicate a Production database on another host with different directory structure using Active database Duplication :-
1. Check that primary database is up and running in Archivelog mode :-
SQL> select name,open_mode,LOG_MODE from v$database;
NAME OPEN_MODE LOG_MODE
--------- -------------------- ------------
AMIT READ WRITE ARCHIVELOG
2. Add the tns details of target and auxiliary in both server(Target, Auxiliary)
AMIT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.20.12)(PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = amit.db.com)
)
)
AMIT_DUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.20.14)(PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = amit.db.com)
)
)
(SID_DESC =
(GLOBAL_DBNAME = amit.db.com)
(SID_NAME = TEST)
(ORACLE_HOME = /opt/oracle/product/database/11.2.0.4)
)
*.audit_file_dest='/ora_backup/TEST/duplicate_test/AMIT/adump'
*.audit_trail='DB'
*.compatible='11.2.0.4.0'
*.control_files='/ora_backup/TEST/duplicate_test/AMIT/control01.ctl','/ora_backup/TEST/duplicate_test/AMIT/control02.ctl'
*.db_block_size=16384
*.db_file_name_convert='/ora_backup/TEST1/restore_test/AMIT/DATA','/ora_backup/TEST/duplicate_test/AMIT/DATA/'
*.log_file_name_convert='/ora_backup/TEST1/restore_test/AMIT/','/ora_backup/TEST/duplicate_test/AMIT/'
*.db_create_online_log_dest_1='/ora_backup/TEST/duplicate_test/AMIT/LOG/'
*.db_create_file_dest='/ora_backup/TEST/duplicate_test/AMIT/DATA/'
*.db_domain='mydb.domain'
*.db_name='AMIT'
*.db_recovery_file_dest='/ora_backup/TEST/duplicate_test/AMIT/FRA'
*.db_recovery_file_dest_size=65G
*.log_archive_dest_1='location=/ora_backup/TEST/duplicate_test/AMIT/FRA/'
*.diagnostic_dest='/ora_backup/TEST/duplicate_test/AMIT/diag'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1061607680
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
Above parameters in Green has to be modified according to the auxiliary server.
5. Start the auxiliay Instance in nomount mode :-
==>sqlplus
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 2 01:14:47 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup force nomount pfile='/ora_backup/TEST/duplicate_test/initAMIT.ora'
ORACLE instance started.
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size 633340896 bytes
Database Buffers 402653184 bytes
Redo Buffers 22331392 bytes
6. Create spfile from pfile and start it again using spfile :-
SQL> create spfile from pfile='/ora_backup/TEST/duplicate_test/initAMIT.ora';
File created.
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size 633340896 bytes
Database Buffers 402653184 bytes
Redo Buffers 22331392 bytes
7. Check the below parameters in auxiliary instance :-
SQL> show parameter control_files
SQL> show parameter db_file_name_convert
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string /ora_backup/TEST1/restore_test/AMIT/DATA, /ora_backup/TEST/duplicate_test/AMIT/DATA/
SQL> show parameter log_file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert string /ora_backup/TEST1/restore_test/AMIT/, /ora_backup/TEST/duplicate_test/AMIT/
We have to set above parameter when we do a duplicate database on another host with different file structure.
8. Start the RMAN duplicate command. If you are using a SPFILE for auxiliary instance then copy the SPFILE at the default location ($ORACLE_HOME/dbs) as while doing a duplicate RMAN will shut down the Auxiliary instance and start it again using SPFILE.
If you want to use a pfile then mention Pfile parameter in Duplicate command(optional) :-
RMAN > ; duplicate database to AMIT
from active database
pfile=/ora_backup/TEST/duplicate_test/initAMIT.ora;
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Dec 2 01:45:01 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: AMIT (DBID=2971225332)
RMAN> duplicate database to AMIT
Starting Duplicate Db at 2014-12-02 01:45:55
contents of Memory Script:
sql statement: alter system set db_name = ''AMIT'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''AMIT'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Starting backup at 2014-12-02 01:53:16
Starting restore at 2014-12-02 01:53:35
channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
database mounted
contents of 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
executing command: SET NEWNAME
Starting backup at 2014-12-02 01:54:41
sql statement: alter system archive log current
contents of Memory Script:
Starting backup at 2014-12-02 02:07:52
cataloged archived log
datafile 1 switched to datafile copy
contents of Memory Script:
executing command: SET until clause
Starting recover at 2014-12-02 02:08:49
starting media recovery
archived log for thread 1 with sequence 5 is already on disk as file /ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
contents of Memory Script:
sql statement: alter system set db_name = ''AMIT'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
sql statement: ALTER DATABASE ADD LOGFILE
INSTANCE 'i2'
contents of Memory Script:
executing command: SET NEWNAME
renamed tempfile 1 to /ora_backup/TEST/duplicate_test/AMIT/DATA//AMIT/datafile/o1_mf_temp_b446vnwf_.tmp in control file
cataloged datafile copy
datafile 2 switched to datafile copy
contents of Memory Script:
database opened
Database Duplicated using Active Database duplication on another host with different file structure .
If we have to duplicate database on same host then we have to follow the same above process. One thing we have to keep in mind while duplicating on same host , DB name of Auxiliary instance has to be different from target.
PFB link to Duplicate database with same file structure on another host.
PFB click below to Duplicate Database using Backup Based Duplication.
I hope this article helped you.
Regards,
Amit Rath
SQL> create spfile from pfile='/ora_backup/TEST/duplicate_test/initAMIT.ora';
File created.
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size 633340896 bytes
Database Buffers 402653184 bytes
Redo Buffers 22331392 bytes
7. Check the below parameters in auxiliary instance :-
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /ora_backup/TEST/duplicate_test/AMIT/control01.ctl, /ora_ba
ckup/TEST/duplicate_test/AMIT/control02.ctl
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string /ora_backup/TEST1/restore_test/AMIT/DATA, /ora_backup/TEST/duplicate_test/AMIT/DATA/
SQL> show parameter log_file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert string /ora_backup/TEST1/restore_test/AMIT/, /ora_backup/TEST/duplicate_test/AMIT/
We have to set above parameter when we do a duplicate database on another host with different file structure.
8. Start the RMAN duplicate command. If you are using a SPFILE for auxiliary instance then copy the SPFILE at the default location ($ORACLE_HOME/dbs) as while doing a duplicate RMAN will shut down the Auxiliary instance and start it again using SPFILE.
If you want to use a pfile then mention Pfile parameter in Duplicate command(optional) :-
RMAN > ; duplicate database to AMIT
from active database
pfile=/ora_backup/TEST/duplicate_test/initAMIT.ora;
==>rman target sys/Passw0rd@AMIT auxiliary
sys/Passw0rd@AMIT_DUP
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Dec 2 01:45:01 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: AMIT (DBID=2971225332)
connected to auxiliary database: AMIT (not mounted)
RMAN> duplicate database to AMIT
from active database;2>
Starting Duplicate Db at 2014-12-02 01:45:55
using target database control file instead of recovery
catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=145 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=151 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=157 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=163 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name
=
''AMIT'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set
db_unique_name =
''AMIT'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary
format '/ora_backup/TEST/duplicate_test/AMIT/control01.ctl';
restore clone controlfile to
'/ora_backup/TEST/duplicate_test/AMIT/control02.ctl' from
'/ora_backup/TEST/duplicate_test/AMIT/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''AMIT'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''AMIT'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size
633340896 bytes
Database Buffers
402653184 bytes
Redo Buffers
22331392 bytes
Starting backup at 2014-12-02 01:53:16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=199 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=217 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=223 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=229 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file
name=/opt/oracle/product/database/11.2.0.4/dbs/snapcf_AMIT.f
tag=TAG20141202T015327 RECID=22 STAMP=865216412
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:07
Finished backup at 2014-12-02 01:53:35
Starting restore at 2014-12-02 01:53:35
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=139 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=151 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=157 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=163 device type=DISK
channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_3: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_4: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 2014-12-02 01:53:54
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//system01.dbf";
set newname for datafile 2 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//sysaux01.dbf";
set newname for datafile 3 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//undotbs1.dbf";
set newname for datafile 4 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//undotbs2.dbf";
set newname for datafile 5 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//users_1.dbf";
set newname for datafile 6 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//ts_aud01.dbf";
set newname for datafile 7 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_data01.dbf";
set newname for datafile 8 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_idx01.dbf";
set newname for datafile 9 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_arch01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//system01.dbf"
datafile
2 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//sysaux01.dbf"
datafile
3 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//undotbs1.dbf"
datafile
4 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//undotbs2.dbf"
datafile
5 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//users_1.dbf"
datafile
6 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//ts_aud01.dbf"
datafile
7 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_data01.dbf"
datafile
8 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_idx01.dbf"
datafile
9 auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/DATA//DATA_arch01.dbf"
;
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
executing command: SET NEWNAME
Starting backup at 2014-12-02 01:54:41
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006
name=/ora_backup/TEST1/restore_test/AMIT/DATA/ts_aud01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00007 name=/ora_backup/TEST1/restore_test/AMIT/DATA/DATA_data01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00008
name=/ora_backup/TEST1/restore_test/AMIT/DATA/DATA_idx01.dbf
channel ORA_DISK_4: starting datafile copy
input datafile file number=00002
name=/ora_backup/TEST1/restore_test/AMIT/DATA/sysaux01.dbf
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/sysaux01.dbf
tag=TAG20141202T015442
channel ORA_DISK_4: datafile copy complete, elapsed time:
00:02:05
channel ORA_DISK_4: starting datafile copy
input datafile file number=00001
name=/ora_backup/TEST1/restore_test/AMIT/DATA/system01.dbf
output file name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_data01.dbf
tag=TAG20141202T015442
channel ORA_DISK_2: datafile copy complete, elapsed time:
00:02:38
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003
name=/ora_backup/TEST1/restore_test/AMIT/DATA/undotbs1.dbf
output file name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_idx01.dbf
tag=TAG20141202T015442
channel ORA_DISK_3: datafile copy complete, elapsed time:
00:02:37
channel ORA_DISK_3: starting datafile copy
input datafile file number=00004 name=/ora_backup/TEST1/restore_test/AMIT/DATA/undotbs2.dbf
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs2.dbf
tag=TAG20141202T015442
channel ORA_DISK_3: datafile copy complete, elapsed time:
00:00:45
channel ORA_DISK_3: starting datafile copy
input datafile file number=00005
name=/ora_backup/TEST1/restore_test/AMIT/DATA/users_1.dbf
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/users_1.dbf
tag=TAG20141202T015442
channel ORA_DISK_3: datafile copy complete, elapsed time:
00:00:15
channel ORA_DISK_3: starting datafile copy
input datafile file number=00009
name=/ora_backup/TEST1/restore_test/AMIT/DATA/DATA_arch01.dbf
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs1.dbf
tag=TAG20141202T015442
channel ORA_DISK_2: datafile copy complete, elapsed time:
00:01:07
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/system01.dbf
tag=TAG20141202T015442
channel ORA_DISK_4: datafile copy complete, elapsed time:
00:01:36
output file name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_arch01.dbf
tag=TAG20141202T015442
channel ORA_DISK_3: datafile copy complete, elapsed time:
00:00:07
output file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/ts_aud01.dbf
tag=TAG20141202T015442
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:07:33
Finished backup at 2014-12-02 02:02:19
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like
"/ora_backup/TEST1/restore_test/AMIT/FRA/1_5_864800713.dbf"
auxiliary format
"/ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf"
;
catalog clone archivelog
"/ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf";
switch clone datafile all;
}
executing Memory Script
Starting backup at 2014-12-02 02:07:52
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=5 RECID=17241
STAMP=865216960
output file
name=/ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed
time: 00:00:25
Finished backup at 2014-12-02 02:08:22
cataloged archived log
archived log file
name=/ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf RECID=17241
STAMP=865217303
datafile 1 switched to datafile copy
input datafile copy RECID=22 STAMP=865217305 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=23 STAMP=865217306 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=24 STAMP=865217308 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs1.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=25 STAMP=865217309 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs2.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=26 STAMP=865217310 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/users_1.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=27 STAMP=865217312 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/ts_aud01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=28 STAMP=865217313 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_data01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=29 STAMP=865217314 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_idx01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=30 STAMP=865217316 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_arch01.dbf
contents of Memory Script:
{
set until scn 4943275;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 2014-12-02 02:08:49
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
starting media recovery
archived log for thread 1 with sequence 5 is already on disk as file /ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf
archived log file
name=/ora_backup/TEST/duplicate_test/AMIT/FRA/1_5_864800713.dbf thread=1
sequence=5
media recovery complete, elapsed time: 00:00:11
Finished recover at 2014-12-02 02:10:32
Oracle instance started
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size
633340896 bytes
Database Buffers
402653184 bytes
Redo Buffers
22331392 bytes
contents of Memory Script:
{
sql clone "alter system set db_name
=
''AMIT'' comment=
''Reset to original value by RMAN''
scope=spfile";
sql clone "alter system reset
db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''AMIT'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1060585472 bytes
Fixed Size 2260000 bytes
Variable Size
633340896 bytes
Database Buffers
402653184 bytes
Redo Buffers
22331392 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE
"AMIT" RESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 4672
LOGFILE
GROUP 1 (
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_1.1335.859503481',
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_1.283.859503479' ) SIZE 256 M
REUSE,
GROUP 2 (
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_2.284.859503481', '/ora_backup/TEST/duplicate_test/AMIT/DATA/group_2.1429.859503481'
) SIZE 256 M REUSE,
GROUP 10 (
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_10.298.859929363',
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_10.1258.859929365' ) SIZE 256
M REUSE
DATAFILE
'/ora_backup/TEST/duplicate_test/AMIT/DATA/system01.dbf'
CHARACTER SET AL32UTF8
sql statement: ALTER DATABASE ADD LOGFILE
INSTANCE 'i2'
GROUP 3 (
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_3.291.859504009',
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_3.1303.859504009' ) SIZE 256 M
REUSE,
GROUP 4 (
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_4.292.859504011',
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_4.1246.859504011' ) SIZE 256 M
REUSE,
GROUP 20 ( '/ora_backup/TEST/duplicate_test/AMIT/DATA/group_20.858.859929393',
'/ora_backup/TEST/duplicate_test/AMIT/DATA/group_20.299.859929393' ) SIZE 256 M
REUSE
contents of Memory Script:
{
set newname for tempfile 1 to
"/ora_backup/TEST/duplicate_test/AMIT/DATA//AMIT/datafile/o1_mf_temp_b446vnwf_.tmp";
switch clone tempfile all;
catalog clone datafilecopy
"/ora_backup/TEST/duplicate_test/AMIT/DATA/sysaux01.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs1.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs2.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/users_1.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/ts_aud01.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_data01.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_idx01.dbf",
"/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_arch01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /ora_backup/TEST/duplicate_test/AMIT/DATA//AMIT/datafile/o1_mf_temp_b446vnwf_.tmp in control file
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/sysaux01.dbf RECID=1
STAMP=865217830
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs1.dbf RECID=2
STAMP=865217830
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs2.dbf RECID=3
STAMP=865217831
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/users_1.dbf RECID=4
STAMP=865217831
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/ts_aud01.dbf RECID=5
STAMP=865217832
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_data01.dbf RECID=6
STAMP=865217832
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_idx01.dbf RECID=7
STAMP=865217833
cataloged datafile copy
datafile copy file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_arch01.dbf RECID=8
STAMP=865217833
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=865217830 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=865217830 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs1.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=865217831 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/undotbs2.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=865217831 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/users_1.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=865217832 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/ts_aud01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=865217832 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_data01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=865217833 file
name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_idx01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=8 STAMP=865217833 file name=/ora_backup/TEST/duplicate_test/AMIT/DATA/DATA_arch01.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
Finished Duplicate Db at 2014-12-02 02:19:53
If we have to duplicate database on same host then we have to follow the same above process. One thing we have to keep in mind while duplicating on same host , DB name of Auxiliary instance has to be different from target.
PFB link to Duplicate database with same file structure on another host.
PFB click below to Duplicate Database using Backup Based Duplication.
I hope this article helped you.
Regards,
Amit Rath
No comments:
Post a Comment