Leveraging Exascale Snapshots and Clones with Oracle Database #JoelKallmanDay
Arsalan Dehghanisariyarghan
Oracle Principal Consultant | Certified Management Consultant | Software Eng. | Oracle ACE Pro.
Exascale brings cutting-edge, space-efficient snapshot and cloning functionalities that seamlessly integrate with Oracle Database. This integration removes the need for a test master database when creating snapshots and clones on Exadata. The following sections explore common use cases for utilizing Oracle Database alongside Exascale's snapshot and cloning capabilities.
1. Thin Cloning a Pluggable Database with Exascale Storage
This section explores an efficient method of creating thin clones of Oracle Pluggable Databases (PDBs) that leverage the power of Exascale storage.
1. Creating a Thin Clone
The CREATE PLUGGABLE DATABASE command with the SNAPSHOT COPY option allows you to create a writable clone of an existing PDB. For example, to clone a PDB named pdb1 into a new PDB named pdb2c:
SQL> CREATE PLUGGABLE DATABASE pdb2c FROM pdb1 SNAPSHOT COPY;
When Oracle Database utilizes Exascale storage, this command leverages Exascale's native cloning capabilities for thin provisioning. The cloned PDB data files are stored within the same Exascale vault as the source PDB. Exascale's redirect-on-write mechanism ensures:
2. Viewing Cloned Files
The cloned data files are treated as regular files within the Oracle Database and appear in views like 'DBA_DATA_FILES'. For Exascale-specific details, consult the 'V$EXA_FILE' view.
The ESCLI command 'lssnapshots' provides a detailed view of the association between cloned data files and their source files within Exascale storage.
Preventing Standby Replication
Suppose a thin clone is created on an Oracle Data Guard primary database. In that case, the corresponding standby PDB data files will contain a complete (non-thinly provisioned) copy of the data, even with Exascale storage. To prevent this, include STANDBYS=NONE within the CREATE PLUGGABLE DATABASE command:
SQL> CREATE PLUGGABLE DATABASE pdb2c FROM pdb1 SNAPSHOT COPY STANDBYS=NONE;
2. Thin Cloning of a Pluggable Database in a Different Container Database
This section explores the technique of creating a writable snapshot copy (clone) of a Pluggable Database (PDB) located in a different Container Database (CDB). The process involves the CREATE PLUGGABLE DATABASE command in conjunction with a database link.
1. Creating a Thin Clone:
To create a clone of a PDB named sample_pdb residing in a CDB called remote_cdb, you can use the following command:
SQL> CREATE PLUGGABLE DATABASE cloned_pdb FROM sample_pdb@remote_cdb_link SNAPSHOT COPY;
Here, cloned_pdb is the name of the cloned PDB, and remote_cdb_link is the database link referencing the source PDB's CDB.
2. Thin Cloning with Exascale:
When both CDBs leverage the same Exascale vault, the cloning process takes advantage of Exascale's native functionality to create a thinly provisioned clone. This means the cloned PDB data files reside in the same Exascale vault as the source data files, employing redirect-on-write techniques for space efficiency.
3. Advantages of Thin Cloning:
4. Cloning from a Standby Database:
You can clone a PDB on an Oracle Data Guard standby database, creating efficient test and development environments separate from the primary. This requires temporarily stopping the redo apply on the standby database during the cloning operation.
Steps:
DGMGRL> edit database STANDBY set state='apply-off';
SQL> CREATE PLUGGABLE DATABASE cloned_pdb FROM sample_pdb@standby_link SNAPSHOT COPY;
DGMGRL> edit database STANDBY set state='apply-on';
Note: If a thin clone is created on a primary database, the corresponding standby PDB data files contain a complete (not thinly provisioned) copy of the data. To prevent this, use the STANDBYS=NONE option within the CREATE PLUGGABLE DATABASE command.
This method offers a streamlined approach to creating efficient and space-saving copies of PDBs, enabling flexible development, testing, and data management scenarios.
领英推荐
3. Using a Carousel of Thinly Provisioned Pluggable Database Snapshots
Within Oracle Database, you can create a library of pluggable database (PDB) snapshots, known as a PDB snapshot carousel. A PDB snapshot is a point-in-time copy of a PDB. The source PDB can be open read-only or read/write while the snapshot is created. A PDB snapshot carousel is useful for maintaining a library of recent PDB copies for point-in-time recovery and cloning.
For example, the following command creates a snapshot carousel based on my_pdb where a new snapshot is taken every 2 hours:
SQL> ALTER PLUGGABLE DATABASE my_pdb SNAPSHOT MODE EVERY 2 hours;
When Oracle Database uses Exascale storage, the PDB snapshot operation automatically uses native Exascale functionality to snapshot the underlying Oracle Database files. A PDB snapshot carousel based on Exascale storage can contain up to 4096 PDB snapshots. Once the carousel reaches its limit, each new snapshot automatically replaces the oldest snapshot.
The snapshots reside in the same Exascale vault as the underlying source data files, and Exascale uses redirect-on-write techniques to create and maintain the thinly provisioned snapshot data files. As a result, the snapshot operation is instantaneous, regardless of the size of the underlying data files. Also, each snapshot consumes no additional space. Space is only consumed when new data is written to the source PDB or a writable clone based on a snapshot.
Within the Oracle Database, the snapshot data files appear in the standard Oracle Database dictionary views, such as 'DBA_PDB_SNAPSHOTFILE'.
Within Exascale, you can use the 'ESCLI lssnapshots' command to view the association between the snapshots and their underlying source files.
Note:
If you create a thinly provisioned PDB snapshot on an Oracle Data Guard primary database, the snapshot metadata propagates to the standby. However, the snapshot is not accessible at the standby site, even after an Oracle Data Guard role transition (switchover or failover).
To utilize a snapshot from the PDB snapshot carousel as a writable PDB, you must create a clone (snapshot copy) based on the snapshot. For example:
SQL> CREATE PLUGGABLE DATABASE my_pdb_clone FROM my_pdb USING SNAPSHOT my_pdb_snapshotN SNAPSHOT COPY;
In the example, if my_pdb_snapshotN identifies a thinly provisioned PDB snapshot on Exascale storage, the new PDB (my_pdb_clone) is also thinly provisioned.
Creating a clone (snapshot copy) based on the PDB snapshot requires access to archived redo log files from the snapshot's time to ensure consistency across the PDB data files.
4. Efficiently Cloning a Container Database with gDBClone and Exascale
Oracle Database provides a comprehensive approach to cloning both pluggable databases (PDBs) and container databases (CDBs), leveraging the capabilities of Exascale storage for enhanced efficiency. While PDB cloning can be achieved through SQL commands, CDB cloning requires a dedicated utility due to the complexity involved in replicating the entire database environment.
The gDBClone utility simplifies this process, offering a flexible and reliable solution for CDB cloning. It leverages Exascale snapshots and clones for space efficiency and speed, enabling you to create CDB copies quickly, regardless of their size.
Here's how you can use gDBClone to create a CDB clone within an Exascale environment:
1. Preparation:
2. Using the gDBClone Utility:
# /opt/gDBClone/gDBClone.bin { clone | snap } -sdbname source_db_name -tdbname target_db_name
[ -tdbhome target_db_home ]
[[[ -sga_max_size size_mb ] [ -sga_target size_mb ]] | -pfile file-name ]
[ -sdbport source_listener_port ]
[ -racmod { 0 | 1 | 2 }]
[ -syspwf sys_password_file ]
[ -walletpwf wallet_password_file ]
Key Options:
Example:
To create a thin clone named THIN from the SOURCE CDB (an Oracle RAC database) within the same Exascale vault:
# /opt/gDBClone/gDBClone.bin snap -sdbname SOURCE -tdbname THIN -racmod 2
Additional gDBClone Functions:
For a complete list of options and detailed documentation, please see the gDBClone reference at MOS Doc 2099214.1.
Benefits of using gDBClone and Exascale for CDB cloning:
By leveraging the capabilities of gDBClone and Exascale, you can streamline the creation of CDB clones, simplify database management, and enable efficient resource utilization.
Summary
Oracle Exadata Exascale is a game-changer in cloud data architecture, offering the power of Exadata with the flexibility of the cloud. Integrating Oracle Database with Exascale storage provides a powerful and efficient solution for managing and cloning databases. By leveraging Exascale's native snapshot and cloning capabilities, users can create thin clones of pluggable databases (PDBs) and container databases (CDBs) that are both space-efficient and instantaneous, regardless of the data size. Key benefits of this integration include:
Using a PDB snapshot carousel further enhances these capabilities by allowing for the maintenance of a library of recent PDB copies for point-in-time recovery and cloning. Additionally, the gDBClone utility simplifies the process of cloning CDBs, offering a flexible and reliable solution that leverages Exascale snapshots and clones for space efficiency and speed. The combination of Oracle Database and Exascale storage provides a comprehensive and efficient solution for database cloning and management, enabling organizations to optimize their database environments and improve resource utilization.
References: