Use RMAN duplicate command to clone (restore) Oracle database to another server
Steps to restore RMAN backup to different host, for example, RMAN backup from Production server to Test server.
Presumptions
- Production database: Server A.
- Standby and RMAN database: Server B.
- Test database: Server C
- tnsnames.ora
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.mycompany.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = test)
(SERVER = DEDICATED)
)
)
RMAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stb.mycompany.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = rman)
(SERVER = DEDICATED)
)
)
PRO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = prod.mycompany.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = prod)
(SERVER = DEDICATED)
)
)STB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stb.mycompany.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = stb)
(SERVER = DEDICATED)
)
)
- All servers have identifical directory structure.
1, Copy backup control file and init.ora file from Prod to Test.
2, Start Test server.
sqlplus /nolog
SQL>connect sys/change_on_install@test as sysdba
SQL> startup nomount PFILE='C:\Oracle\admin\pfile\init.ora';
ORACLE instance started.
Total System Global Area 1620126452 bytes
Fixed Size 457460 bytes
Variable Size 545259520 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
3. Copy RMAN backup files from Prod to Test, place them in the same directory as Prod.
4. Connect to RMAN
rman TARGET SYS/xxx@PROD CATALOG rman/rman@rman AUXILIARY SYS/change_on_install@test
5, Duplicate database
RUN
{
allocate auxiliary channel c1 DEVICE TYPE disk;
DUPLICATE TARGET DATABASE to test nofilenamecheck ;
}
6, Duplicate database before current time
Tags: Oracle DBA
RUN
{
allocate auxiliary channel c1 DEVICE TYPE disk;
DUPLICATE TARGET DATABASE to test nofilenamecheck UNTIL TIME "TO_DATE('03/25/2007','MM/DD/YYYY')";
}
Saquib said,
February 17, 2008 @ 3:38 pm
The steps you provided are ok, but it seems u didn’t mention about the directory change settings (before running duplicate command) which is usually done with parameter db_file_name_convert and log_file_name_convert in the initSID.ora file of the Test server and also renaming of db_name to test.
If u are telling the steps of cloning from prod to test using RMAN then the directory settings are usually required if the servers are different and have different directory structure or name.
Raju said,
April 1, 2008 @ 1:17 am
Hi,
I am using Oracle10gR2 on windows environment .
I need clone production database to development every night , please help me to build scripts , what are the steps.
Thank You
Question said,
October 25, 2008 @ 4:13 am
my prod server is running linux operating and i take the backup using rman command that system is window 2000 nt server in this windown nt server i am connecting usb driver of 500gb so iwant to take the backup of production by using rman command in windows system connected usb drive
how it is possible
plz send me full procedure by step by step
Thanks
Atif said,
April 20, 2009 @ 2:45 am
point no.3 was important for me..
3.Copy RMAN backup files from Prod to Test, place them in the same directory as Prod.
You kidding said,
June 5, 2009 @ 3:37 pm
Are you kidding me? Try and figure it out. How can you be a DBA if you don’t even try on your own first!
Give me the steps. Uh. No. Try it yourself. Learn something. If it doesn’t work then ask questions. Geeesh.
JUlius.sp said,
August 4, 2009 @ 11:35 am
Hi I am using Red hat 4 and Oracle 10g, I am facing problem while cloning a database in same server using RMAN, Below are the steps i performed…..
1. target database(Richard) is open 2. Catalog database(Kill) is open 3. Auxiliary database(dup) which is clonedb
I Created all the directories for clone same as Target database
II created pfile for clonedb
III traced controlfile for clone db.
IV export ORACLE_SID= richard
rman
rman> Connect target /
rman> backup database plus Archivelog
rman> exit
Then configured tnsnames.ora and listener.ora for clonedb “dup”
then i started the listener
lsnctrl> start
export oracle_sid=dup
sqlplus /nolog
sql> startup pfile= ‘/path’ nomount;
i just checked all the three database whether its working fine
tnsping richard 4 then tnsping kill 4 —— these two commands worked fine.
then i tried it for clonedb tnsping dup 4 —–it shows a error called cannot resolve name
then i started the RMAN
export ORACLE_SID=richard
rman
rman> connect target /
rman> connect catlog
rman> connect auxiliary sys/password@dup
i got a error here cannot resolve auxiliary name.
where did i made mistake.