Steps to configure Oracle Data Guard version 12.2 for a pluggable database

 This document describes the configuration of the Oracle Data Guard Version 12.2. We will configure a standby for a pluggable database.

My test environment consists of two Linux (OEL 7.3) servers: oradg1 and oradg2. I already created a pluggable database on the server oradg1. The database consists of the following components:

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> set lines 200
SQL> col name forma a20
SQL> select con_id, name,open_mode, restricted from v$pdbs;

CON_ID NAME         OPEN_MODE RES
---------- -------------------- ---------- ---
     2 PDB$SEED        READ ONLY NO
     3 ORCLPDB1        READ WRITE NO
     4 ORCLPDB2        READ WRITE NO

SQL> select PDB_ID,PDB_NAME,CON_ID,STATUS,LOGGING,FORCE_LOGGING from dba_pdbs;

PDB_ID PDB_NAME         CON_ID STATUS LOGGING    FOR
---------- -------------------- ---------- ---------- --------- ---
     2 PDB$SEED             2 NORMAL LOGGING    NO
     3 ORCLPDB1             3 NORMAL LOGGING    NO
     4 ORCLPDB2             4 NORMAL LOGGING    NO

Following tasks will be executed:

  • Configuration the standby database on the server oradg2.
  • Creation / drop a pdb on the primary database and verification what happens on the standby site.
  • Executing the swithover tests.

In my previously post Steps to configure Oracle Data Guard 12.2 for non-multitenant database I created the physical standby for a non-multitenant database using a database creation assistant – dbca (new 12.2 feature). Unfortunately this feature is not available for a pluggable database and we will create a physical standby via RMAN utility.

Since RDBMS version 12.2 we can specify a subset of pluggable databases for replication on a physical standby. The new database parameter ENABLED_PDBS_ON_STANDBY enables this feature. I will configure the standby configuration for replication of the whole container.

Environment overview:

  • Primary server name/os: oradg1/Oracle Linux Server 7.3 (64 bit)
  • Standby server name/os: oradg2/Oracle Linux Server 7.3 (64 bit)
  • RDBMS Version (primary and standby): 12.2.0.1.0
  • ORACLE_HOME (primary and standby): /u01/app/oracle/product/12.2.0/dbhome_1
  • Listener name/port (primary and standby): LISTENER/1521
  • Primary CDB ORACLE_SID/DB_UNIQUE_NAME: ORCL/ORCLPRM
  • Standby CDB ORACLE_SID/DB_UNIQUE_NAME: ORCL/ORCLSTB
  • Recovery area (primary and standby): /u01/app/oracle/fast_recovery_area/orcl
  • CDB Path to DB files (primary and standby): /u01/app/oracle/oradata/orcl
  • PDB SEED Name / Path to DB Files (primary and standby): PDB$SEED: /u01/app/oracle/oradata/orcl/pdbseed
  • PDB 2 Name / Path to DB Files (primary and standby): ORCLPDB1:/u01/app/oracle/oradata/orcl/orclpdb1
  • PDB 3 Name / Path to DB Files (primary and standby): ORCLPDB2:/u01/app/oracle/oradata/orcl/orclpdb2

 

Preparing the primary database

All steps will be executed on the server oradg1 as OS user oracle. Set the environment and start SQLPlus:

[oracle@oradg1 ~]$ . oraenv
ORACLE_SID = [orcl] ? orcl
[oracle@oradg1 ~]$ sqlplus / as sysdba

Enable the archivelog modus – in my configuration is already done:

SQL> archive log list

Database log mode     Archive Mode
Automatic archival     Enabled
Archive destination     USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 16
Next log sequence to archive 18
Current log sequence     18

Enable force logging and flashback on the primary:

SQL> alter database force logging;
SQL> alter database flashback on;

Create standby redologs:

SQL> select GROUP#,THREAD#,BYTES from v$log;

GROUP# THREAD# BYTES
---------- ---------- ----------
1 1 209715200
2 1 209715200
3 1 209715200

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo01.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo03.log

-Create:

SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb01.log' size 209715200;
SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb02.log' size 209715200;
SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb03.log' size 209715200;

Adjust some initialization parameters:

SQL> show parameter db_name

