Oracle Recovery Manager (RMAN) provides a comprehensive foundation for efficiently backing up and recovering the Oracle databases, it provides a common interface, via command line and Enterprise Manager, for backup tasks across different host operating systems, automates administration of your backup strategies.
Here we have maintained same directory structure but different database name.
Environment Details
|
Database Name
|
prod
|
|
Hostname
|
Nsmsrc01
|
|
Ip Address
|
172.16.110.18
|
|
OS
|
Linux
|
|
Version
|
x86_64
|
|
Datafile Location
|
/data2/prod
|
|
Backup Location
|
/backup/rman_backup
|
|
Database Name
|
dup
|
|
Hostname
|
Nsmtrg
|
|
Ip Address
|
172.16.110.16
|
|
OS
|
Linux
|
|
Version
|
x86_64
|
|
Datafile Location
|
/data2/prod
|
|
Backup Location
|
/backup/rman_backup
|
Pre-requisites
Password file from target database.
Sqlnet.ora should have correct parameters.
Target database should be running through spfile.
Steps on target(source) server
1. Set Oracle sid
2. Connect to RMAN.
Thu Apr 9 10:47:41 2015
affiliates. All rights reserved.
3. Issue the following command to initiate backup. Before issue the backup command check the backup location is sat correctly.
db_unique_name PROD are:
TYPE DISK TO ‘/backup/rman_backup/controlfile_%F’;
TO BACKUPSET; # default
TO 1; # default
DISK TO 1; # default
‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
default
‘/data2/app/oracle/product/11.2.0/dbs/snapcf_prod.f’; # default
backup set
STAMP=875118622
STAMP=875138912
STAMP=875169392
STAMP=875202890
STAMP=875225400
STAMP=875253619
STAMP=875287426
STAMP=875311887
STAMP=875338210
STAMP=875371700
STAMP=875398375
STAMP=875422534
STAMP=875455916
STAMP=875489442
STAMP=875511892
STAMP=875532973
STAMP=875566589
STAMP=875598381
STAMP=875617253
STAMP=875650222
STAMP=875683804
STAMP=875692844
STAMP=875726521
STAMP=875759423
STAMP=875771364
STAMP=875804400
STAMP=875809288
STAMP=875842252
STAMP=875883160
STAMP=875939543
STAMP=875955632
STAMP=875960595
STAMP=876018651
STAMP=876036137
STAMP=876094207
STAMP=876117455
STAMP=876173429
STAMP=876203937
STAMP=876259857
STAMP=876288622
STAMP=876308432
STAMP=876364250
STAMP=876378605
STAMP=876398550
STAMP=876399532
STAMP=876419413
STAMP=876421079
STAMP=876461598
STAMP=876504610
STAMP=876548085
STAMP=876567056
STAMP=876567230
STAMP=876583581
STAMP=876583754
STAMP=876586722
handle=/backup/rman_backup/db_arch_2mq3v9n2_1_1.bkp tag=TAG20150409T161842
comment=NONE
time: 00:01:35
set
name=/data2/prod/system01.dbf
name=/data2/prod/sysaux01.dbf
name=/data2/prod/example01.dbf
name=/data2/prod/undotbs01.dbf
name=/data2/prod/data01.dbf
name=/data2/prod/users01.dbf
name=/data2/prod/test01.dbf
name=/data2/prod/tools01.dbf
handle=/backup/rman_backup/db_arch_2nq3v9q2_1_1.bkp tag=TAG20150409T162018
comment=NONE
time: 00:00:56
backup set
STAMP=876586874
handle=/backup/rman_backup/db_arch_2oq3v9rr_1_1.bkp tag=TAG20150409T162115
comment=NONE
time: 00:00:01
09-APR-15
handle=/backup/rman_backup/controlfile_c-284539893-20150409-02 comment=NONE
09-APR-15
4. Create pfile and copy to destination server.
pfile=’/backup/rman_backup/initprod.ora’ from spfile;
oracle@172.16.110.16:/data1/oracle11g/product/dbs/
100%
1169 1.1KB/s 00:00
Before start scp/ftp to destination server create directory structure to accommodate rman backup on destination server.
5. Copy rman backup from target to destination server.
oracle@172.16.110.16:/backup/rman_backup/
100% 1729MB 11.2MB/s 02:34
1133MB 11.2MB/s 01:41
100% 104KB 104.0KB/s 00:00
controlfile_c-284539893-20150409-02
oracle@172.16.110.16:/backup/rman_backup/
100% 9632KB 9.4MB/s 00:01
Steps on destination server
6. Create directory structure same as target(source) database.
7. Start the new instance in nomount
16:24:32 2015
Edition Release 11.2.0.1.0 – 64bit Production
Application Testing options
8. Connect to rman
sys/oracle
Thu Apr 9 16:27:47 2015
affiliates. All rights reserved.
9. Issue the following command to duplicate database with different name and same directory structure.
database to dup backup location ‘/backup/rman_backup’ nofilenamecheck;
“create spfile from memory”;
clone immediate;
clone nomount;
“alter system set db_name =
comment=
RMAN duplicate” scope=spfile”;
“alter system set db_unique_name =
comment=
RMAN duplicate” scope=spfile”;
clone immediate;
clone force nomount
clone primary controlfile from
‘/backup/rman_backup/controlfile_c-284539893-20150409-02’;
database mount;
”PROD” comment= ”Modified by RMAN duplicate” scope=spfile
duplicate” scope=spfile
time: 00:00:01
scn 4972796;
for datafile 1 to
for datafile 2 to
for datafile 3 to
for datafile 4 to
for datafile 5 to
for datafile 6 to
for datafile 7 to
for datafile 8 to
database
restore
restore from backup set
/data2/prod/system01.dbf
/data2/prod/sysaux01.dbf
/data2/prod/undotbs01.dbf
/data2/prod/users01.dbf
/data2/prod/example01.dbf
/data2/prod/data01.dbf
/data2/prod/test01.dbf
/data2/prod/tools01.dbf
/backup/rman_backup/db_arch_2nq3v9q2_1_1.bkp
tag=TAG20150409T162018
time: 00:00:35
datafile all;
name=/data2/prod/system01.dbf
name=/data2/prod/sysaux01.dbf
name=/data2/prod/undotbs01.dbf
name=/data2/prod/users01.dbf
name=/data2/prod/example01.dbf
name=/data2/prod/data01.dbf
name=/data2/prod/test01.dbf
name=/data2/prod/tools01.dbf
scn 4972796;
database
archivelog
to default destination
/backup/rman_backup/db_arch_2oq3v9rr_1_1.bkp
tag=TAG20150409T162115
time: 00:00:01
name=/backup/archive/1_143_872701561.dbf thread=1 sequence=143
name=/backup/archive/1_143_872701561.dbf RECID=1 STAMP=876589358
clone immediate;
clone nomount;
“alter system set db_name =
comment=
original value by RMAN” scope=spfile”;
“alter system reset db_unique_name
scope=spfile”;
clone immediate;
clone nomount;
”DUP” comment= ”Reset to original value by RMAN” scope=spfile
“DUP” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
‘/data2/prod/system01.dbf’
WE8MSWIN1252
for tempfile 1 to
tempfile all;
clone datafilecopy
“/data2/prod/sysaux01.dbf”,
datafile all;
control file
RECID=1 STAMP=876589383
RECID=2 STAMP=876589383
RECID=3 STAMP=876589383
RECID=4 STAMP=876589383
RECID=5 STAMP=876589384
RECID=6 STAMP=876589384
RECID=7 STAMP=876589385
name=/data2/prod/sysaux01.dbf
name=/data2/prod/undotbs01.dbf
name=/data2/prod/users01.dbf
name=/data2/prod/example01.dbf
name=/data2/prod/data01.dbf
name=/data2/prod/test01.dbf
name=/data2/prod/tools01.dbf
database open resetlogs;
Conclusion
In the preceding scenario based article, we have learned that backup based duplication using Rman utility with different database name and same directory structure.
BY
Name: Omer
Designation: Senior Database Engineer
Organization: Netsoftmate IT Solutions.
Email: info@netsoftmate.com


















