Oracle 19C Dataguard installation using Active Duplicate Method
In this blog , we will learn about the oracle 12c dataguard installation using active duplicate method.
We are using oracle enterprise linux as database server
PRIMARY
STANDBY
Hostname :
node1.learnomate.org
node2.learnomate.org
IP
192.168.56.50
192.168.56.60
DB Unique Name
node1
node1
We are assuming that primary database is ready with database installation and we have copied the vmware files to create standby database.
Change the IP address of standby machine using neat command.
Edit the hosts file for both primary and standby server. Add the ip ,hostname entry in hosts file.
Primary Machine hosts file will be like this
1 2 3 4 5 6 7
[oracle@node1 ~]$ cat /etc/hosts Do not remove the following line, or various programs that require network functionality will fail. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.50 node1.learnomate.org node1 192.168.56.60 node2.learnomate.org node2
Standby Machine hosts file will be like this.
1 2 3 4 5 6 7
[oracle@stand ~]$ cat /etc/hosts Do not remove the following line, or various programs that require network functionality will fail. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.50 node1.learnomate.org node1 192.168.56.60 node2.learnomate.org node2
Disable the firewall of both primary and standby machine.
Primary Side Configuration Put the database in archive log mode.
1 2 3 4 5 6 7 8
[oracle@stand ~]$ cat /etc/hosts Do not remove the following line, or various programs that require network functionality will fail. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.50 node1.learnomate.org node1 192.168.56.60 node2.learnomate.org node2
Enable force logging
1
SQL> alter database force logging;
At least one log file available
1
SQL> alter system switchlogfile;
Check the size of online logfile and create same size standby logfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
select GROUP#,THREAD#,SEQUENCE#,bytes/1024/1024,MEMBERS,STATUS from v$log; GROUP# THREAD# SEQUENCE# BYTES/1024/1024 MEMBERS STATUS
1 1 4 200 1 INACTIVE 2 1 5 200 1 ACTIVE 3 1 6 200 1 CURRENT SQL> select member from v$logfile; MEMBER /data/app/oracle/oradata/PRIM/redo03.log /data/app/oracle/oradata/PRIM/redo02.log /data/app/oracle/oradata/PRIM/redo01.log
Check the size of Online Redo log file
1 2 3 4 5 6 7
SQL> select GROUP#,THREAD#,SEQUENCE#,bytes/1024/1024, MEMBERS,STATUS from v$log; GROUP# THREAD# SEQUENCE# BYTES/1024/1024 MEMBERS STATUS
create standby redo logs for switchovers and should be adding one extra. alter database add standby logfile '/data/app/oracle/oradata/PRIM/redo04.log' size 200m; alter database add standby logfile '/data/app/oracle/oradata/PRIM/redo05.log' size 200m; alter database add standby logfile '/data/app/oracle/oradata/PRIM/redo06.log' size 200m; alter database add standby logfile '/data/app/oracle/oradata/PRIM/redo07.log' size 200m;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
SELECT group#, type, member FROM v$logfile WHERE type = 'STANDBY' order by group#; Check DB_NAME & DB_UNIQUE_NAME SQL> show parameter db_name NAME TYPE VALUE NAME
db_name string prim SQL> show parameter db_unique_name TYPE VALUE NAME --------------- ------------ ----------- db_unique_name string prim
set remote archivelog destination for standby & local is in flash_recovery_area.
1
SQL> alter system set log_archive_dest_2= 'service=stand async noaffirm reopen=15 valid_for=(all_logfiles,primary_role) db_unique_name=stand';
The STANDBY_FILE_MANAGEMENT parameter must be set AUTO.
1
SQL>ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
[oracle@test admin]$ tnsping stand TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 05-SEP-2023 09:55:23 Copyright (c) 1997, 2019, Oracle. All rights reserved. Used parameter files: /data/app/oracle/product/19C/dbhome_3/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node2.learnomate.org)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = stand))) TNS-12541: TNS:no listener [oracle@test admin]$ [oracle@test admin]$ [oracle@test admin]$ [oracle@test admin]$ tnsping prim TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 05-SEP-2023 09:55:27 Copyright (c) 1997, 2019, Oracle. All rights reserved. Used parameter files: /data/app/oracle/product/19C/dbhome_3/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node1.learnomate.org)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prim))) OK (0 msec)
Set the log_archive_config parameter
1
SQL> alter system set log_archive_config='dg_config=(prim,stand)';
set remote_login_passwordfile exclusive.
1
SQL> alter system set remote_login_passwordfile='EXCLUSIVE'scope=spfile;
Update the fal_server and fal_client
1 2
SQL> alter system set fal_server='stand'; SQL> alter system set fal_client='prim';
Create pfile from spfile for the standby database
1
SQL> create pfile from spfile;
Move the PFILE,Password file,listener.ora,tnsnames.ora file to standby. Change the name of files as per standby database.