NAME                 TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_name              string     orcl

SQL> show parameter db_unique_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string orcl

SQL> alter system set db_unique_name=orclprm scope=spfile;

-- remote_login_password:
SQL> show parameter remote_login_password

NAME                 TYPE     VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile     string     EXCLUSIVE

-- LOG_ARCHIVE_CONFIG:
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(orclprm,orclstb)' scope = spfile;

-- LOG_ARHIVE_DEST_1:
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orclprm' scope = spfile;

-- Parameter for Swith- Failover -These parameters take effect when the primary database is transitioned to the standby role:
SQL> alter system set FAL_SERVER='orclstb' scope = spfile;
SQL> alter system set STANDBY_FILE_MANAGEMENT=AUTO scope = spfile;

Now we will restart the database und check parameters:

SQL> shutdown immediate
SQL> startup

SQL> set linesize 500 pages 100
SQL> col name for a30
SQL> col value forma a100
SQL>
select name, value
from v$parameter
where name in ('db_name','db_unique_name','log_archive_config',
'log_archive_dest_1','log_archive_dest_2',
'log_archive_dest_state_1','log_archive_dest_state_2',
'remote_login_passwordfile', 'log_archive_format', 'log_archive_max_processes',
'fal_server','db_file_name_convert', 'log_file_name_convert', 'standby_file_management');

NAME             VALUE
------------------------------ ----------------------------------------------------------------------------------------------------
log_archive_dest_1     LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orclprm
log_archive_dest_state_1 enable
log_archive_dest_state_2 enable
fal_server         orclstb
log_archive_config     DG_CONFIG=(orcl1prm,orcl1stb)
log_archive_format     %t_%s_%r.dbf
log_archive_max_processes 4
standby_file_management AUTO
remote_login_passwordfile EXCLUSIVE
db_name          orcl
db_unique_name         ORCLPRM

Network configuration

Now we will edit two configuration files: listener.ora and tnsnames.ora:

[oracle@oradg1 dbhome_1]$ cd $ORACLE_HOME/network/admin

Edit file listener.ora, add following lines:

SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = orclprm)
   (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
   (SID_NAME = orcl1)
 )
  (SID_DESC =
   (GLOBAL_DBNAME = orclprm_dgmgrl)
   (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
   (SID_NAME = orcl1)
  )
)

Add following lines to the file tnsnames.ora:

# Data Guard
ORCLPRM =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oradg1)(PORT = 1521))
  (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = orclprm)
   (UR=A)
  )
 )

ORCLSTB =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oradg2)(PORT = 1521))
  (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = orclstb)
   (UR=A)
  )
 )

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = oradg1)(PORT = 1521))

Restart the listener:

[oracle@oradg1 admin]$ lsnrctl stop
[oracle@oradg1 admin]$ lsnrctl start

Creating a physical standby database

Now we will create the physical standby database on the server oradg2. Unfortunately is the new feature „creation of a standby database via dbca“ unavailable for a multitenant database:

[oracle@oradg2 ~]$ dbca -silent -createDuplicateDB -gdbName orcl -primaryDBConnectionString oradg1:1521/orclprm -sid orcl -createAsStandby -dbUniqueName orclstb

Enter SYS user password:
[FATAL] [DBT-16057] Specified primary database is a container database (CDB).
CAUSE: Duplicate database operation is supported only for non container databases.

We will create a physical standby via RMAN.

Executing some steps on the server oradg1:

Make a copy of spfile:

[oracle@oradg1 admin]$ sqlplus / as sysdba
SQL> create pfile='/tmp/initorcl.ora' from spfile;

Copy files orapw file and initorcl.ora to server oradg2:

[oracle@oradg1]$ scp /tmp/initorcl.ora oradg2:/tmp
[oracle@oradg1]$ scp /u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapworcl oradg2:/u01/app/oracle/product/12.2.0/dbhome_1/dbs

Now we will prepare the standby database on the server oradg2:

Creating of necessary directories:

