Home / Installation/Configurations19c / Oracle Dataguard 19c Configuration

Oracle Dataguard 19c Configuration

Oracle Dataguard 19c Configuration

Implementing a disaster recovery solution for Oracle databases involves setting up Oracle 19c Dataguard with PDB, which ensures data protection and availability. Dataguard provides real-time data protection, automatic failover, and the ability to create standby databases for the primary database. In a Dataguard configuration, a PDB within a CDB can be configured as either a primary or standby database, offering protection and failover at the PDB level. This approach allows for more precise disaster recovery and enhances flexibility in deploying and managing Oracle databases.

To set up Oracle 19c Dataguard with PDB, the following steps need to be followed:

  • Ensure that two Machines are prepared with Linux Operating System with a minimum of 50 GB disk space and 8 GB RAM.
  • Install the Oracle 19c binaries on both machines.
  • Create a Database with PDB on the Primary machine.

After the two machines with sufficient disk space and RAM have been set up, and a Database with PDB has been successfully created, the next step is to initiate the Dataguard configuration on the primary machine. Here are the steps to configure Dataguard on the primary side for the Oracle 19c setup with PDB:

Step 1. Enable Archivelog Mode and Force logging

To ensure proper functionality, it is necessary for the primary database to operate in archivelog mode with force logging enabled. Please follow the steps below to enable force logging:

SQL> select log_mode from v$database;


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

SQL> startup mount
ORACLE instance started.

SQL> alter database archivelog;
Database altered.

SQL> alter database force logging;
Database altered.

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

——— ————————————— ————

Step 2. Create standby redologfiles

To proceed, it is essential to incorporate standby redo log files. Please utilize the following commands to add them:

alter database add standby logfile group 4 ‘/u01/app/oracle/oradata/ORCL/redo04.log’ size 100m;
alter database add standby logfile group 5 ‘/u01/app/oracle/oradata/ORCL/redo05.log’ size 100m;
alter database add standby logfile group 6 ‘/u01/app/oracle/oradata/ORCL/redo06.log’ size 100m;
alter database add standby logfile group 7 ‘/u01/app/oracle/oradata/ORCL/redo07.log’ size 100m;

Now, Check redolog members’ detail which will show the standby redologs as added in the Above step:

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

—— ——————————————- ——- ——
3 /u01/app/oracle/oradata/ORCL/redo03.log ONLINE
2 /u01/app/oracle/oradata/ORCL/redo02.log ONLINE
1 /u01/app/oracle/oradata/ORCL/redo01.log ONLINE
4 /u01/app/oracle/oradata/ORCL/redo04.log STANDBY
5 /u01/app/oracle/oradata/ORCL/redo05.log STANDBY
6 /u01/app/oracle/oradata/ORCL/redo06.log STANDBY
7 /u01/app/oracle/oradata/ORCL/redo07.log STANDBY

7 rows selected.

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

In order to establish connectivity, it is necessary to create TNS and Listener entries for both databases. In my case, I will be adding the following entry to the “tnsnames.ora” file and copying it to both sides.

Location of the TNS file: “/u01/app/oracle/product/19.3.0/db_home/network/admin/tnsnames.ora”

(ADDRESS = (PROTOCOL = TCP)(HOST = primary.localhost)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = stby.localhost)(PORT = 1521))
(SERVICE_NAME = orcldr)

  Listener Entry On Primary Side

Listener file Location: “/u01/app/oracle/product/19.3.0/db_home/network/admin/listener.ora”

