Clonedb: The quick and easy cloning solution you never knew you had. Tim Hall Oracle ACE Director Oracle ACE of the Year 2006.

Slides:



Advertisements
Similar presentations
2 Copyright © 2005, Oracle. All rights reserved. Installing the Oracle Database Software.
Advertisements

INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
ITEC474 Control File Maintenance
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
1 Chapter 15 Duplicating Databases and Transporting Data.
1 Getting The Most Out of RMAN By: Charles Pfeiffer CIO, Remote Control DBA (888)
Backup The flip side of recovery. Types of Failures Transaction failure –Transaction must be aborted System failure –Hardware or software problem resulting.
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
Advanced Databases DBA: Backups 1. Advanced Databases Agenda Define backup Discuss Backup Terminology Explain various backup and restore options in Oracle.
Database Backup and Recovery
RMAN Restore and Recovery
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
4 Copyright © 2008, Oracle. All rights reserved. Configuring Backup Specifications.
Chapter 5 Configuring the RMAN Environment. Objectives Show command to see existing settings Configure command to change settings Backing up the controlfile.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
CHAPTER 17 Configuring RMAN. Introduction to RMAN RMAN was introduced in Oracle 8.0. RMAN is Oracle’s tool for backup and recovery. RMAN is much more.
The Oracle Recovery Manager (RMAN)
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
CHAPTER 18 RMAN Backups and Reporting. Introduction to RMAN Backups and Reporting The focus of this chapter is backups of: Datafiles Control files Archived.
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Oracle backup and recovery strategy
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
Oracle Database Administration
The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
PPOUG, 05-OCT-01 Agenda RMAN Architecture Why Use RMAN? Implementation Decisions RMAN Oracle9i New Features.
Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session.
5 Copyright © 2008, Oracle. All rights reserved. Using RMAN to Create Backups.
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.
15 Copyright © 2005, Oracle. All rights reserved. Performing Database Backups.
11g(R1/R2) Data guard Enhancements Suresh Gandhi
RMAN: Your New Best Friend for Backup and Recovery Ruth Gramolini ORACLE DBA Vermont Department of Taxes.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
Backup and Recovery Overview Supinfo Oracle Lab. 6.
16 Copyright © 2004, Oracle. All rights reserved. Undo Management.
10/23/2015ISYS366 - Installation1 ISYS366 Installation.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
Chapter 8Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 8 Complete Recovery with Recovery Manager.
15 Copyright © Oracle Corporation, All rights reserved. RMAN Incomplete Recovery.
Database Storage Structures
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives  Learn the steps for creating a database  Understand the prerequisites for creating.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
Oracle Applications 11i Concepts II Brian Hitchcock OCP 11i DBA -- OCP 10g DBA Sun Microsystems Brian Hitchcock.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
2 Copyright © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
3 Copyright © 2007, Oracle. All rights reserved. Using the RMAN Recovery Catalog.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
3 Copyright © 2006, Oracle. All rights reserved. Installation and Administration Basics.
Presented by: Stephen Rea, N2N Services, Inc. Tuesday, November 5, 8:30 a.m. Course ID #243 2-Minute Ultra-Small Instant Database Clones cohesion noun.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
Control File Information The database name The timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace.
Oracle 10g Administration Database Architecture, Creation and Interfaces Copyright ©2006, Custom Training Institute.
You Inherited a Database Now What?
The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)
Clonedb: The quick and easy cloning solution you never knew you had.
Duplicating a Database
You Inherited a Database Now What?
Performing Database Recovery
Presentation transcript:

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

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

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

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

How do we Clone Databases? There are already several methods for cloning databases including:There are already several methods for cloning databases including: –Manually copy files and recreate the database. –RMAN DUPLICATE - active database (11g). –RMAN DUPLICATE - backup. –3 rd Party solutions. All require copying or restoring files to new location requiring: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.Clonedb makes cloning quicker and saves space.

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

Copy-On-Write (COW) DatafileImageCopiesDatafileImageCopies CloneDatabaseCloneDatabase NFSC.O.W.FilesNFSC.O.W.Files CloneDatabaseCloneDatabase NFSC.O.W.FilesNFSC.O.W.Files Clones use read-only image copies of datafiles as source.Clones use read-only image copies of datafiles as source. Only modified blocks are written to NFS location.Only modified blocks are written to NFS location.

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

Demo (cleanup.sql)cleanup.sql

NFS Server Setup Create a directory to hold the copy-on-write files. # mkdir -p /u01/nfs-shareCreate 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)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 restartMake sure the NFS service is turned on. # chkconfig nfs on # service nfs restart

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)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) backup.sh

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;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;create_pfile.sh Edit the PFILE, changing all references to the original SID and database name.Edit the PFILE, changing all references to the original SID and database name.

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_onTurn 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 dnfs.sh Make the necessary directories for the NFS mount and to support the instance. (directories.sh)Make the necessary directories for the NFS mount and to support the instance. (directories.sh)directories.sh

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 0Add 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-writeMount the copy-on-write location. # mount /u01/copy-on-write

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

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;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)Make sure the TEMP tablespace has been handled properly. (manage_temp.sql)manage_temp.sql Check the database. (datafiles.sql)Check the database. (datafiles.sql)datafiles.sql

Considerations - Performance Copy-On-Write location is NFS. Is that an issue for you?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?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?Possible performance improvements on the horizon?

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

Considerations - Others Very little documentation.Very little documentation. Very new.Very new.

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

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

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

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