[oracle@oradg2]$ mkdir -p /u01/app/oracle/admin/orcl
[oracle@oradg2]$ mkdir -p /u01/app/oracle/admin/orcl/adump
[oracle@oradg2]$ mkdir -p /u01/app/oracle/fast_recovery_area
[oracle@oradg2]$ mkdir -p /u01/app/oracle/fast_recovery_area/orcl
[oracle@oradg2]$ mkdir -p /u01/app/oracle/oradata/orcl
[oracle@oradg2]$ mkdir -p /u01/app/oracle/oradata/orcl/pdbseed
[oracle@oradg2]$ mkdir -p /u01/app/oracle/oradata/orcl/orclpdb1
[oracle@oradg2]$ mkdir -p /u01/app/oracle/oradata/orcl/orclpdb2

 

Modify the parameter in the created /tmp/initorcl.ora file (modified lines in red):

*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/orcl'
*.db_recovery_file_dest_size=2g
*.db_unique_name='ORCLSTB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.enable_pluggable_database=true
*.fal_server='orclprm'
*.local_listener=''
*.log_archive_config='DG_CONFIG=(orclstb,orclprm)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orclstb'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=620m
*.processes=320
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1858m
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

Create an entry in the /etc/oratab:

orcl:/u01/app/oracle/product/12.2.0/dbhome_1:N

Network configuration

We will configure the network configuration for a data guard.

[oracle@oradg2]$ cd $ORACLE_HOME/network/admin

Edit file listener.ora, add following lines:

SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = orclstb)
   (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
   (SID_NAME = orcl)
  )
  (SID_DESC =
   (GLOBAL_DBNAME = orclstb_dgmgrl)
   (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
   (SID_NAME = orcl)
  )
)

Add following lines to the file tnsnames.ora:

# Data Guard
ORCLPRM =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oradg1)(PORT = 1521))
  (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = orclprm)
   (UR=A)
  )
 )

ORCLSTB =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oradg2)(PORT = 1521))
  (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = orclstb)
   (UR=A)
  )
 )

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = oradg1)(PORT = 1521))

Restart the listener:

[oracle@oradg2]$ lsnrctl stop
[oracle@oradg2]$ lsnrctl start

Now we will start our standby database and create the spfile:

Set environment:

[oracle@oradg2]$ . oraenv
ORACLE_SID = [orcl] ? orcl

Start SQLPlus:

[oracle@oradg2]$ sqlplus / as sysdba

SQL> startup nomount pfile='/tmp/initorcl.ora';
SQL> create spfile from pfile='/tmp/initorcl.ora';
SQL> shutdown
SQL> startup nomount

CREATING A PHYSICAL STANDBY OF OUR PRIMARY CONTAINER DATABASE

Test the connection to both (primary and standby) databases from both servers:

Server oradg1:

[oracle@oradg1]$ echo "select instance_name,status from v\$instance;" | sqlplus sys/oracle@orclprm as sysdba

SQL>
INSTANCE_NAME STATUS
---------------- ------------
orcl OPEN

[oracle@oradg1]$ echo "select instance_name,status from v\$instance;" | sqlplus sys/oracle@orclstb as sysdba

SQL>
INSTANCE_NAME STATUS
---------------- ------------
orcl STARTED

Server oradg2:

[oracle@oradg2]$ echo "select instance_name,status from v\$instance;" | sqlplus sys/oracle@orclprm as sysdba

SQL>
INSTANCE_NAME STATUS
---------------- ------------
orcl OPEN

[oracle@oradg2]$ echo "select instance_name,status from v\$instance;" | sqlplus sys/oracle@orclstb as sysdba

SQL>
INSTANCE_NAME STATUS
---------------- ------------
orcl STARTED

Start duplication:

[oracle@oradg2]$ rman target sys/oracle@orclprm auxiliary sys/oracle@orclstb

RMAN> DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
NOFILENAMECHECK;

Output:

Starting Duplicate Db at 02-SEP-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=135 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapworcl' auxiliary format
'/u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapworcl' ;
}
executing Memory Script
Starting backup at 02-SEP-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=390 device type=DISK
Finished backup at 02-SEP-17
contents of Memory Script:
{
restore clone from service 'orclprm' standby controlfile;
}

…

input datafile copy RECID=16 STAMP=953642336 file name=/u01/app/oracle/oradata/orcl/orclpdb2/users01.dbf
Finished Duplicate Db at 02-SEP-17

