Oracle 19c Dataguard setup with PDB

Oracle 19c Dataguard setup with PDB

Oracle 19c Dataguard setup with PDB, Dataguard is a disaster recovery solution that provides a high level of data protection and availability for Oracle databases. It provides real-time data protection, and automatic failover protection, and enables the creation of one or more standby databases for a primary database.

Dataguard with PDB (Pluggable Database), a PDB in a CDB (Container Database) can be configured as a primary or standby database in a Data Guard configuration. This enables PDB-level protection and failover, providing better granularity in disaster recovery and increased flexibility in deploying and managing Oracle databases.

To set up Oracle 19c Dataguard with PDB, you need to follow these steps:

  1. Create two machines with a minimum of 50 GB disk space and 8GB RAM.
  2. Install Oracle 19c binary on both machines.
  3. Create a Database with PDB on the Primary machine.
  4. Configure Datagurad parameters on the primary side.

I have already created two machines that have sufficient disk space and RAM. I already create a Database with PDB so now let's start the Dataguard configuration on the primary machine.

Dataguard configuration steps Primary side

For the Oracle 19c dataguard setup with PDB, you must follow the below steps carefully.

Step 1. Enable archivelog mode and Force logging

The primary database must be running in archivelog mode and force logging should be enabled using the below steps.

SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 3170891352 bytes
Fixed Size                  9139800 bytes
Variable Size             637534208 bytes
Database Buffers         2516582400 bytes
Redo Buffers                7634944 bytes
Database mounted.

SQL>
SQL> alter database archivelog;
Database altered.


SQL> alter database force logging;
Database altered.

SQL> select name,force_logging,log_mode from v$database;

NAME      FORCE_LOGGING                           LOG_MODE
--------- --------------------------------------- ------------
DIGITAL   YES                                     ARCHIVELOG

Step 2. Create standby redologfiles

We need to add standby redologifles, using the below commands.

alter database add standby logfile group 4 '/u02/app/oracle/oradata/DIGITAL/redo04.log'  size 50m;
alter database add standby logfile group 5 '/u02/app/oracle/oradata/DIGITAL/redo05.log' size 50m;
alter database add standby logfile group 6 '/u02/app/oracle/oradata/DIGITAL/redo06.log' size 50m;
alter database add standby logfile group 7 '/u02/app/oracle/oradata/DIGITAL/redo07.log' size 50m;

Check redolog members' detail:

SQL> select group#,member,type,status from v$logfile;

 GROUP# MEMBER                                      TYPE    STATUS
------ ------------------------------------------- ------- ------
     3 /u02/app/oracle/oradata/DIGITAL/redo03.log  ONLINE
     2 /u02/app/oracle/oradata/DIGITAL/redo02.log  ONLINE
     1 /u02/app/oracle/oradata/DIGITAL/redo01.log  ONLINE
     4 /u02/app/oracle/oradata/DIGITAL/redo04.log  STANDBY
     5 /u02/app/oracle/oradata/DIGITAL/redo05.log  STANDBY
     6 /u02/app/oracle/oradata/DIGITAL/redo06.log  STANDBY
     7 /u02/app/oracle/oradata/DIGITAL/redo07.log  STANDBY

7 rows selected.

Step 3. Create TNS entry for both (Primary & Standby)

We need to create TNS and Listener entries for both databases, in my case I'm adding the following entry in the "tnsnames.ora" file, and copying it on both sides.

TNS file location: "/u02/app/oracle/product/19.3.0/db_home/network/admin/tnsnames.ora"

DIGITAL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocptechnology.localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = digital)
    )
  )


DIGITALDR =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocpstandby.localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = digitaldr)
    )
  )

Listener file: "/u02/app/oracle/product/19.3.0/db_home/network/admin/listener.ora"

Primary Side Listener Entry:

[oracle@ocptechnology admin]$ cat listener.ora
# listener.ora Network Configuration File: /u02/app/oracle/product/19.3.0/db_home/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = digital)
      (ORACLE_HOME = /u02/app/oracle/product/19.3.0/db_home)
      (SID_NAME = digital)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocptechnology.localhost)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u02/app/oracle

Standby side listener entry:

[oracle@ocpstandby admin]$ cat listener.ora
# listener.ora Network Configuration File: /u02/app/oracle/product/19.3.0/db_home/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = digitaldr)
      (ORACLE_HOME = /u02/app/oracle/product/19.3.0/db_home)
      (SID_NAME = digitaldr)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocpstandby.localhost)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u02/app/oracle

Check TNS ping

Start the listener and try to ping the TNS entry from both servers using the following commands.

$tnsping digital
$tnsping digitaldr

Output:

Oracle 19c Dataguard setup with PDB

If TNSPING is not working

