Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clonedb: The quick and easy cloning solution you never knew you had.

Similar presentations


Presentation on theme: "Clonedb: The quick and easy cloning solution you never knew you had."— Presentation transcript:

1 Clonedb: The quick and easy cloning solution you never knew you had.
Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OakTable Network OCP DBA (7, 8, 8i, 9i, 10g, 11g) OCP Advanced PL/SQL Developer Oracle Database: SQL Certified Expert Books Oracle PL/SQL Tuning Oracle Job Scheduling

2 Clonedb: The quick and easy cloning solution you never knew you had.
What is a clone? Why clone databases? How do we clone databases? What is Clonedb? Demo of Clonedb Considerations

3 What is a Clone? An exact copy of the original.

4 Why Clone Databases? Set up new databases as copies of existing ones.
Data refresh for development and test environments from production. Test backup & recovery. Create standby databases. Recover lost data or objects (where flashback is not appropriate).

5 How do we Clone Databases?
There are already several methods for cloning databases including: Manually copy files and recreate the database. RMAN DUPLICATE - active database (11g). RMAN DUPLICATE - backup. 3rd Party solutions. All require copying or restoring files to new location requiring: Additional disk space. Time to perform the copy. Clonedb makes cloning quicker and saves space.

6 What is Clonedb? In 11.1 Oracle added the Direct NFS Client to the database. The patch set introduced Clonedb functionality, built on top of Direct NFS. Clonedb uses Copy-On-Write (COW) technology for clones.

7 Copy-On-Write (COW) NFS C.O.W. Files Clone Database Datafile Image Copies NFS C.O.W. Files Clone Database Clones use read-only image copies of datafiles as source. Only modified blocks are written to NFS location.

8 What is Clonedb? (continued)
Clonedb saves space when you have multiple clones as they can all reference the same source files. One-time server setup, then repeated cloning is super-quick. Only documented in My Oracle Support (MOS) Note

9 Demo (cleanup.sql)

10 NFS Server Setup Create a directory to hold the copy-on-write files. # mkdir -p /u01/nfs-share Append the share into the “/etc/exports” file. /u01/nfs-share *(rw,sync,no_wdelay,insecure, insecure_locks,no_root_squash) Make sure the NFS service is turned on. # chkconfig nfs on # service nfs restart

11 Production Backup Make an image copy backup of the database. The copy can be placed on a share (CIFS/NFS) or copied to the local file system of the server running the clone. configure controlfile autobackup off; sql 'alter database begin backup'; run { set nocfau; backup as copy database format ’/u01/backups/prod/%U’; } sql 'alter database end backup'; (backup.sh)

12 Copy Production PFILE Take a copy of the production PFILE by running the following command as the SYS user. (create_pfile.sh) CREATE PFILE='/u01/backups/prod/initTEST.ora' FROM SPFILE; Edit the PFILE, changing all references to the original SID and database name.

13 Clonedb Server Setup Turn on Direct NFS for the ORACLE_HOME on the clonedb server. (dnfs.sh) $ cd $ORACLE_HOME/rdbms/lib $ make -f ins_rdbms.mk dnfs_on Make the necessary directories for the NFS mount and to support the instance. (directories.sh)

14 NFS Mount Add the NFS mount to the “/etc/fstab” file, along with any other necessary shares. nas1:/u01/nfs-share /u01/copy-on-write nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600, rsize=32768,wsize=32768,actimeo=0 0 0 Mount the copy-on-write location. # mount /u01/copy-on-write

15 Clone the database Set the required environment variables and run the “clone.pl” script. (create_clone_script.sh) Review the contents of the generated files. Run the files to create the clone. (create_clone.sh)

16 Clone the database If you did hot backup you may need to recover database. SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL; SQL> ALTER DATABASE OPEN RESETLOGS; Make sure the TEMP tablespace has been handled properly. (manage_temp.sql) Check the database. (datafiles.sql)

17 Considerations - Performance
Copy-On-Write location is NFS. Is that an issue for you? If a cloned database is to be used for performance testing, do you really want a different storage technology in the mix? Possible performance improvements on the horizon?

18 Considerations - Space Savings
Over time more changed blocks will be written to NFS location, so space savings will reduce. Only works with image copies. If you don’t use image copy backups how much space are you really saving?

19 Considerations - Others
Very little documentation. Very new.

20 Where would I use it? For short-lived clones used for functional, not performance testing. To test backups. To recover lost objects.

21 Where would I NOT use it? Setting up long-term clones.
For clones used for performance testing. For setting up a standby database.

22 Summary Very quick cloning. Potential for big space savings.
Need to be on at least Need to use NFS for COW location.

23 The End… Download slides and example code at: Article:


Download ppt "Clonedb: The quick and easy cloning solution you never knew you had."

Similar presentations


Ads by Google