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 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) (click on video below)
    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)
    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.


Clones, Clones and More Clones. Too Many Clones?

Lightning Fast Cloning


Session 3 -Too Many Clones




>> John:  To begin with then. Why do people clone databases? Why do people do it? We have some customers who have maybe made six, seven copies, about half a dozen copies of every production database. Why are there so many?


User [00:30 inaudible] testing systems. Of course, the assurance testing systems, development systems. One customer working with an independent development team is in each of perhaps four development teams insistent on having their own clone of the production database. Why? Because they incorporate together, but that was the case of half a dozen copies of every production database.


Then you get the reporting databases. These will be databases that perhaps over frozen point in time so you can run a whole series of reports over a couple of days as of the end of last week for instance. There are many sites who have multiple reporting databases as well. All of these are going to be based on clones made through one way or another.




Now how do you create these clones? One way, very nice way is to use Data Guard. Of course, if you have Enterprise Edition licenses particularly if you’ve licensed at Active Data Guard option then Data Guard is a very nice option for reporting databases and using snapshot standby. They can also be used for developing systems as well. But Data Guard we talked about elsewhere on other lecture program.


One technique I do want to mention with cloning, it is not as widely used. It should be perhaps. It’s the technique of editioning and versioning. This may – these facilities are not as widely used. They should be perhaps and they will often mean that you don’t need as many clones as you might think you would need. So I want to take a very quick look at least at versioning. I don’t think I have time to go into editioning. These are facilities that you need to know ¿ people need to know about that are not as widely used perhaps as they should be.


So as a very quick example, right now I’m logged on to the normal, the standard scott schema where I happen to be using a 12c database, but it doesn’t matter. The technique I’m going to demonstrate has been available for many, many years.


First off, to setup the versioning technique alternative to a clone, we choose the table that we want to enable version for. In this case, just emp and enable versioning. That’s going to create a bunch of objects. If you want to reverse engineer it you will see large numbers of triggers and views being created. Eventually, you’ll see them being created.


>> Dave:  Question in the queue John. What is dbms_wm?


>> John:  This is Workspace Manager package. This enables the version incapability. I’m a bit concerned about the delay there, why that’s taking so long.




It’s a standard facility available in – well, there we go. That took a while. A standard facility available in any database. It sets up the versioning incapability which is often a sensible alternative to cloning. I’ve enabled it – enabled what we call versioning just for the emp table.


If you look at the objects that were created – select object name, object type from user object – we’ll see that what had actually happened is




I have an extra table created called emp_lt. Emp itself is now a view and then to make sure objects as well have been created. There’s lots going on in the background if I run that procedure call. As far as the end users are concerned, select start from emp, it’s just the emp table like any other, an absolute normal select query dml pl/sql will run against it.




But what we can now do is create a workspace. Next procedure call dbms Workspace Manager, create workspace, give it a name – arbitrary name myws my workspace. Still the end users don’t know how things happened. Absolutely normal queries against emp will run the application. A full PL/SQL application will run absolutely as normal at this point.


But what I can do is, as a particular user, I can move to the workspace. Having created that workspace myws, I can now move to it. I’m now in a logically self-contained separate database. For example, I can delete from emp, 14 rows deleted. I can commit.




Sounds pretty drastic but it isn’t drastic at all because any other user will still be seeing what we call the live data, sql + scott tiger and he says “select star from emp” and he sees everything there because he is not in the workspace where the changes were done.


If I want to go back to the live data I can move to what we call the live database. If I copy/paste correctly, there we go, I can move to live database and now indeed I will see the live data.


Second switch between workspaces, this can be totally ¿ I go to the next workspace, go to my workspace again and then no worries. A very nice facility.


I just wanted to mention this because it often means you don’t need as many clones as you might think you actually need. Editioning takes things a step further. Now the editioning capability as well as maintaining a virtual database, your own copies of the data where you can do what you like with for testing, developing, whatever, you can also maintain multiple copies of your software within one database.


So many people will be doing an awful lot of clones, perhaps more than they actually need.


Copyright 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!