The physical standby database is now created.

Check the database role on the standby:

[oracle@oradg2]$ . oraenv
ORACLE_SID = [oracle] ? orcl
[oracle@oradg2 ~]$ sqlplus / as sysdba

SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PHYSICAL STANDBY

Check database parameters on the physical standby:

SQL> set linesize 500 pages 100
SQL> col name for a30
SQL> col value forma a100
SQL>
select name, value
from v$parameter
where name in ('db_name','db_unique_name','log_archive_config',
'log_archive_dest_1','log_archive_dest_2',
'log_archive_dest_state_1','log_archive_dest_state_2',
'remote_login_passwordfile', 'log_archive_format', 'log_archive_max_processes',
'fal_server','db_file_name_convert', 'log_file_name_convert', 'standby_file_management');

NAME             VALUE
------------------------------ ----------------------------------------------------------------------------------------------------
db_file_name_convert
log_file_name_convert
log_archive_dest_1 LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orclprm
log_archive_dest_2
log_archive_dest_state_1 enable
log_archive_dest_state_2 enable
fal_server orclprm
log_archive_config DG_CONFIG=(orclstb,orclprm)
log_archive_format %t_%s_%r.dbf
log_archive_max_processes 4
standby_file_management AUTO
remote_login_passwordfile EXCLUSIVE
db_name orcl
db_unique_name ORCLSTB

Create standby logfiles:

SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb01.log' size 209715200;
SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb02.log' size 209715200;
SQL> ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/orcl/redostb03.log' size 209715200;

Enabling Data Guard configuration

Enable the Data Guard broker via SQLPlus (on both servers: oradg1/oradg2):

Server oradg1:

[oracle@oradg1]$ . oraenv
ORACLE_SID = [orcl] ?
[oracle@oradg1]$ sqlplus / as sysdba
SQL> alter system set dg_broker_start=true scope=both;

Server oradg2:

[oracle@oradg2]$ . oraenv
ORACLE_SID = [orcl] ?
[oracle@oradg2]$ sqlplus / as sysdba
SQL> alter system set dg_broker_start=true scope=both;

Creating a Data Guard configuration via a tool DGMGRL on the Server oradg1:

[oracle@oradg1]$ . oraenv
ORACLE_SID = [orcl] ?
[oracle@oradg1]$ dgmgrl /

DGMGRL> create configuration orcl as primary database is orclprm connect identifier is orclprm;
DGMGRL> add database orclstb as connect identifier is orclstb maintained as physical;
DGMGRL> enable configuration;

Set the property StaticConnectIdentifier to prevent errors during switchover

DGMGRL> edit database orclprm set property StaticConnectIdentifier="oradg1:1521/orclprm_dgmgrl";
DGMGRL> edit database orclstb set property StaticConnectIdentifier="oradg2:1521/orclstb_dgmgrl";

Check the Data Guard configuration:

DGMGRL> show configuration

Configuration - orcl
Protection Mode: MaxPerformance

Members:
orclprm - Primary database
orclstb - Physical standby database

Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 55 seconds ago)

DGMGRL> show database orclprm

Database - orcl1prm
Role: PRIMARY
Intended State: TRANSPORT-ON

Instance(s):
orcl
Database Status:
SUCCESS

DGMGRL> show database orclstb

Database - orclstb
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 11.00 KByte/s
Real Time Query: ON

Instance(s):
orcl1
Database Status:
SUCCESS

Check Data Guard in SQLPlus (on both servers oradg1/oradg2):

Database Role/status:

Primary:

SQL> SELECT DATABASE_ROLE, DB_UNIQUE_NAME INSTANCE, OPEN_MODE, PROTECTION_MODE, PROTECTION_LEVEL, SWITCHOVER_STATUS FROM V$DATABASE;

DATABASE_ROLE     INSTANCE            OPEN_MODE     PROTECTION_MODE     PROTECTION_LEVEL SWITCHOVER_STATUS
---------------- ------------------------------ -------------------- -------------------- -------------------- --------------------
PRIMARY      ORCLPRM            READ WRITE     MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE TO STANDBY

Standby:

SQL> SELECT DATABASE_ROLE, DB_UNIQUE_NAME INSTANCE, OPEN_MODE, PROTECTION_MODE, PROTECTION_LEVEL, SWITCHOVER_STATUS FROM V$DATABASE;

DATABASE_ROLE     INSTANCE            OPEN_MODE     PROTECTION_MODE     PROTECTION_LEVEL SWITCHOVER_STATUS
---------------- ------------------------------ -------------------- -------------------- -------------------- --------------------
PHYSICAL STANDBY orclstb            MOUNTED WITH APPLY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE NOT ALLOWED

Check sequence number of archived redologs:

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

Output primary:

SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
15 09-AUG-17 12-AUG-17
16 12-AUG-17 13-AUG-17
17 13-AUG-17 18-AUG-17
18 18-AUG-17 02-SEP-17
19 02-SEP-17 02-SEP-17

Output standby:

SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
18 18-AUG-17 02-SEP-17
19 02-SEP-17 02-SEP-17

Create / Drop pluggable database in the Data Guard environment

Create new PDB in primary: what happens in the standby?

On the primary: create the new pdb:

[oracle@oradg1]$ . oraenv
ORACLE_SID = [oracle] ? orcl
[oracle@oradg1]$ sqlplus / as sysdba

SQL> create pluggable database ORCLPDB3
     admin user pdbdba identified by oracle
     file_name_convert=('/u01/app/oracle/oradata/orcl/pdbseed',
     '/u01/app/oracle/oradata/orcl/orclpdb3');

SQL> alter pluggable database orclpdb3 open read write;

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
4 ORCLPDB2 READ WRITE NO
5 ORCLPDB3 READ WRITE NO

The PDB ORCLPDB3 is created in the primary database.

Check the standby:

[oracle@oradg2]$ . oraenv
ORACLE_SID = [oracle] ? orcl
[oracle@oradg1]$ sqlplus / as sysdba

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED MOUNTED
3 ORCLPDB1 MOUNTED
4 ORCLPDB2 MOUNTED
5 ORCLPDB3 MOUNTED

The new PDB ORCLPDB3 is automatically created on the standby via Data Guard!!!!

Drop a PDB in primary: what happens in the standby?

On the primary: drop PDB ORCLPDB3:

[oracle@oradg1]$ . oraenv
ORACLE_SID = [oracle] ? orcl
[oracle@oradg1]$ sqlplus / as sysdba

SQL> alter pluggable database orclpdb3 close;
SQL> drop pluggable database orclpdb3 including datafiles;

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
4 ORCLPDB2 READ WRITE NO

The PDB ORCLPDB3 is now deleted in the primary database

Check the standby:

[oracle@oradg2]$ . oraenv
ORACLE_SID = [oracle] ? orcl
[oracle@oradg1]$ sqlplus / as sysdba

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED MOUNTED
3 ORCLPDB1 MOUNTED
4 ORCLPDB2 MOUNTED

The PDB ORCLPB3 is automatically dropped on the standby via Data Guard!!!

Swithover test.

Start DGMGRL and connect to Standby database as user sys:

[oracle@oradg1 ~]$ dgmgrl sys/oracle@orclstb

DGMGRL> show configuration

Configuration - orcl
Protection Mode: MaxPerformance
Members:
orclprm - Primary database
orclstb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 32 seconds ago)
Perfrom a switchover:
DGMGRL> switchover to orclstb

Output:

Performing switchover NOW, please wait...
New primary database "orclstb" is opening...
Operation requires start up of instance "orcl" on database "orclprm"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Connected to "ORCLPRM"
Switchover succeeded, new primary is "orclstb"

Check the Data Guard configuration:

DGMGRL> show configuration

Configuration - orcl
Protection Mode: MaxPerformance
Members:
orclstb - Primary database
orclprm - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 6 seconds ago)

DGMGRL> show database orclstb

Database - orcl1stb
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
orcl
Database Status:
SUCCESS

DGMGRL> show database orclprm

Database - orclprm
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 34.00 KByte/s
Real Time Query: OFF
Instance(s):
orcl
Database Status:
SUCCESS

Comments

Popular posts from this blog

Step by Step: How to troubleshoot a slow running query in Oracle

Register Archive log file manually in standby Database

How to check UNDO tablespace usage and who is using more undo