clone.pl - Thin provisioning of Oracle databases - part deux

My experiments with clone.pl are coming to an end.  I have 2-stage script written to almost completely automate the cloning process.

It's made up of 2 scripts.  Script 1:

  1. Does a log switch to ensure we're only needing to move data that actually changed during the image copy
  2. Takes a hot image backup of the database
  3. Does another log switch
  4. Works out which archivelogs are needed for recovery
  5. Creates an RMAN script to actually perform the recovery
Script 2, which does the creation of the clone, has a few prerequisites:
  1. Oracle binaries installed (one-time)
  2. Oracle binaries configured for dNFS (one-time)
  3. The required NFS mount point set up (separate mount for each clone?  Or could we use a shared mount point? e.g. /databases is an NFS mount, /databases/DB1 /databases/DB2 and so on)
  4. Access to the image copy taken by script 1
  5. Access to the RMAN script created by script 1
  6. Environment variables: $SOURCE_SID, $ORACLE_BASE, $NEW_SID
  7. Access to pfile named initSOURCE_SID.ora - taken from the source database
    1. (This really should be included in script 1)
When all this is true, the script will:
  1. Modify the init.ora 
    1. Add clonedb=true
    2. Remove lines incompatible with the clone (e.g. log_archive_dest. memory_target)
  2. Run clone.pl to create the controlfile and renaming scripts (and adds "QUIT" to the end of both)
  3. Run both scripts, checking for ORA-01152 ("Recovery required") errors
    1. If required, run the recovery script created by script 1
And that's it.  Simple, eh?  It's all very specific to my test environment at the moment, and needs some work if I want to generalise it.  But as a demo for the boss, I can see this having potential.

The hardest bit is the inital setup of the clone server.  In a small company or test environment you may be able to do all this yourself and it won't take long.  In a large siloed corporation, you'll probably have 3 different teams involved.

Comments

Popular posts from this blog

Data Guard with Transparent Application Failover (TAF)

RMAN-05531 During RMAN Duplicate from Active Data Guard Standby

Data pump - "ORA-39786: Number of columns does not match between export and import databases"