How PDB Recovery Isolation in 21c makes your Life easier

Introduction

We already talked about remote PDB cloning in Data Guard environments in previous blog posts. As the datafiles of the cloned PDB are not present on the standby database, there are several manual steps to be followed to create the PDB on the standby site in 19c:

Oracle Database version 21c introduces a new feature called PDB Recovery Isolation that entirely eliminates the manual effort of recovering the PDB on standby by automatically performing the following steps:

  1. Marking the PDB on standby as disabled and continues with CDB media recovery.
  2. Automatically recovering the PDB on standby in a separate background session (PDB Recovery Isolation).
  3. Enabling the PDB on standby and continue with Data Guard media recovery.

PDB Recovery Isolation makes remote PDB cloning in Data Guard environments as simple as running just one command. Let’s have a look.

The Environment

  • Source: Single Instance Multitenant database version 21.4. It contains a PDB named PDBREM that we will be cloning into a remote CDB.
  • Target: Single Instance Multitenant Database version 21.4 in Active Data Guard configuration. The remote clone operation will be executed on the primary database.

On the Source Database

Step 1: Prepare the C##SYSOPER user on the Source Database

Grant the C##SYSOPER user the required privileges to be used for the database link:

SQL> grant create session, sysoper to C##SYSOPER identified by WElcome123## container=all;
 
Grant succeeded.

On the Target Primary Database

Create a database link on the target primary database pointing to the source database:

SQL> create database link DBLINK_TO_REM connect to C##SYSOPER identified by WElcome123## using '<connection_string_to_source_database>';
 
Database link created.

As we are not using a database link with the same name as the database it connects to, we need to additionally set the global_names parameter to false:

SQL> alter system set global_names=false scope=both;
 
System altered.

Step 3: Create a Remote Hot Clone PDB from the Source Database

Use the database link from the previous step to create a hot clone from the source PDB.

SQL> create pluggable database REMCLONE from PDBREM@DBLINK_TO_REM keystore identified by "WElcome123##";

Pluggable database created.

SQL> alter pluggable database REMCLONE open;
 
Pluggable database altered.

That’s it! We didn’t need to provide any additional parameters in the CREATE PLUGGABLE DATABASE command nor worry about recovering the new PDB on the standby. Everything was done automatically in the background:

-- on primary
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB21                          READ WRITE NO
         4 REMCLONE                       READ WRITE NO

-- on standby
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB21                          MOUNTED
         4 REMCLONE                       MOUNTED

SQL> select name from v$datafile where con_id=4;
NAME
------------------------------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/CDB21_fra385/CDB21_FRA385/D6663CA8FB51D59DE0532C000A0AC2BC/datafile/o1_mf_system_jyzlxx5c_.dbf
/u02/app/oracle/oradata/CDB21_fra385/CDB21_FRA385/D6663CA8FB51D59DE0532C000A0AC2BC/datafile/o1_mf_sysaux_jyzlxqmh_.dbf
/u02/app/oracle/oradata/CDB21_fra385/CDB21_FRA385/D6663CA8FB51D59DE0532C000A0AC2BC/datafile/o1_mf_undotbs1_jyzlxom1_.dbf
/u02/app/oracle/oradata/CDB21_fra385/CDB21_FRA385/D6663CA8FB51D59DE0532C000A0AC2BC/datafile/o1_mf_users_jyzlxnh0_.dbf

As we see, the datafiles on the standby are already created.

Considerations

PDB Recovery Isolation is an Active Data Guard feature. Hence, it requires an Active Data Guard configuration and option license.

If your databases use TDE encryption, what they should do, and must do on Oracle Cloud, then you still need to create a new TDE Master Encryption Key for the cloned PDB and copy the TDE Wallet file to the standby host. Unless you are using Oracle Key Vault (OKV).

Conclusion

PDB Recovery Isolation in 21c takes Multitenant and Data Guard integration steps further. It recovers a PDB seamlessly on standby not only while hot cloning but also for point-in-time recovery and flashback database operations performed on a PDB.

Do you want to test this new cool feature just right now with minimal effort? Get your Oracle Cloud Free Tier account, create your VM DB Systems in minutes, and have fun!

Further Reading

Would you like to get notified when the next post is published?