Cloning databases

Posted by

My friend Kyle wrote a blog piece a while back

http://www.kylehailey.com/what-delphix-does-in-1-minute-22-seconds/

Now, not to criticise Delphix (in fact,the opposite – its a very very cool product, and you should read some of Kyle’s great blog content on it), but if you have not got it, or can’t get it, then as long as you have some imagecopy backups, and a NFS server hanging around, you can get to the “next best thing” using Oracle’s Direct NFS feature.

So…how close can we get to 1 minute 22 seconds…Lets try on a laptop 🙂

18:24:31 SQL> set time on
18:24:31 SQL> STARTUP FORCE NOMOUNT PFILE=C:\oracle\11.2.0.3\database\initC112d.ora
ORACLE instance started.

Total System Global Area  626327552 bytes
Fixed Size                  2257792 bytes
Variable Size             184552576 bytes
Database Buffers          432013312 bytes
Redo Buffers                7503872 bytes

18:24:40 SQL> CREATE CONTROLFILE REUSE SET DATABASE C112d RESETLOGS
18:24:40   2      MAXDATAFILES 200
18:24:40   3      MAXLOGFILES 32
18:24:40   4      MAXLOGMEMBERS 2
18:24:40   5      MAXINSTANCES 1
18:24:40   6      MAXLOGHISTORY 908
18:24:40   7  LOGFILE
18:24:40   8    GROUP 1 'C:\oracle\clone_db\c112d\redo1.log' SIZE 10M BLOCKSIZE 512,
18:24:40   9    GROUP 2 'C:\oracle\clone_db\c112d\redo2.log' SIZE 10M BLOCKSIZE 512,
18:24:40  10    GROUP 3 'C:\oracle\clone_db\c112d\redo3.log' SIZE 10M BLOCKSIZE 512
18:24:40  11  DATAFILE
18:24:40  12   'c:\oracle\bkp\SYSTEM.bkp'
18:24:40  13  ,'c:\oracle\bkp\SYSAUX.bkp'
18:24:40  14  ,'c:\oracle\bkp\UNDOTBS1.bkp'
18:24:40  15  ,'c:\oracle\bkp\USERS.bkp'
18:24:40  16  ,'c:\oracle\bkp\DEMO.bkp'
18:24:40  17  CHARACTER SET WE8MSWIN1252;

Control file created.

18:24:40 SQL> begin
18:24:40   2    dbms_dnfs.clonedb_renamefile('c:\oracle\bkp\system.bkp' , 'y:\c112d\system.clone');
18:24:40   3    dbms_dnfs.clonedb_renamefile('c:\oracle\bkp\sysaux.bkp' , 'y:\c112d\sysaux.clone');
18:24:40   4    dbms_dnfs.clonedb_renamefile('c:\oracle\bkp\undotbs1.bkp' , 'y:\c112d\undotbs1.clone');
18:24:40   5    dbms_dnfs.clonedb_renamefile('c:\oracle\bkp\users.bkp' , 'y:\c112d\users.clone');
18:24:40   6    dbms_dnfs.clonedb_renamefile('c:\oracle\bkp\demo.bkp' , 'y:\c112d\demo.clone');
18:24:40   7  end;
18:24:40   8  /

PL/SQL procedure successfully completed.

18:24:42 SQL> alter database open resetlogs;

Database altered.

18:24:49 SQL>

There you go Kyle…18 seconds 🙂

Got some thoughts? Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.