[oracle@primary admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/19.3.0/db_home/network/admin/listener.ora
# Generated by Oracle configuration tools.

(ORACLE_HOME = /u01/app/oracle/product/19.3.0/db_home)
(SID_NAME = orcl)

(ADDRESS = (PROTOCOL = TCP)(HOST = primary.localhost)(PORT = 1521))
ADR_BASE_LISTENER = /u01/app/oracle

Listener Entry On Standby Side


[oracle@stby admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/19.3.0/db_home/network/admin/listener.ora
# Generated by Oracle configuration tools.
(GLOBAL_DBNAME = orcldr)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/db_home)
(SID_NAME = orcldr)

(ADDRESS = (PROTOCOL = TCP)(HOST = stby.localhost)(PORT = 1521))

ADR_BASE_LISTENER = /u01/app/oracle

 Checking Connectivity on Both the Server through TNS Ping Utility

Start the listener and attempt to ping the TNS entry from both servers using the provided commands.


$tnsping orcldr

$tnsping orcl


If TNSPING is not working If your tnsping is not working then you have to recheck the below points: Check hostname or IP address in tnsnames.ora file Check /etc/hosts file entry 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

If the Firewall is in Running State then Use the Following Given Commands to Stop and Disable the Firewall

# 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.

Step 4. Parameters Configuration of the dataguard on primary side

It is crucial to exercise caution while configuring the following parameters, as they hold significant importance in the setup:

SQL> ALTER SYSTEM SET log_archive_config=’dg_config=(orcl,orcldr)’ SCOPE=both;
System altered.

SQL> ALTER SYSTEM SET fal_server=’orcldr’ SCOPE=both;
System altered.

SQL> ALTER SYSTEM SET fal_client=’orcl’ 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=orcl’ SCOPE=both;
System altered.

SQL> ALTER SYSTEM SET log_archive_dest_2=’service=orcldr async valid_for=(online_logfiles,primary_role) db_unique_name=orcldr’ SCOPE=both;
System altered.

System altered.


Step 5. Password file Configuration

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

$ scp orapworcl oracle@$ORACLE_HOME/dbs/

Rename password file on standby:

$ cd $ORACLE_HOME/dbs
$ mv orapworcl orapworcldr

Step 6: Activate Fast Recovery Area (FRA) on the Primary side.

In this setup, we utilize Fast Recovery Area (FRA) for archiving purposes, hence it is necessary to enable it as the first step.

SQL> alter system set db_recovery_file_dest_size=10G;
System altered.

SQL> alter system set db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area/’;
System altered.


Step 7: Verify the locations of datafiles and audit files on the Primary side.

SQL> select name from v$datafile;


13 rows selected.

SQL> show parameter audit_file_dest

———————————— ———– ——————————
audit_file_dest string /u01/app/oracle/admin/orcl/

Step 8. Action on Standby for Creating the Directories

Create the following required directories on the standby side as given below:

$mkdir -p /u01/app/oracle/oradata/ORCLDR/
$mkdir -p /u01/app/oracle/oradata/ORCLDR/pdbseed/
$mkdir -p /u01/app/oracle/oradata/ORCLDR/test/
$mkdir -p /u01/app/oracle/admin/orcldr/adump
$mkdir -p /u01/app/oracle/fast_recovery_area/

Step 9. Create PFILE for Standby

Create a PFILE using the following parameters only given below:

$ vi /u01/app/oracle/product/19.3.0/db_home/dbs/initorcldr.ora db_name=orcl enable_pluggable_database=true


Step 10. Starting the Standby Database in Nomount State

 Start  Standby database in nomount state using the PFILE Create in Step 9

$ export ORACLE_SID=orcldr
$ sqlplus / as sysdba
SQL> startup nomount  pfile=/u01/app/oracle/product/19.3.0/db_home/dbs/initorcldr.ora
ORACLE instance started.

Step 11: Establish a connection with RMAN.

To proceed, connect with RMAN from the standby database using the provided commands.

$ rman target sys/sys@orcl auxiliary sys/sys@orcldr

Begin the process of constructing the standby database using RMAN. It is now time to build the standby database utilizing RMAN. Kindly execute to the following RMAN Script in the RMAN Prompt Connected above:

RMAN> run
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate auxiliary channel c4 type disk;
allocate auxiliary channel c5 type disk;
allocate auxiliary channel c6 type disk;
duplicate target database for standby from active database
parameter_value_convert ‘orcl’,’orcldr’
set db_name=’orcl’
set db_unique_name=’orcldr’
set audit_file_dest=’/u01/app/oracle/admin/orcl/adump’
set diagnostic_dest=’/u01/app/oracle/admin/orcl/adump’
set db_file_name_convert=’/u01/app/oracle/oradata/ORCL/’,’/u01/app/oracle/oradata/ORCLDR/’
set log_file_name_convert=’/u01/app/oracle/oradata/ORCL/’,’/u01/app/oracle/oradata/ORCLDR/’
set control_files=’/ocptechnology/app/oracle/oradata/ORCLDR/standby1.ctl’
set log_archive_max_processes=’5′
set fal_client=’orcldr’
set fal_server=’orcl’
set standby_file_management=’AUTO’
set log_archive_config=’dg_config=(orcl,orcldr)’
set compatible=’′

Once the RMAN process mentioned above is completed, the configuration of our Dataguard has been successfully accomplished. We can now proceed to open the standby database and initiate the Managed Recovery Process (MRP).


SQL> alter database open;
Database altered.

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

Step 11: Checking the MRP Process

To verify the status of the Managed Recovery Process (MRP) and determine if it is currently running, you can utilize the provided command.

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

Step 12: Checking the Standby Database Role and Status

Verify the role and open status of the standby database with the following Given Command:

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

——— ——————– —————-




  • 5

About Syed Saad Ali

With 13 years of experience as a certified and skilled Oracle Database Administrator, I possess the expertise to handle various levels of database maintenance tasks and proficiently perform Oracle updates. Throughout my career, I have honed my analytical abilities, enabling me to swiftly diagnose and resolve issues as they arise. I excel in planning and executing special projects within time-sensitive environments, showcasing exceptional organizational and time management skills. My extensive knowledge encompasses directing, coordinating, and exercising authoritative control over all aspects of planning, organization, and successful project completions. Additionally, I have a strong aptitude for resolving customer relations matters by prioritizing understanding and effective communication. I am adept at interacting with customers, vendors, and management, ensuring seamless communication and fostering positive relationships.

Check Also


How to Plug and Unplug a PDB in TDE Environment

Unplug and Plug of PDB in a Transparent Data Encryption (TDE) Environment   Within an …

Leave a Reply