9 Scenarios for Using DGMGRL with a DG PDB Configuration
Use these scenarios understand how to create, manage, and monitor an Oracle Data Guard broker configuration that provides data protection and disaster recovery for one ore more pluggable databases (PDBs).
Read the information about prerequisites for getting started using the Oracle Data Guard command-line interface (DGMGRL), so that you can prepare your instances. Then read the scenarios to understand how you can use DGMGRL to create, manage, and monitor a broker configuration.
- Scenario 1: Create the Source and Target Configuration
- Scenario 2: Establish a Connection Between the Configurations
- Scenario 3: Setting Up Data Guard for the Source PDB
- Scenario 4: Enable the DG PDB Configuration and Start Redo Transport
- Scenario 5: Switchover Source PDB to Target PDB
- Scenario 6: Failover to Target PDB
- Scenario 7: Monitoring a DG PDB Configuration
Prerequisites for Using DG PDB
Ensure that the prerequisites for using a DG PDB environment are met.
- The source database and target database must exist.
- You must use a server parameter file. If the source database or target database uses an initialization parameter files (PFILE), convert this file into a server parameter file (SPFILE)
- If an instance was not started with a server parameter file, then you must shut down the instance and restart it using the server parameter file.
- The
DG_BROKER_START
initialization parameter must be set toTRUE
for the source database and target database in the DG PDB configuration.
The following assumptions are made in the DG PDB scenarios:
- TCP/IP is used to connect to source database with the target database.
- The DG PDB configuration consists of the following:
- The name of the source configuration is
MyConfig1
. The database unique name (DB_UNIQUE_NAME
) of the source database isboston
. The source PDB is namedsales
. - The name of the target configuration is
MyConfig2
. The database unique name (DB_UNIQUE_NAME
) of the target database isnewyork
. The target PDB is nameddgpdb_sales
. - The protection mode is maximum performance.
- The transport mode is
ASYNC
mode.
- The name of the source configuration is
Scenario 1: Create the Source and Target Configuration
- Create the source configuration
MyConfig1
. It must contains the source databaseboston
and the PDBssales
,acct
, andfinance
. The source PDB that must be protected using a DG PDB configuration issales
. - Create the target configuration
MyConfig2
. It must contain the target databasenewyork
, which is used to provide data protection to the source PDBsales
inMyConfig1
. The source PDB is instantiated asdgpdb_sales
in target databasenewyork
.
Scenario 2: Establish a Connection Between the Configurations
Establish a connection between the source configuration and the target configuration.
Run the following command, when connected to the primary database
boston
in the configuration MyConfig1
, to
establish a connection with the configuration MyConfig2
.
ADD CONFIGURATION MyConfig2 CONNECT IDENTIFIER IS newyork_ci;
Scenario 3: Setting Up Data Guard for the Source PDB
Identify the source PDB to be protected at the target database.
-
Use the
ADD PLUGGABLE DATABASE
command to create a DGPDB for the source PDB in the target container database.DGMGRL> ADD PLUGGABLE DATABASE 'dgpdb_sales' AT 'newyork' SOURCE IS 'sales' AT 'boston' PDBFileNameConvert IS 'dbs/boston-sales, dbs/newyork-sales-dg';
A standby PDB for source PDB sales
is created as
dgpdb_sales
in the target database
newyork
.
See ADD PLUGGABLE DATABASE for information about prerequisites and usage information for the ADD
PLUGGABLE DATABASE
command.
Scenario 4: Enable the DG PDB Configuration and Start Redo Transport
Prerequisites
After you add the source PDB, and before you start recovery on the target PDB, ensure that the database files that correspond to the source PDB are copied to the target database. Use RMAN or operating system copy commands to instantiate source PDB files.
The data files that were copied can be from a point in time that is before, during, or after the creation of the target PDB provided they are from the same branch of redo that was active at the source CDB when the target PDB was created.
Note:
When copying the datafiles associated with the source PDB, the naming must follow what's specified in thePDBFileNameConvert
clause of the
ADD PLUGGABLE DATABASE
... command.
To enable a DG PDB configuration:
-
Use the
ALL
keyword with theENABLE CONFIGURATION
command.DGMGRL> ENABLE CONFIGURATION ALL; Enabled “MyConfig1” with primary database “boston”. Enabled “MyConfig2” with primary database “newyork”.
- If this is the first DGPDB being added, connect to the target database, set context to the DGPDB, and add the standby redo logs.
Scenario 5: Switchover Source PDB to Target PDB
Use the
SWITCHOVER TO
command switch the role of the surce database
and the target database in a DG PDB environment.
Prerequisites
- The state of the primary database is
TRANSPORT-ON
and that of the target PDB isAPPLY-ON
. - The source database and target database are in good health, without any errors or warnings.
- Standby redo log files are configured on the source database.
To perform a switchover for a source PDB:
Scenario 6: Failover to Target PDB
You invoke a failover operation in an emergency situation, typically when the source PDB is unavailable or inaccessible. It reverses the roles of the source PDB and its designated target PDB.
In DG PDB environments, if the source PDB is unavailable or inaccessible but the container database and other PDBs are okay, the failover operation is very similar to a switchover operation in the sense that the original source PDB within the container database is converted and marked as a physical standby, however, recovery will not be started.
To perform a failover:
Scenario 7: Monitoring a DG PDB Configuration
Use DGMGRL to monitor the status of the members in a DG PDB configuration.
Viewing Configuration Information Using DGMGRL
Use the SHOW CONFIGURATION
command to display the current status of
the DG PDB configuration. This command displays the configuration status and roles
played by the primary databases in both broker configurations.
DGMGRL> SHOW CONFIGURATION;
Configuration – MyConfig2
Protection Mode: MaxPerformance
Members:
newyork - Primary database
boston – Primary database at MyConfig1 configuration
Data Guard Pluggable Database: ENABLED (Target role)
Configuration Status:
ENABLED
Viewing Database and PDB Information Using DGMGRL
Use theSHOW PLUGGABLE
DATABASE
command to view the status and details of the source database or
target database in a DG PDB
configuration.DGMGRL> SHOW DATABASE boston;
Database - boston
Role: PRIMARY
Intended State: TRANSPORT-ON
DGPluggable State: SOURCE
Instance(s):
bos1
Data Guard Source PDB(s): 1
Database Status:
SUCCESS
Use the SHOW PLUGGABLE DATABASE
command to view the
status of a source PDB or target PDB. Other information includes the role played by
the PDB, state, transport lag, and apply
lag.
DGMGRL> SHOW PLUGGABLE DATABASE dgpdb_sales AT newyork;
Pluggable database - DGPDB_SALES at newyork
Data Guard Role: DataGuard Standby
Con_ID: 7
Source: con_id 6 at boston
Transport Lag: 0 seconds (computed 29 seconds ago)
Intended State: APPLY-ON
Apply State: Running
Apply Instance: ny1
Average Apply Rate: 23 KByte/s
Real Time Query: OFF
Pluggable Database Status:
SUCCESS