The Twelve Days of Christmas

On the Eleventh Day of 18c/19c, Viscosity Gave to Me...

Written by Viscosity North America | Dec 22, 2022 11:00:00 AM

Snapshot Carousel

The Snapshot Carousel, introduced in Oracle Database 18c, provides customers with a library of PDBs taken over a period of time. Customers now have access to point-in-time copies of PDBs, to use for hot cloning or restoring. Snapshot carousels are great because it does not rely on storage snapshot technologies.

 

Unfortunately, as of this article, snapshot carousels are only available on the Engineered Systems (Exadata and ODAs with ACFS) platforms, including Exadata Cloud services. For testing purposes, you can leverage the underscore "_exadata_feature_on" initialization parameter.

 

Snapshot Carousels provide point-in-time sparse or full copies of the entire pluggable database depending on the storage support for thin/sparse provisioning. You can configure snapshots to occur every day with the SNAPSHOT MODE EVERY 24 HOURS clause or any threshold in minutes or hours. This option can be specified during the CREATE PLUGGABLE DATABASE or ALTER PLUGGABLE DATABASE option. Acceptable thresholds for automatically creating snapshots are:

  • Every x hours -a snapshot is automatically created every "x" hours between 1 and 1999 hours.
  • Every x minutes -a snapshot is automatically created every "x" minutes between 1 and 2999 minutes.

Customers can provision clones from any given day from any of the eight copies maintained by Oracle. As of now, the maximum number of snapshots is governed by the MAX_PDB_SNAPSHOTS parameter, which has a default value of 8 copies. When the maximum copy is reached, Oracle will drop the oldest snapshot before it provisions the next snapshot of the PDB. This allows customers to go back in time, up to 8 days (or whatever the snapshot interval is defined to be), to provide the most current or prior snapshot images of the PDB. Some use cases for snapshot carousels are:

  • Take a snapshot prior to a data load and be able to go back prior to the load
  • Provision (Recover) from past snapshots
  • Hotfix testing on a snapshot
  • Provisioning lower environments by coupling snapshot carousels with refreshable pluggable database technology

To create a snapshot every day for the pluggable database, use the following syntax:

 

 

We can query the CDB_PDBS view to see the snapshot interval and snapshot mode columns for the pluggable database. Notice that the snapshot interval has a numeric value of 1440, which represents the number of minutes in a 24-hour period.

 

 

For our reporting purposes, we are going to initiate a snapshot to be provisioned every 15 minutes:

 

 

Since this technology leverages sparse cloning techniques, it essentially presents the complete image of the PDB that does not need to be materialized. We can query the CDB_PROPERTIES view to see the current setting for the MAX_PDB_SNAPSHOTS parameter.

 

 

Trying to set this value to a greater number than 8 will trigger the error below. Setting this value to zero will instantly remove all the snapshot PDBs.

 

 

We can query the DBA_PDB_SNAPSHOTS view to see the full path of our PDBs that were "snapshotted" based on our defined threshold:

 

 

Provisioning (Recovering) From PDB Snapshots

Let's create a couple of PDBs leveraging the snapshots that we created automatically. First, we will create a snapshot clone called pdb_dev01 from our SNAP_2655339241_1059638663 snapshot:

 

 

Next, let's create another snapshot clone called pdb_dev02 from our SNAP_2655339241_1059640463 snapshot. However, this time we will have it start maintaining snapshots carousels of its own as well, every day:

 

 

Manually Maintaining Snapshot PDBS

We can manually create and drop a snapshot PDB. When manually creating a snapshot PDB, the database can assign a system-generated name or assign the snapshot PDB name at the time of creation.

 

 

We can see from the output below that the two snapshots created.

 

 

If you are logged into a PDB, the DBA_PDB_SNAPSHOTS view only records values relative to its own snapshots. If you want to see all the snapshots, you can issue the same query from the root container to see the PDBs and all of the associated snapshots.

 

To drop a snapshot PDB, we issue to ALTER PLUGGABLE DATABASE command but with the DROP option:

 

 

As you can see, you must be logged into the PDB to be able to drop the snapshot associated with the PDB. Attempting to drop a snapshot PDB from the root container will produce the "snapshot not found" error.

 

Summary

A great start to understanding the snapshot carousel is to understand the flow. In the image below, you can visually see how the Snapshot Carousel works to create eight point-in-time clones on different days that can be used for other purposes.

 

 

If you go to Oracle's online documentation, you'll find it is available on Exadata & DBCS EE (Database Cloud Service Enterprise Edition). From the looks of it, Oracle is making PDB snapshot carousels available in Exadata, and Oracle Database Appliance (ODA)engineered systems, including Exadata Cloud:

 

https://docs.oracle.com/en/database/oracle/oracle-database/19/dblic/Licensing-Information.html#GUID-0F9EB85D-4610-4EDF-89C2-4916A0E7AC87

 

 

Getting more updated information, the following screenshot provides information to include support for Oracle Database Appliances too:

 

 

Oracle continues to innovate multi-tenant capabilities, specifically Pluggable Databases (PDBs), to rapidly provide data for consumption. PDBs can easily be cloned full/sparse, migrated to other container databases without any downtime, and even re-located to future versions of the database containers with minimal downtime. PDB adoption will be the norm, starting with Oracle Database 19c with all Oracle customers. Remember, starting in Oracle Database 21c; Oracle will only support containerized databases. When you look to understand or implement new features on Oracle, remember to give Viscosity a call to help.

 

One of the sayings we have at Viscosity is that our customers "have four aces in their pocket." Over the previous 10 days, the talented staff at Viscosity, along with our Oracle ACEs, have addressed more Oracle Database 18c and 19c new features. Continue to join us next year as we continue our Oracle Database 19c hands-on lab workshops.

 

Happy Holidays!

 

DOWNLOAD PDF