If your tnsping is not working then you have to recheck the below points:

  1. Check hostname or IP address in tnsnames.ora file
  2. Check /etc/hosts file entry
  3. Check firewall status - It should be disabled

How to disable Firewall

You can follow the below steps to disable the firewall.

# sudo firewall-cmd --state
running

# sudo systemctl stop firewalld
# sudo systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.


# sudo firewall-cmd --state
not running

Configure the dataguard parameters primary side

The following parameters are most important, so you must configure these parameters carefully.

SQL> ALTER SYSTEM SET log_archive_config='dg_config=(digital,digitaldr)' SCOPE=both;

System altered.


SQL> ALTER SYSTEM SET fal_server='digitaldr' SCOPE=both;

System altered.

SQL> ALTER SYSTEM SET fal_client='digital' SCOPE=both;

System altered.

SQL> ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=both;

System altered.

SQL> ALTER SYSTEM SET log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=digital' SCOPE=both;

System altered.

SQL> ALTER SYSTEM SET log_archive_dest_2='service=digitaldr async valid_for=(online_logfiles,primary_role) db_unique_name=digitaldr' SCOPE=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE; 

Verify the parameters using the following commands:

col name for a30
col value for a85
set lin 300 pagesize 300

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','fal_client','db_file_name_convert','log_file_name_convert','standby_file_management');

Output from the above query:

Password file

Copy the password file from the primary to the standby server and rename it on standby as the name of standby.

$ scp orapwdigital oracle@192.168.74.160:$ORACLE_HOME/dbs/

Rename password file on standby:

$ cd $ORACLE_HOME/dbs
$ mv orapwdigital orapwdigitaldr

Enable FRA on the Primary side

We are using FRA for archives so you have to enable it first.

SQL> alter system set db_recovery_file_dest_size=10G;

System altered.

SQL>
SQL>  alter system set db_recovery_file_dest='/u02/app/oracle/fast_recovery_area/';

System altered.

Datafiles and Audit file

Check datafile and audit file location on the Primary side.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------
/u02/app/oracle/oradata/DIGITAL/system01.dbf
/u02/app/oracle/oradata/DIGITAL/sysaux01.dbf
/u02/app/oracle/oradata/DIGITAL/undotbs01.dbf
/u02/app/oracle/oradata/DIGITAL/pdbseed/system01.dbf
/u02/app/oracle/oradata/DIGITAL/pdbseed/sysaux01.dbf
/u02/app/oracle/oradata/DIGITAL/users01.dbf
/u02/app/oracle/oradata/DIGITAL/pdbseed/undotbs01.dbf
/u02/app/oracle/oradata/DIGITAL/shri/system01.dbf
/u02/app/oracle/oradata/DIGITAL/shri/sysaux01.dbf
/u02/app/oracle/oradata/DIGITAL/shri/undotbs01.dbf
/u02/app/oracle/oradata/DIGITAL/shri/users01.dbf

11 rows selected.


SQL> show parameter audit

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      /u02/app/oracle/admin/digital/
                                                 adump
audit_sys_operations                 boolean     TRUE
audit_syslog_level                   string
audit_trail                          string      DB
unified_audit_common_systemlog       string
unified_audit_sga_queue_size         integer     1048576
unified_audit_systemlog              string

Action on Standby

Create the required directory on the standby side as below:

$mkdir -p /u02/app/oracle/oradata/DIGITALDR/
$mkdir -p /u02/app/oracle/oradata/DIGITALDR/pdbseed/
$mkdir -p /u02/app/oracle/oradata/DIGITALDR/shri/	
$mkdir -p /u02/app/oracle/admin/digitaldr/adump
$mkdir -p /u02/app/oracle/fast_recovery_area/

Create a pfile for standby

We are going to create a pfile using the below parameters only:

$ vi /u02/app/oracle/product/19.3.0/db_home/dbs/initdigitaldr.ora

db_name=digital
enable_pluggable_database=true

Nomount Standby Database

Start your standby database nomount using the above-created file:

$ export ORACLE_SID=digitaldr
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Feb 5 09:07:44 2023
Version 19.16.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile=/u02/app/oracle/product/19.3.0/db_home/dbs/initdigitaldr.ora
ORACLE instance started.

Total System Global Area  272629008 bytes
Fixed Size                  9133328 bytes
Variable Size             243269632 bytes
Database Buffers           16777216 bytes
Redo Buffers                3448832 bytes

Connect with RMAN

Connect with RMAN from the standby database using the following commands.

$ rman target sys/sys@digital auxiliary sys/sys@digitaldr

Start Building standby using RMAN

Now its time to build a standby database using RMAN, follow the below commands

