Oracle 19c Data Guard Configuration

Oracle 19c Data Guard Configuration step by step

Hello friends in this article, we going to discuss Oracle 19c Data Guard Configuration step by step. Oracle Data Guard is a high availability model which prevent downtime and data loss by using redundant system and software to eliminate single point of failure.

Our Environment for this practice

Primary Environment

DB_NAMEOCP
DB_UNIQUE_NAMEOCP
IP192.168.1.10
DATABASE VERSION19.2.0.0
OSOLE 6

Standby Environment

DB_NAMEOCP
DB_UNIQUE_NAMEOCP_DR
IP192.168.1.20
DATABASE VERSION19.2.0.0
OSOLE 6

After configuring OS-level settings now we need to configure database level parameters to configure oracle 19c data guard.

Action on Primary Server

1. Make sure the primary database running in archive log mode.

Check Archive mode using the below queries.

$sqlplus sys@ocp as sysdba

 SQL> archive log list 
OR
SQL> select log_mode from v$database;

If your database is not running in archive log then follow the below steps.

SQL> shu immediate
SQL> startup mount
SQL> alter database archivelog; 
SQL> alter database open; 

2. Enable force logging.

Check force logging.

SQL> select force_logging from v$database; 

 FORCE_LOGGING 
------------------ 
NO 

Change force logging mode.

SQL> ALTER DATABASE FORCE LOGGING; 

3. Change below dynamic parameters

SQL> alter system set log_archive_config='dg_config=(ocp,ocp_dr)'; 

SQL> alter system set log_archive_dest_2='service=ocp_dr  noaffirm async valid_for=(online_logfiles,primary_role) db_unique_name=ocp_dr'; 

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE; 

SQL> ALTER SYSTEM SET FAL_SERVER=ocp_dr; 

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO; 

4. Set parameter REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE and you can set archive formats this is optional.

SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;  

SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE; 

5. Create a STANDBY redo log file on PRIMARY as well using the following query.

SQL> alter database add standby logfile ('/u01/app/oracle/ocp/redo1.log') size 50m; 
SQL> alter database add standby logfile ('/u01/app/oracle/ocp/redo2.log') size 50m;  
SQL> alter database add standby logfile ('/u01/app/oracle/ocp/redo3.log') size 50m;  
SQL> alter database add standby logfile ('/u01/app/oracle/ocp/redo4.log') size 50m;  

Now take restart your primary database after that we need to create listeners and TNS services on both sides (primary & standby).

The Listener.ora file looks like this on primary for standby just change the OCP into ocp_dr and IP Address.

listener.ora Network Configuration File: C:\app\sysadmin\product\19.2.0\db_home\NETWORK\ADMIN\listener.ora
 Generated by Oracle configuration tools.
 SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
       (GLOBAL_DBNAME = ocp)
       (ORACLE_HOME = C:\app\sysadmin\product\19.2.0\db_home )
       (SID_NAME = ocp)
     )
   )
 LISTENER =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
   )
 ADR_BASE_LISTENER = C:\app\sysadmin\product\19.2.0\db_home \log

Your tnsname.ora file looks like this check below on both sides. You can copy it from production or recreate it on standby.

tnsnames.ora Network Configuration File: C:\app\sysadmin\product\19.2.0\db_home\NETWORK\ADMIN\tnsnames.ora
 Generated by Oracle configuration tools.
 OCP =
   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
     )
     (CONNECT_DATA =
       (SERVICE_NAME = ocp)
     )
   )
 OCP_DR =
   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
     )
     (CONNECT_DATA =
       (SERVICE_NAME = ocp_dr)
     )
   )

Start listener and check TNS ping using both services on both sides.

$lsnrctl start
$tnsping ocp
$tnsping ocp_dr

6. Create pfile from spfile on production and move it on standby.

SQL> create pfile='/u01/initstandby.ora' from spfile;

If everything is running ok then start the replication using RMAN Duplicate which makes a full clone of production.

In my case everything going good so I am going to start the cloning process for standby.

$ sqlplus sys/sys@ocp_dr as sysdba 

SQL> startup nomount pfile=/u01/initstandby.ora; 

Action on Standby Server

7. Connect with the host or open a new terminal and run the following command.

$ rman target sys/sys@ocp auxiliary sys/sys@ocp_dr

RMAN> duplicate target database for standby from active database nofilenamecheck;  

8. Once the above duplicate finished then you can start the MRP process.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; 

How to check the MRP process is running or not?

Using the following query you can easily check the MRP process is running or not.

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

Check database role, open mode and database name using the following query.

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

How to check which archive applied currently?

The following query will show you the details about all applied archive in standby.

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

Now you have successfully done Oracle 19c Data Guard Configuration.

Step by Step to configure Oracle 12c Data Guard Physical Standby read here

Share this
Share

1 thought on “Oracle 19c Data Guard Configuration step by step”

Comments are closed.

Share