PDB replication in Dataguard Environment in Oracle

How to control the PDB replication in Dataguard Environment Oracle

Describes two methods for controlling the replication of PDBs in standby databases when using Data Guard.

Check the status of the pluggable databases in the primary and standby databases in recovery mode

-- Primary
COLUMN name FORMAT a30
SELECT name, open_mode, recovery_status FROM v$pdbs ORDER BY 1;
NAME OPEN_MODE RECOVERY
------------------------------ ---------- --------
PDB$SEED READ ONLY ENABLED
PDB1 READ WRITE ENABLED


-- Standby
COLUMN name FORMAT A30
SELECT name, open_mode, recovery_status FROM v$pdbs ORDER BY 1;
NAME OPEN_MODE RECOVERY
------------------------------ ---------- --------
PDB$SEED MOUNTED ENABLED
PDB1 MOUNTED ENABLED

In 12.1.0.2, we are enabled the recovery for new PDB when recovery

Note: If we use the following STANDBYS

CREATE PLUGGABLE DATABASE ... STANDBYS={('cdbname', 'cdbname', ...) | NONE | ALL [EXCEPT ('cdbname', 'cdbname', ...)]}

Note:
STANDBYS clause not used (Default): The pluggable database is configured with all the standby databases as per configuration
STANDBYS=NONE: The pluggable database is not configured with any of the standby
STANDBYS=ALL: The pluggable database is configured on all of the standby databases as default
STANDBYS=ALL EXCEPT ('cdbstby_1','cdbstby_2') : The pluggable database is configured by all standby databases, except those with a DB_UNIQUE_NAME of 'cdbstby_1' and 'cdbstby_2'
STANDBYS=('cdb1_stby_1'): The pluggable database is only configured with the standby database with a DB_UNIQUE_NAME of 'cdbstby_1'

Example for 12.1.0.2

-- Create a Pluggable database not configured pluggable with STANDBY database.
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdbadmin IDENTIFIED BY Password
STANDBYS=NONE;

--Configured PDB with all standby database.
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdbadmin IDENTIFIED BY Password
OR
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdbadmin IDENTIFIED BY Password
STANDBYS=ALL;

-- Configured PDB database with Standby Database cdbstby_1
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdbadmin IDENTIFIED BY Password
STANDBYS=('cdbstby_1');

Example 12.2 parameter ENABLED_PDBS_ON_STANDBY

Oracle introduced the parameter ENABLED_PDBS_ON_STANDBY initialization which control the pluggable databases are protected by a specific standby database

Note:

  • "*" : All PDBs are protected.
  • "PDB1", "PDB2" : Only pluggable databases called “PDB1” and “PDB2” are protected.
  • "PDB*" : Only pluggable databases with a name beginning with “PDB” are protected.
  • "*", "-PDB*" : All pluggable databases are protected except those with a name beginning with “PDB”.
  • "*", "-PDB1" : All pluggable databases are protected except if the name is “PDB1”.
-- Standby
ALTER SYSTEM SET enabled_pdbs_on_standby="*", "-PDB2";

Example:
-- Primary
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdbadmin IDENTIFIED BY Password;
ALTER PLUGGABLE DATABASE pdb2 OPEN;

CREATE PLUGGABLE DATABASE pdb3
ADMIN USER pdbadmin IDENTIFIED BY Password;
ALTER PLUGGABLE DATABASE pdb3 OPEN;

Check the status of PDB2 database is recovery enabled or not in Dataguard

Note: For verify you always need to check on Standby database because on primary it show enabled.

-- On Standby
COLUMN name FORMAT A30
SELECT name, open_mode, recovery_status FROM v$pdbs ORDER BY 1;
NAME OPEN_MODE RECOVERY
------------------------------ ---------- --------
PDB$SEED MOUNTED ENABLED
PDB1 MOUNTED ENABLED
PDB2 MOUNTED DISABLED

Leave a Reply