RMAN> run
{
allocate channel c1 type disk;
allocate auxiliary channel c3 type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'digital','digitaldr'
set db_name='digital'
set db_unique_name='digitaldr'
set audit_file_dest='/ocptechnology/app/oracle/admin/digital/adump'
set diagnostic_dest='/ocptechnology/app/oracle/admin/digital/adump'
set db_file_name_convert='/u02/app/oracle/oradata/DIGITAL/','/ocptechnology/app/oracle/oradata/DIGITALDR/'
set log_file_name_convert='/u02/app/oracle/oradata/DIGITAL/','/ocptechnology/app/oracle/oradata/DIGITALDR/'
set control_files='/ocptechnology/app/oracle/oradata/DIGITALDR/standby1.ctl'
set log_archive_max_processes='5'
set fal_client='digitaldr'
set fal_server='digital'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(digital,digitaldr)'
set compatible='19.0.0.0.0'
nofilenamecheck;
}

Output from above:

allocated channel: c1
channel c1: SID=85 device type=DISK

allocated channel: c3
channel c3: SID=36 device type=DISK

Starting Duplicate Db at 05-FEB-23

contents of Memory Script:
{
   backup as copy reuse
   passwordfile auxiliary format  '/u02/app/oracle/product/19.3.0/db_home/dbs/orapwdigitaldr'   ;
   restore clone from service  'digital' spfile to
 '/u02/app/oracle/product/19.3.0/db_home/dbs/spfiledigitaldr.ora';
   sql clone "alter system set spfile= ''/u02/app/oracle/product/19.3.0/db_home/dbs/spfiledigitaldr.ora''";
}
executing Memory Script

Starting backup at 05-FEB-23
Finished backup at 05-FEB-23

Starting restore at 05-FEB-23

channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: restoring SPFILE
output file name=/u02/app/oracle/product/19.3.0/db_home/dbs/spfiledigitaldr.ora
channel c3: restore complete, elapsed time: 00:00:02
Finished restore at 05-FEB-23

sql statement: alter system set spfile= ''/u02/app/oracle/product/19.3.0/db_home/dbs/spfiledigitaldr.ora''

