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.
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.
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:
Run the following commands:
conn / as sysdba
STARTUP NOMOUNT CREATE CONTROLFILE REUSE SET DATABASE "NEWNAME" RESETLOGS NOARCHIVELOG MAXLOGFILES xx MAXLOGMEMBERS xx MAXDATAFILES xxx MAXINSTANCES xx MAXLOGHISTORY xxxx LOGFILE GROUP 1 'd:\oracle\NEWNAME\REDO01.LOG' SIZE XXM, --pick your redo log size
GROUP 2 'd:\oracle\NEWNAME\REDO02.LOG' SIZE XXM,
GROUP 3 'd:\oracle\NEWNAME\REDO03.LOG' SIZE XXM DATAFILE
'd:\oracle\NEWNAME\SYSTEM.DBF',
'd:\oracle\NEWNAME\undotbs.DBF',
'd:\oracle\NEWNAME\USERS.DBF',
'd:\oracle\NEWNAME\sysaux.DBF',
'd:\oracle\NEWNAME\TOOLS.DBF' -- any other files in your database need to be renamed as well CHARACTER SET WE8ISO8859P1; -- adjust as necessary
ALTER DATABASE OPEN RESETLOGS;
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...