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 prevents downtime and data loss by using redundant systems and software to eliminate single points of failure.
Our Environment for this practice
Primary Environment
| DB_NAME | OCP | 
| DB_UNIQUE_NAME | OCP | 
| IP | 192.168.1.10 | 
| DATABASE VERSION | 19.2.0.0 | 
| OS | OLE 6 | 
Standby Environment
| DB_NAME | OCP | 
| DB_UNIQUE_NAME | OCP_DR | 
| IP | 192.168.1.20 | 
| DATABASE VERSION | 19.2.0.0 | 
| OS | OLE 6 | 
After configuring OS-level settings now we need to configure database level parameters to configure the oracle 19c data guard.
Start 19c Data Guard Configuration
Action on Primary Server
Step 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 mode then change it in archive log mode using the below steps.
SQL> shu immediate
SQL> startup mount
SQL> alter database archivelog; 
SQL> alter database open; Step 2: Enable force logging.
SQL> select force_logging from v$database; 
 FORCE_LOGGING 
------------------ 
NO Enable force logging
SQL> ALTER DATABASE FORCE LOGGING; Step 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; In the above step, the log_archive_config parameter defines the primary DB name and standby DB name. And log_archive_dest_2 parameter defines the standby service name.
Step 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; Step 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.
SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
       (GLOBAL_DBNAME = ocp)
       (ORACLE_HOME = /u01/app/sysadmin/product/19.2.0/db_home )
       (SID_NAME = ocp)
     )
	 (SID_DESC =
       (GLOBAL_DBNAME = ocp_dr)
       (ORACLE_HOME = /u01/app/sysadmin/product/19.2.0/db_home )
       (SID_NAME = ocp_dr)
     )
   )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: /u01/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 (PR & DR) on both sides.
$lsnrctl start
$tnsping ocp
$tnsping ocp_drStep 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 well 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
Step 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;  Step 8: Once the above duplicate is 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 archives on standby.
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#; Now you have successfully done Oracle 19c Data Guard Configuration.
Read - Use RMAN in NOARCHIVE
Connect with me on:
Instagram: https://www.instagram.com/shripaldba
Linkedin: https://www.linkedin.com/in/shripal-singh
Twitter: https://twitter.com/ocptechnology
Facebook: https://www.facebook.com/ocptechnology
YouTube:https://www.youtube.com/ocptechnology
					
			
RMAN-11003: failure during parse/execution of SQL statement: alter database mount standby database
ORA-01103: database name ‘UAT’ in control file is not ‘UATDR’
UAT is my primary and UATDR is my standby
Bro you have to create define db_unique_name in pfile then try.
If you still facing issue please come on Instagram, direct chat with me.
Instagram @ocptechnology
The service_name is DB_name so in tnsnames both servers must be OCP against Service_name.
no, use db_unique_name as service name.