contents of Memory Script:
{
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=digitaldrXDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_name =
 ''digital'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''digitaldr'' comment=
 '''' scope=spfile";
   sql clone "alter system set  audit_file_dest =
 ''/ocptechnology/app/oracle/admin/digital/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  diagnostic_dest =
 ''/ocptechnology/app/oracle/admin/digital/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/u02/app/oracle/oradata/DIGITAL/'', ''/ocptechnology/app/oracle/oradata/DIGITALDR/'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/u02/app/oracle/oradata/DIGITAL/'', ''/ocptechnology/app/oracle/oradata/DIGITALDR/'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/ocptechnology/app/oracle/oradata/DIGITALDR/standby1.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_max_processes =
 5 comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_client =
 ''digitaldr'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''digital'' comment=
 '''' scope=spfile";
   sql clone "alter system set  standby_file_management =
 ''AUTO'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_config =
 ''dg_config=(digital,digitaldr)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  compatible =
 ''19.0.0.0.0'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=digitaldrXDB)'' comment= '''' scope=spfile

sql statement: alter system set  db_name =  ''digital'' comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''digitaldr'' comment= '''' scope=spfile

sql statement: alter system set  audit_file_dest =  ''/ocptechnology/app/oracle/admin/digital/adump'' comment= '''' scope=spfile

sql statement: alter system set  diagnostic_dest =  ''/ocptechnology/app/oracle/admin/digital/adump'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/u02/app/oracle/oradata/DIGITAL/'', ''/ocptechnology/app/oracle/oradata/DIGITALDR/'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/u02/app/oracle/oradata/DIGITAL/'', ''/ocptechnology/app/oracle/oradata/DIGITALDR/'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/ocptechnology/app/oracle/oradata/DIGITALDR/standby1.ctl'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''digitaldr'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''digital'' comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_config =  ''dg_config=(digital,digitaldr)'' comment= '''' scope=spfile

sql statement: alter system set  compatible =  ''19.0.0.0.0'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3170891352 bytes

Fixed Size                     9139800 bytes
Variable Size                637534208 bytes
Database Buffers            2516582400 bytes
Redo Buffers                   7634944 bytes
allocated channel: c3
channel c3: SID=8 device type=DISK

contents of Memory Script:
{
   restore clone from service  'digital' standby controlfile;
}
executing Memory Script

Starting restore at 05-FEB-23

channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: restoring control file
channel c3: restore complete, elapsed time: 00:00:15
output file name=/ocptechnology/app/oracle/oradata/DIGITALDR/standby1.ctl
Finished restore at 05-FEB-23

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/temp01.dbf";
   set newname for tempfile  2 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/temp012023-02-04_20-43-45-875-PM.dbf";
   set newname for tempfile  3 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/shri/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/system01.dbf";
   set newname for datafile  3 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/sysaux01.dbf";
   set newname for datafile  4 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/undotbs01.dbf";
   set newname for datafile  5 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/system01.dbf";
   set newname for datafile  6 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/sysaux01.dbf";
   set newname for datafile  7 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/users01.dbf";
   set newname for datafile  8 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/undotbs01.dbf";
   set newname for datafile  9 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/shri/system01.dbf";
   set newname for datafile  10 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/shri/sysaux01.dbf";
   set newname for datafile  11 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/shri/undotbs01.dbf";
   set newname for datafile  12 to
 "/ocptechnology/app/oracle/oradata/DIGITALDR/shri/users01.dbf";
   restore
   from  nonsparse   from service
 'digital'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /ocptechnology/app/oracle/oradata/DIGITALDR/temp01.dbf in control file
renamed tempfile 2 to /ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/temp012023-02-04_20-43-45-875-PM.dbf in control file
renamed tempfile 3 to /ocptechnology/app/oracle/oradata/DIGITALDR/shri/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 05-FEB-23

channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00001 to /ocptechnology/app/oracle/oradata/DIGITALDR/system01.dbf
channel c3: restore complete, elapsed time: 00:03:13
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00003 to /ocptechnology/app/oracle/oradata/DIGITALDR/sysaux01.dbf
channel c3: restore complete, elapsed time: 00:02:47
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00004 to /ocptechnology/app/oracle/oradata/DIGITALDR/undotbs01.dbf
channel c3: restore complete, elapsed time: 00:05:05
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00005 to /ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/system01.dbf
channel c3: restore complete, elapsed time: 00:01:20
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00006 to /ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/sysaux01.dbf
channel c3: restore complete, elapsed time: 00:01:10
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00007 to /ocptechnology/app/oracle/oradata/DIGITALDR/users01.dbf
channel c3: restore complete, elapsed time: 00:00:01
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00008 to /ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/undotbs01.dbf
channel c3: restore complete, elapsed time: 00:00:37
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00009 to /ocptechnology/app/oracle/oradata/DIGITALDR/shri/system01.dbf
channel c3: restore complete, elapsed time: 00:00:56
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00010 to /ocptechnology/app/oracle/oradata/DIGITALDR/shri/sysaux01.dbf
channel c3: restore complete, elapsed time: 00:00:56
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00011 to /ocptechnology/app/oracle/oradata/DIGITALDR/shri/undotbs01.dbf
channel c3: restore complete, elapsed time: 00:00:15
channel c3: starting datafile backup set restore
channel c3: using network backup set from service digital
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00012 to /ocptechnology/app/oracle/oradata/DIGITALDR/shri/users01.dbf
channel c3: restore complete, elapsed time: 00:00:01
Finished restore at 05-FEB-23

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=1127990943 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/sysaux01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=9 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/users01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=10 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/pdbseed/undotbs01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=11 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/shri/system01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=12 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/shri/sysaux01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=13 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/shri/undotbs01.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=14 STAMP=1127990944 file name=/ocptechnology/app/oracle/oradata/DIGITALDR/shri/users01.dbf
Finished Duplicate Db at 05-FEB-23
released channel: c1
released channel: c3

Finally, our dataguard has been configured successfully. Let's open the standby and start the MRP process.

SQL> alter database open;
Database altered.

SQL> alter database recover managed standby database disconnect nodelay;
Database altered.

Check MRP process

Using the below command you can check whether the MRP process is running or not, in my case, it is working perfectly.

SQL> select sequence#,process,status from v$managed_standby

 SEQUENCE# PROCESS   STATUS
---------- --------- ------------
         0 ARCH      CONNECTED
         0 DGRD      ALLOCATED
         0 DGRD      ALLOCATED
         0 ARCH      CONNECTED
         0 ARCH      CONNECTED
         0 ARCH      CONNECTED
         0 ARCH      CONNECTED
         0 RFS       IDLE
         0 RFS       IDLE
        21 MRP0      WAIT_FOR_LOG
         0 RFS       IDLE
         0 RFS       IDLE
        21 RFS       IDLE

13 rows selected.

Check the standby database role and open status.

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
DIGITAL   READ ONLY WITH APPLY PHYSICAL STANDBY

If you really enjoyed this article please write your feeling in the comment box.

FAQ

How to setup Data Guard in 19c?

ALTER SYSTEM SET log_archive_config='dg_config=(digital,digitaldr)' SCOPE=both;

How do I connect my PDB database to 19c?

Create tns entry and using it you can connect the PDB database.

How to create standby PDB in Oracle 19c?

create pluggable database PDB2 admin user pdb2dba identified by oracle default tablespace PDB2_USERS datafile '/u01/app/oracle/oradata/shripal/pdb2/pdb2_users01.dbf' size 250m autoextend on file_name_convert=('/u01/app/oracle/oradata/shripal/pdbseed/','/u01/app/oracle/oradata/shripal/pdb2/');

2 thoughts on “Oracle 19c Dataguard setup with PDB

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top