Dataguard for Single Pluggable database skipping the other PDBs

Setup and Backup script

When using Oracle multi-tenant architecture there can be situations where it is required to setup Dataguard only for single PDB, skipping the log replication of other PDBs. Below steps can be used to achieve the above configuration on Oracle 12C  setup. The steps mainly stays same to a normal dataguard setup but main difference comes during the recovery where it is required to skip the pdb which is not in the dataguard configuration.

Primeary Side PDB configuration is as below. Rman backup script is used to backup the CDB root, PDB$SEED and the PDB1.
 SQL> show pdbs;  
   CON_ID CON_NAME            OPEN MODE RESTRICTED  
 ---------- ------------------------------ ---------- ----------  
      2 PDB$SEED             READ ONLY  NO  
      3 PDB1                 READ WRITE NO  
      4 PDB2                 READ WRITE NO  
 SQL> 

RMAN backup script --> 
 run  
 {  
 ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT '/tmp_01/onlback/bk_mis_u%u_s%s_p%p_t%t';  
 ALLOCATE CHANNEL CH2 DEVICE TYPE DISK FORMAT '/tmp_01/onlback/bk_mis_u%u_s%s_p%p_t%t';  
 ALLOCATE CHANNEL CH3 DEVICE TYPE DISK FORMAT '/tmp_01/onlback/bk_mis_u%u_s%s_p%p_t%t';
 BACKUP DATABASE ROOT;
 BACKUP PLUGGABLE DATABASE "PDB$SEED" plus archivelog;  
 BACKUP PLUGGABLE DATABASE PDB1 plus archivelog;  
 }  

Standby side restore and configuration

Create the standby control file, set the parameter file as per the requirements of dataguard (LOG_ARCHIVE_CONFIG, FAL, DG_CONFIG etc..) and copy the required backup pieces to Standby. These steps are equal to normal dataguard configuration
 run  
 {  
 allocate channel c1 type disk;  
 backup current controlfile for standby;  
 }  
Mount the standby database with standby controlfile and restore the backups of root database, PDB$SEED and the PDB1 as below.
 run {  
 ALLOCATE CHANNEL c1 DEVICE TYPE DISK ;  
 ALLOCATE CHANNEL c2 DEVICE TYPE DISK ;  
 ALLOCATE CHANNEL c3 DEVICE TYPE DISK ;  
 restore database root;  
 restore database "PDB$SEED";  
 restore database PDB1;  
 }  

Recovery

Once the restore is done, main difference comes with the recovery. During the recovery we need to skip the PDB2 and all it is tablespaces similar to below example script. Other wise recover will fail with "RMAN-06067: RECOVER DATABASE required with a backup or created control file"
 run  
 {  
 recover database skip forever tablespace PDB2:SYSTEM,PDB2:USER,PDB2:SYSAUX,PDB2:USERS;  
 }  
Once the recovery is completed skipping the PDB2, data guard configuration and the recover can be enabled similar to normal data guard setup.
Related Articles --

Comments

Popular posts from this blog

ORA-16433: The database or pluggable database must be opened in read/write

Oracle Multitenant - Create new service for PDB using DBMS_SERVICE

Wait for unread message on broadcast channel - Blocking Sessions