Back

Oracle Clone Tutorial: How to Clone a Large Oracle Database, Really, Really Fast!

Oracle Clone Tutorial

Take the pain out of cloning! Take the time out of cloning!

Learn how to duplicate (copy) an Oracle database in minutes – no matter how large – with Oracle DNFS.

Do you need to provide read-write clone databases for testing or development? Do you need to do it fast, simply, and with minimal disc space? This free Oracle Database Clone Tutorial will show you how.

Cloning databases can be slow, painful, and requires lots of disc space. Not any more. We can use copy-on-write technology to create as many independent clones as you want, all based on one backup of the source database. Creating a clone takes minutes, no matter how big the database is. The space used by each clone is only the space needed to record changes made within the clone (so initially, zero.) As far as your users are concerned, each clone is an independent database. They will have no idea that they are all sharing a common source.

This facility (based on Oracle’s Direct NFS technology) was introduced in release 11.2.0.2 and formally documented in 12.1.x.

Presented by Oracle Certified Master John Watson, SkillBuilders’ Director of Oracle Database Services.

This free tutorial is segmented into several separate lessons:

  1. Introduction to John Watson, SkillBuilders Director of Oracle Database Services (1:32)
  2. Agenda (1:19)
  3. Clones, Clones and More Clones. Too Many Clones? (6:19)
    John explains the reasons for creating clones and demonstrates DBMS_WM, the Oracle supplied Workspace Manager package, in the hopes of demonstrating a technique for creating *less clones*.
  4. Cloning the Old Way (1:36)
    John explains the three traditional cloning techniques: manual scripting, Data Guard and RMAN.
  5. Cloning Issues and Sample Script (3:41) (click on video below)
    John demonstrates (examples) cloning via a script we wrote to clone databases daily.
  6. Introducing DNFS Copy on Update to Clone (8:16)
    John explains a new technique for cloning : using Direct Network File System (DNFS) Copy-on-Update
  7. DNFS Cloning Technique and Demonstration (19:06)
    John demonstrates (examples) the new technique for cloning : using Direct Network File System (DNFS) Copy-on-Update
  8. Demo Creating Additional Clones ( In 2 Minutes! ) (3:40)
    In 2 minutes and 11 seconds, John demonstrates creating an additional clone – of any size!
  9. Review Technique and Limitations (3:23)

Date: Aug 14, 2013


NOTE: Some corporate firewalls will not allow videos hosted by YouTube.

Transcript

Cloning Issues and Sample Script

Lightning Fast Cloning

 

Session 5 – Cloning Issues and Sample Script

 

[music]

 

>> John:  Cloning the old way. Do it with RMAN – probably the best technique. It can be scripted. And as an example of scripting it, let me pull up my shell script.

 

[pause]

 

This is an example of a script.

 

[pause]

 

Something of a work in progress that we wrote a while back. This was originally developed for a particular client who needed to clone databases every day. A whole set of databases were going to cloned every night for reporting purposes for the next day and all the clones are going to made I think every month. And as an addition to that, large numbers of ad hoc clones are done from time to time for building up the development systems.

 

[pause]

 

So the technique we would have to do in this script – this automates the whole process. Some of these are just fairly standard with the UNIX shell scripting that we’re going to email messages when things happen. This is all going to be showed through Chrome. We use a function here to work out the dates in this particular time. They’re setting the time of the clone to 8:00 in the evening because that was the time that the cloned database is meant to be to get consistency for reporting.

 

[pause]

 

Prompts for what the database should be. The source database name, the destination database name –

 

[pause]

 

numerous checks. Numerous checks have to go through. I’ll let you run the script for instance.

 

[pause]

 

And eventually, we get the guts of it which begins here. So we connect to the clone database, terminate the clone, drop the database. And this is where the bad news starts. Our down time begins here. The reporting system’s offline as of this point. Having dropped the source database what could we do next?

 

[pause]

 

Generate a parameter file for the new version of the clone because the spfile would’ve destroyed by the drop, create a parameter file for the clone, start off of the parameter file. Then finally connect to RMAN, set our until time and create the database. So we connect to the catalog, we connect to the target, we connect to the auxiliary, and at last we can run the duplicate target database command.

 

If this database is many hundreds of gigabytes – possibly terabytes big – that’s an awful lot of down time as we go through that duplicates. Afterwards, convert to archive log mode, a few checks, and finally after all that we can make the database available for users. Alter database open and users can now log on.

 

That’s an awful lot of down time as the entire database is first destroyed and then reproduced. In fact, if you look at the script yes, 344 lines the shell script to do that.

 

So we can do this. Now we can clone databases using scripts on the UNIX and we can also do it on the Windows, but it’s a lot of work. So what I want to move on now – well, it’s a lot of work, a lot of disk space, a lot of down time while the clone is in progress. So now we can move on to the new technique.

 

Copyright SkillBuilders.com 2017

×
Free Online Registration Required

The tutorial session you want to view requires your registering with us.

It’s fast and easy, and totally FREE.

And best of all, once you are registered, you’ll also have access to all the other 100’s of FREE Video Tutorials we offer!

 

×
Podcast
×