How do you clone an oracle instance? Basically, I want to end up copying it from
I'm working with Oracle 10.2.
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!
I assume you want a different instance name on the clone ?,
In many ways the easiest way may well be to use RMAN or your backup and restore software to do the job for you.
I think it would be along the lines of:
This is pieced together from memory and having a quick google, its been about 2 years since I did any serious work with oracle so I would not expect the above to be correct but it may set you off in the right direction.
If you wanted the same instance on a different server I would recommend using NFS and a netapp and flexclones as they work wonderfully.
If you can get a cold or hot backup of your database:
and you'll probably want to do something like this as well:
ALTER TABLESPACE TEMP ADD TEMPFILE 'd:\oracle\newname\temp.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED;
That should get you close...