When the DUPLICATE RMAN command was introduced back in 10g, one of the things that was freaking people out was that although you were able to make it from a backup, you had to have connection established to the main database (I won’t call it Primary so you don’t get confused with Data Guard concepts).
On Oracle 11g Release 1, the new feature went a step backwards in my opinion, launching a feature that would enable you to duplicate a runing database without the need of a backup. What was the matter with these people!? All we wanted was the exact opposite!!
So now in Oracle 11g Release 2 you can duplicate a database from a backup alone (without the need to connect to the source database), and even better: you can choose which backup you would want to duplicate from!
To explain you guys how this is done, I’ve decided to duplicate my RAC Database, from the most recent backupset, onto the same machine as a “Standalone” database. Pretty cool. I’ve managed to un-RAC it in minutes!
Take a look:
We are going to use Enterprise Manager, but this whole process can be done through RMAN and a coupple of other manual tweaks. You choose “CLONE DATABASE” from the “Data Movement” tab and the process starts.
This is awsome! You might want to duplicate or clone from the latest backup taken or from a point somewhere in the past through a time reference or a SCN (System Change Number) reference.
You can choose the name of your duplicated database, whether that would go to a FS or ASM, and what will be the degree of parallelism, that will mean in practical terms, that RMAN will allocate more channels for the operation. If your fetching the backup from tape, you might want to raise the level to a comfortable level between getting performancewise stuck and taking too long.
We had problems using AMM’s new 11g feature, and so we decided to stick with the ASMM way:
Attention! You have to choose a different TNS Listener port if you are going to duplicate in the same host, or into a different one that has already a TNS Listener defined. In other words, there can’t be no colisions in the TNS Port you choose, otherwise you will be flagged:
Now it’s always better than “Later”
A brief review of you are about to launch. In our case it’s a simple database clone in the same server. The proceding for a different would be the same, except that in the case of tape backup the destination host would have to see the tape robot or drives. In case of disk backup, the destination host would have to have the backup copied over there (don’t tie yourself up with Unix NFS or Windows Network Drives if you can avoid it).
Step 1 succeeded! Yes!! Let’s wait calmly because this is too much enthusiasm…
After 857 seconds the process ended just fine. Now let’s check out new database:
1) You have your “/etc/oratab” updated
2) You have the user HR unlocked and with the password HR, which was the change we’ve made on the source database so we could test it out here
Cloning and duplicating databases was never so easy.