Setting up Data Guard on FlashGrid-enabled clusters does not differ from ordinary setup. Only couple of files that should be configured accordingly will be described in this documentation.
Initialization Parameters
In addition to Data Guard specific initialization parameters, set LOCAL_LISTENER
parameter to NodeFQDN
on source database and keep it the same on the target database.
SQL> alter system set local_listener='NodeFQDN';
Make sure that remote_listener
parameter indicates the information about SCAN listener:
On the primary side:
remote_listener='primrac-scan.example.com:1521'
On the standby side:
remote_listener='stbyrac-scan.example.com:1521'
Oracle Net files
Make sure you have primary and standby node hostnames and SCAN address on DNS servers.
For example:
Primary side DNS server should contain information about standby side:
stbyrac1.example.com 10.200.0.1 stbyrac2.example.com 10.200.0.2 stbyrac-scan.example.com 10.200.0.1 stbyrac-scan.example.com 10.200.0.2
Standby side DNS entries:
primrac1.example.com 10.100.0.1 primrac2.example.com 10.100.0.2 primrac-scan.example.com 10.100.0.1 primrac-scan.example.com 10.100.0.2
Primary and standby side TNS entries in $ORACLE_HOME/network/admin/tnsnames.ora
should look like the following:
primorcl = (DESCRIPTION = (TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=6) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = primrac-scan.example.com)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = primorcl))) stbyorcl = (DESCRIPTION = (TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=6) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = stbyrac-scan.example.com)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = stbyorcl)))
On the first nodes of primary and standby databases add the following entries temporarily to be able to run duplicate:
primorcl1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = primrac1.example.com)(PORT = 1522)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = primorcl) )) stbyorcl1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = stbyrac1.example.com)(PORT = 1522)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = stbyorcl) ))
To connect to the standby database using RMAN
, when it is started in NOMOUNT
, you need to add the following entry in $GRID_HOME/network/admin/listener.ora
on the first node of the standby database.
Update file as grid user.
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = stbyorcl) (ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1) (SID_NAME = primorcl1) ) )
Reload the listener on standby node1:
$ sudo su – grid
$ lsnrctl reload
RMAN Duplicate
Database can be duplicated from a backup or from an active database.
Backup-based duplicate method:
- Assuming that
/backup
is a shared NFS mountpoint on both sides and primary database backup is already there. - Standby is started in
NOMOUNT
mode
Connect to the auxiliary instance using RMAN and run duplicate command:
[oracle@stbyrac1 ~]$ rman AUXILIARY sys/MySYSPassword@stbyorcl1 RMAN> duplicate target database for standby backup location '/backup' nofilenamecheck;
Active duplicate method:
Connect to the target and auxiliary instances and run duplicate:
[oracle@stbyrac1 ~]$ rman target sys/MySYSPassword@primorcl1 auxiliary sys/MySYSPassword@stbyorcl1 RMAN> duplicate target database for standby from active database nofilenamecheck dorecover;
Create Standby Database using DBCA
It is an alternative to the RMAN Duplicate method above. This method is available starting with Oracle 12.2.
Edit $GRID_HOME/network/admin/listener.ora
on the first node of the standby database:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1) (SID_NAME = stbyorcl1) ) )
Reload the listener on standby node1:
$ sudo su – grid
$ lsnrctl reload
Run DBCA on the first node of the standby database as the oracle user:
dbca -createDuplicateDB -silent \ -gdbName orcl \ -primaryDBConnectionString primrac1.example.com:1522/primorcl \ -sid stbyorcl \ -initParams "dg_broker_start=true" \ -sysPassword Oracle123 \ -adminManaged \ -nodelist stbyrac1,stbyrac2 \ -recoveryAreaDestination +FRA \ -databaseConfigType RAC \ -useOMF true \ -storageType ASM \ -datafileDestination +DATA \ -createAsStandby \ -dbUniqueName stbyorcl \ -createListener stbyrac1.example.com:1522
Remove the SID_LIST_LISTENER entry from $GRID_HOME/network/admin/listener.ora
Remove $ORACLE_HOME/network/admin/listener.ora
created by DBCA.
Configure connect time failover for clients
Add service (e.g. orclservice) on both sides, that will be online on just primary side.
Example of client side TNS entry:
orclsrv =
(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=6)(ADDRESS=(PROTOCOL=TCP)(HOST=primrac1.example.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=primrac2.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclservice)))(DESCRIPTION=(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=6)(ADDRESS=(PROTOCOL=TCP)(HOST=stbyrac1.example.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=stbyrac2.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclservice))))