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:
It's made up of 2 scripts. Script 1:
- Does a log switch to ensure we're only needing to move data that actually changed during the image copy
- Takes a hot image backup of the database
- Does another log switch
- Works out which archivelogs are needed for recovery
- Creates an RMAN script to actually perform the recovery
- Oracle binaries installed (one-time)
- Oracle binaries configured for dNFS (one-time)
- 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)
- Access to the image copy taken by script 1
- Access to the RMAN script created by script 1
- Environment variables: $SOURCE_SID, $ORACLE_BASE, $NEW_SID
- Access to pfile named initSOURCE_SID
.ora - taken from the source database - (This really should be included in script 1)
When all this is true, the script will:
- Modify the init
.ora - Add clonedb=true
- Remove lines incompatible with the clone (e.g. log_archive_dest. memory_target)
- Run clone.pl to create the controlfile and renaming scripts (and adds "QUIT" to the end of both)
- Run both scripts, checking for ORA-01152 ("Recovery required") errors
- 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
Post a Comment