One of the most game changing capabilities of Exascale are the new clone and snapshot features compared to previous options available with ASM / ACFS. And since the business requirements for clones or snapshots to be made available rapidly and conveniently are rising, Exascale comes in rescue for IT operations to quickly provide storage efficient copies of production databases, even the most big ones.
The business requirements to be able to get hands on clones of production databases are nowadays countless:
- developer agility (needing separate and isolated databases),
- production-like shared environment providing same model and code but with a smaller footprint,
- test databases for software update testing,
- data sharing,
- point-in-time reporting, what-if scenario modeling or data audit.
For environments with big databases (tens of terabytes and more), Exascale is very well suited to do the job, with the following main features and advantages:
- source database flexibility: you can now clone read-write and read-only 23/26ai databases, at the PDB and CDB level
- no upstream dependencies: unlike ASM, Exascale no longer requires a test-master read-only copy
- storage reclamation is automatically performed by Exascale for extents no longer referenced by a file
- redirect-on-write techniques enable quick clone creation and maintenance with unprecedented space efficiency
- and last but not least, clone/snapshot is independent of source, which can be dropped without impacting clone
Before going through the details on how to make clones and snapshots, let’s remind what clones and snapshots are.
Snapshot
A snapshot is a read-only point-in-time copy of a file. Possible sources for snapshot creation are regular files, clones or another snapshot.
Clone
A clone is a read-write point-in-time copy of a file, possibly created from a regular file, another clone or a snapshot.
There are actually two types of clones: thin (space efficient) or full (byte-for-byte copy of source).
Cloning implicitly creates snapshots.
How do we create clones or snapshots of PDBs ?
This is where database kernel and Exascale integration really shines: physical storage operations are encapsulated in single SQL commands, thus there is no need to learn new tricky commands and clauses to leverage Exascale cloning and snapshoting capabilities. You use SQL commands you are already familiar with:
CREATE|ALTER PLUGGABLE DATABASE
Creating PDB snapshots
To create a read-only point-in-time reference to a PDB, use:
ALTER PLUGGABLE DATABASE pdb_name SNAPSHOT pdb_snapshot_name;
Remember that snapshots are inconsistent by default (which precisely makes quick creation possible); so cloning a snapshot triggers recovery based on redo data before the new clone can be opened read-write. Thus, required redo data has to be retained or restored from backup.
The DBA_PDB_SNAPSHOTS dictionary view is available to display snapshots information.
Creating PDB thin clones
A PDB thin clone is a space-efficient clone of an existing PDB. You need to use the SNAPSHOT COPY clause like in the following syntax:
CREATE PLUGGABLE DATABASE pdb_name FROM source_pdb_name SNAPSHOT COPY;
Thin cloning a PDB
CREATE PLUGGABLE DATABASE thin_clone_pdb_name FROM source_pdb_name SNAPSHOT COPY;
ALTER PLUGGABLE DATABASE thin_clone_pdb_name OPEN INSTANCES=ALL;
Thin cloning a PDB snapshot
CREATE PLUGGABLE DATABASE thin_clone_pdb_name FROM source_pdb_name USING SNAPSHOT pdb_snapshot_name SNAPSHOT COPY;
ALTER PLUGGABLE DATABASE thin_clone_pdb_name OPEN INSTANCES=ALL;
Creating PDB full clones
As already mentioned, a full clone is a byte-for-byte copy of an existing PDB and therefore takes the same storage space than source PDB. The command to be used is a simple:
CREATE PLUGGABLE DATABASE … FROM …
The missing SNAPSHOT COPY clause directs the database to create a complete block-for-block copy of the PDB.
CREATE PLUGGABLE DATABASE full_clone_pdb_name FROM source_pdb_name;
ALTER PLUGGABLE DATABASE full_clone_pdb_name OPEN INSTANCES=ALL;
Existing snapshots or thin clones can also be referenced as a source in the preceding commands.
What about cloning an entire container database ?
Space-efficient clones of an entire container database are possible thanks to the powerful gDBClone utility written by Ruggero Citton, to whom we owe other great utilities ODABR (consistent and incremental backup and restore for Oracle Database Appliance nodes), KVMBR (backup and restore of KVM domains) or more recently DSCM & DSCMREST (deployment of Oracle database containers with efficient storage snapshots).
The gDBClone utility enables:
- End-to-end thin and full cloning of a CDB with all its PDB
- File clone operations
- RMAN calls to make cloned files consistent
- Instance related files (such as password, spfile or TDE wallet files) creation
- GI registration
Here are some simple examples to respectively thin clone and full clone an entire CDB:
gDBClone.bin snap –sdbname source_db_name –tdbname target_db_name
gDBClone.bin clone –sdbname source_db_name –tdbname target_db_name
More on this powerful tool in Exascale documentation and Oracle Support KB145187 article.
Performance
Thin cloning a 2.4 TB PDB takes less than 12 seconds while opening the new thin clone on a two instances cluster database takes another 11 seconds, for a total elapsed time of the entire operation under 30 seconds !!!
Additional details can be found in this Alex Blyth blog post.
Conclusion
By leveraging state-of-the-art redirect-on-write technologies, Exascale is a leap forward and game changing technology when it comes to clone and snapshot features and capabilities. It is CI/CD friendly and the ideal tool to address the business requirements for test and qualification environments by letting DBAs provide very quickly space efficient copies of production or standby databases or PDBs.
Give it a try to be definitely convinced.