Clone an Oracle Database using Cold Physical Backup
Database Name: troy
Source Database side: (Troy database)
Cold Backup Steps:
1. Get the file path information using below query
Select name from v$datafile;
select member from v$logfile;
select name from v$controlfile;
2. Parameter file backup
If troy database running on spfile
Create pfile=’/u01/backup/inittroy.ora’ from spfile;
If database running in pfile using os command to copy the pfile and placed in backup path.
3.Taken the control file backup
Alter database backup controlfile to trace as ‘/u01/backup/control01.ora’;
4.Shutdown immediate
5.Copy all the data files/log files using os command & placed in backup path.
6.Startup the database.
Clone Database side: (Clone database)
Database Name: Clone
Clone Database Steps:
1.Create the appropriate folder in corresponding path & placed the backup files in corresponding folder.(bdump,udump,create,pfile,cdump,oradata)
2.Change the init.ora parameter like control file path, dbname, instance name etc...
3.Create the password file using orapwd utility.
(Database in windows we need to create the service id using oradim utility)
4.Startup the Database in NOMOUNT stage.
5.Create the control file for cloning database.
Using backup controlfile trace to generate the create controlfile scripts.
Change the Database name & files path, also change 'REUSE' needs to be changed to 'SET'.
CREATE CONTROLFILE SET DATABASE "clone" RESETLOGS FORCE LOGGING NOARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 453
LOGFILE
GROUP 1 '/U01/oradata/clone/redo01.log' SIZE 200M,
GROUP 2 '/U01/oradata/clone/redo02.log' SIZE 200M,
GROUP 3 '/U01/oradata/clone/redo03.log' SIZE 200M
DATAFILE
'/U01/oradata/clone/system01.dbf',
'/U01/oradata/clone/undotbs01.dbf',
'/U01/oradata/clone/users01.dbf',
CHARACTER SET WE8ISO8859P1;
Note: placed the script in sql prompt. Now controlfile created.
6.Now open the database.
Alter database open resetlogs;
Note: Check the logfile, datafiles & instance status
**********************************************************************************
Clone an Oracle Database using Hot Physical Backup
Database Name: troy
Database must be in Archive log mode.
Source Database side: (Troy database)
Hot Backup Steps:
1.Get the file path information using below query.
Select tablespace_name, file_name from dba_data_files order by 1;
2. Parameter file backup
If troy database running on spfile
Create pfile=’/u01/backup/inittroy.ora’ from spfile;
If database running in pfile using os command to copy the pfile and placed in backup path.
3.Put the tablespace in begin backup mode Using os command to copy the datafiles belongs to begin backup mode tablespace & placed in backup path. (Refer below example)
4.Once copied the datafile, release the tablespace from begin backup mode to end backup
5.Repeat the steps 1-3 for all your tablespaces.
6.Taken the controlfile backup
Alter database backup controlfile to trace as ‘/u01/backup/control01.ora’;
7.Backup all your archive log files between the previous backup and the new backup as well.
Example:
steps:
2.Alter tablespace system begin backup;
To ensure the begin backup mode tablespace using below query
Select * from v$backup; (refer the Change#, Time column)
3. Host cp /u01/oracle/raja/system1.DBF /u01/backup/system01.dbf à using os command to copy the datafile.
4. Alter tablespace system end backup;
To ensure the begin backup mode tablespace using below query
Select * from v$backup;
Clone Database side: (Clone database)
Database Name: Clone
Clone Database Steps:
1.Create the appropriate folder in corresponding path & placed the backup files in corresponding folder.(bdump,udump,create,pfile,cdump,oradata)
2.Change the init.ora parameter like control file path, dbname, instance name etc...
3.Create the password file using orapwd utility.
(Database in windows we need to create the service id using oradim utility)
4.Startup the Database in NOMOUNT stage.
5.Create the control file for cloning database.
Using backup controlfile trace to generate the create controlfile scripts.
Change the Database name & files path, also change 'REUSE' needs to be changed to 'SET'.
CREATE CONTROLFILE SET DATABASE "clone" RESETLOGS FORCE LOGGING NOARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 453
LOGFILE
GROUP 1 '/U01/oradata/clone/redo01.log' SIZE 200M,
GROUP 2 '/U01/oradata/clone/redo02.log' SIZE 200M,
GROUP 3 '/U01/oradata/clone/redo03.log' SIZE 200M
DATAFILE
'/U01/oradata/clone/system01.dbf',
'/U01/oradata/clone/undotbs01.dbf',
'/U01/oradata/clone/users01.dbf',
CHARACTER SET WE8ISO8859P1;
Note: placed the script in sql prompt. Now controlfile created.
6.Recover the database using controlfile.
Recover database using backup controlfile until cancel;
7.Now open the database.
Alter database open resetlogs;
Note: Check the logfile, datafiles status.
I Hope this article helped you to understand the cloning oracle database.Suggestions are welcome.
Best Regards
RajaBaskar Thangaraj
hi ji..
ReplyDeleteam baburaj.. really am proud u basker u great..its very useful to also..my request is please attach ur blogs hw to apply critical and cpu patches and so on.. its my humble request..still more one should confuse about patches..
Hi Raja Baskar..So difficult.
ReplyDeleteWill address you as Raja,
your document is so simple to follow, but with neat steps. I have not tried yet.. but would like to try cloning, after reading ur document. Realy should appriciate your efforts, spending time for others.. Great..Pls keep posting such details and help beginners like me by sharing your knowledge.
Thanks
Amali
can u explain why u set reuse to set while controlfile creation
ReplyDeleteAny DOcument for RMAN Cloning Raj
ReplyDeletecan u explain why u set reuse to set while controlfile creation? Question from burle..
ReplyDeletecreate control file SET database
the DBID is alway the same as original source database.
HI,
ReplyDeleteCLone DB can't be taken into Archive log mode.
and if db is not in archive mode then how can we recover the db ??
--Shekhar
Hi
ReplyDeleteClone db cant be taken into archive mode.then
if archive mode is not enabled, How can we recover the db ?
Interesting..
--Shekhar :)
hi raj, while cloning database why we create new control file script? please clarify my doubt..
ReplyDeleteRegards
Elango
while cloning database why we create new control file script?
ReplyDeletewe need to change the clone database name,physical files structure while control file creation. while create the control file its update about clone database name in datafiles header
Hi Shekar,
ReplyDeleteClone db cant be taken into archive mode.then
if archive mode is not enabled, How can we recover the db ?
oops.. Syntax error.. i removed that noarchivelog..
Thanks Mr Rajabaskar Thangaraj,its very useful.
ReplyDeletekeep sending scnarious like this...
Could u please differentiate cold and hot clone
ReplyDeleteCould u please differentiate cold and hot clone ?
ReplyDeleteCold Cloning:
Database in archivelog mode/no archivelog mode, we can clone the database.
Using consistent backup, we create the new database. (only we create the controlfile & open the database)
Hot cloning:
Database must be in archivelog mode.
Using inconsistent backup, we create the new database.
we create the controlfile.
Recover the database using controlfile & apply the archive log file.
open the database.
Regards
Rajabaskar Thangaraj
Hi
ReplyDeleteI am rajesh pikku.if you have any issue pls send issue on my mail id--rajesh.pikku@rediffmail.com
Excellent raj.. but please attach the documents like how to apply the patches... for cpu patch and o patch...
ReplyDeleteIt will be more helpful to every one...
hai anna,
ReplyDeletethis docm is realy simple, i try this one and its working
thank u.
This is really a good document.
ReplyDeleteThanks.
Do we need to back up redo logs in case of hot backup ?
ReplyDeletehi raj,
ReplyDeleteif u have packages names for oracle 11g installation on redhat linux,please provide me, atleast site name where i can find.
What kind of errors can we get when we do the clonning (blunder errors..)Could you tel me plz....??
ReplyDeleteHi Srinivas,
ReplyDeleteThanks for writing in. I was done cloning 2 years back :-) I couldn't get chance again. I forgot the errors.. last year i done active database cloning (oracle 11g). That time i faced network configuration issue (listener issue ) only..
Best Regards
Rajabaskar Thangaraj
nice post
ReplyDeleteHi
ReplyDeleteThanks Raj, it is very nice and clearly explained.
ReplyDeleteWell done raja your blog is very useful and i did the same RMAN cloning on 11gr2
ReplyDeletehttp://www.chandu208.blogspot.com/2011/12/11g-rman-cloning-using-duplicate.html
Can you please publish an article on RMAN cloning / duplicate database on ASM..?
ReplyDeleteawaiting...
can you take cold backup of normal windows xp system plz explain them
ReplyDeleteD.Vijaya Bhaskar
Sure will do asap..
ReplyDeleteHi Vijaya Bhaskar,
ReplyDeleteThanks for writing in..You can follow the same steps.
Regards
Rajabaskar Thangaraj
wao man that's so good.you made it so simple with this document...........
ReplyDeletegreat rahabaskar its so good and simple. thanks a lot.
ReplyDeletegreat rahabaskar its so good and simple. thanks a lot.
ReplyDelete