Database – How to clone an oracle instance

databasedatabase-administrationoracleoracle10g

How do you clone an oracle instance? Basically, I want to end up copying it from d:\oracle\oldname to d:\oracle\newname.

I'm working with Oracle 10.2.

Best Answer

Look into using the RMAN DUPLICATE command. I believe this was introduced in 9i, but is certainly available in 10g. It takes care of all of those steps that used to be necessary when cloning manually such as renaming datafiles, recreating control files, resetting database name, etc.

If you have a new directory structure for data and log files you can just permanently set the clone's startup parameters to convert these automatically to the new format/location by a string replacement specification. Cloning then becomes as simple as connecting to the target ("clone from"), aux ("clone to"), and RMAN catalog databases and issuing the RMAN command "DUPLICATE DATABASE to (myNewDBname)". You can also set the "until time" to bring the clone up to an earlier point in time.

Oracle 11g adds the ability to clone directly from a live database.

By the way, if you're not backing up with RMAN, then drop everything else and start doing this now!