| Nethence – Next Door Labs – Laboratory – Webmail – Your IP – BBDock |
| Next Door Laboratories |
|
Oracle RMAN -- Clone a database
Duplicate from scratch in brief
- prepare the directories
- get and adapt the pfile
- switch redo logs and backup archivelogs
- share the backuppieces
- clone the database
- switch to spfile
- clean up
Duplicate update in brief
- shut down the database
- check spfile is there
- start nomount, create a pfile, shutdown the database
- add _convert statements to the pfile
- start nomount
- duplicate target
- switch to spfile
- eventually disable archivelogs
Prepare the directories
As root, eventually prepare /usr/local/oracle for redundant controlfile and redo logs,
As oracle, prepare the directories,
Get and adapt the pfile
On srv1, make a pfile,
and send it to srv2,
On srv2, rename the pfile accordingly,
edit the pfile,
then :
- remove the first lines
- :%s/dbname/dbname2/g
(-) :%s/\/pathonsrv1/\/pathonsrv2/g
- define the path conversions,
Generate the orapw file to authenticate as sys without even having any controlfile nor datafile,
note. entries means how many simultanate sys sessions are autorized.
fix perms,
Oratab, listener and tnsnames for both
Edit listener,
add into SID_LIST,
apply,
Edit tnsnames,
add,
Add dbname2 to the oratab,
Switch redo logs and backup archivelogs
On srv1, switch the redo logs,
and backup the archivelogs,
Share the backuppieces
Make sure the backup dir is also available on srv2, either by NFS, or just copy the backuppieces.
Clone the database
Start dbname2 nomount (with the _convert pfile),
Make sure you got access to those databases through TNS,
- dbname on srv1 through srv2 TNS
- dbname2 on srv2 itself
- rcat on srv2 itself
Duplicate,
note. disconnect from your previous sql prompt on ORCLDEV, otherwise the rman duplicate process will be waiting.
note. carefull here, startup/shutdown applies on the target, not the auxillary
note. eventually add this to the rman command to debug,
and watch what's going on in the dbname2 alert log,
Once finished, check everything is fine on dbname2,
also as user through TNS,
Switch to spfile
As sys, switch to spfile,
eventually remove the pfile,
and start the database with the spfile,
Now that the clone is built, we no longer need the file_name_convert settings,
and eventually disable archivelogs,
Finish up
Eventually remove the TNS entry for the target database (dbname),
References
Metalink 228257.1
http://www.shutdownabort.com/quickguides/clone_rman.php
http://repettas.wordpress.com/2008/10/24/duplicating-a-database-using-oracle-11g-rman/
http://www.dba-oracle.com/t_how_to_create_a_duplicate_database_oracle.htm