Working with Oracle Data Guard
Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data. The Oracle Cloud Infrastructure Database Data Guard implementation requires two databases: one in a primary role and one in a standby role. The two databases make an Oracle Data Guard association. Most of your applications access the primary database, while the standby database is a transactionally consistent copy of the primary database.
Oracle Data Guard maintains the standby database by transmitting and applying redo data from the primary database. If the primary database becomes unavailable, then you can use Oracle Data Guard to switch or failover the standby database to the primary role.
Switchover
A switchover reverses the primary and standby database roles. Each database continues to participate in the Oracle Data Guard Association in its new role. A switchover ensures no data loss. Performing planned maintenance on a DB system with an Oracle Data Guard association is typically done by switching the primary database to the standby role, performing maintenance on the standby database, and then switching it back to the primary role.
Failover
A failover transitions the standby database into the primary role after the existing primary database fails or becomes unreachable. A failover might result in some data loss when you use Maximum Performance protection mode.
Reinstate
Reinstates a database into the standby role in an Oracle Data Guard association. You can use the reinstate command to return a failed database into service after correcting the cause of the failure.
In this post, we will see how to configure data guard with RAC on OCI.
Assumption: Oracle RAC database is already installed and configured on OCI.
1. Click on Displa Name: DBSVM
2. Click on Databases on Resources in left side pane. Then click on Database Name –> SKANTORC.
3. Click on Data Guard Association on Resources in left side pane. Then click on Enable Data Guard button.
4. As shown in the below image. Provide all the information.
- Display Name: SKANTDRVM
- Availability Domain: aXWk:US-ASHBURN-AD-1
- Shape: VM.Standard2.2
- Client Subnet: Public Subnet-SKANTVCN(regional)
- Hostname Prefix : SKANTDR
- Protection Mode is Maximum Performance by default. The Console supports only Maximum Performance.
- The redo transport type used for this Data Guard association. The Console supports only Async.
- Provide admin password
- Click on Enable Data Guard.
After some time, data guard has been created.
5. Click on the Display Name for Data Guard: SKANTDRVM
6. Now, use the private key and public IP of any node and connect to server with OPC user for getting the more details.
login as: opc Authenticating with public key "rsa-key-20200220" $ sudo su - oracle Last login: Fri Feb 28 02:51:45 UTC 2020
$ ps -ef|grep pmon oracle 12510 1 0 Feb27 ? 00:00:02 ora_pmon_SKANTORC1 grid 71169 1 0 Feb27 ? 00:00:02 asm_pmon_+ASM1 grid 80533 1 0 Feb27 ? 00:00:01 apx_pmon_+APX1 oracle 99783 99546 0 02:53 pts/0 00:00:00 grep --color=auto pmon
$ sqlplus / as sysdba Connected to: Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production Version 19.5.0.0.0 SQL> select NAME,INSTANCE_NAME,HOST_NAME,OPEN_MODE,LOG_MODE,DATABASE_ROLE,CREATED from gv$database d ,gv$instance i where d.inst_id=i.inst_id; SQL> set lines 200 pages 200 NAME INSTANCE_NAME HOST_NAME OPEN_MODE LOG_MODE DATABASE_ROLE CREATED --------- ---------------- ---------------------------------------------------------------- -------------------- ------------ ---------------- --------- SKANTORC SKANTORC1 skantdr1 READ ONLY WITH APPLY ARCHIVELOG PHYSICAL STANDBY 27-FEB-20 SKANTORC SKANTORC2 skantdr2 READ ONLY WITH APPLY ARCHIVELOG PHYSICAL STANDBY 27-FEB-20 SQL> exit Disconnected from Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production Version 19.5.0.0.0
$ dgmgrl / DGMGRL for Linux: Release 19.0.0.0.0 - Production on Fri Feb 28 02:55:28 2020 Version 19.5.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected to "SKANTORC_iad134" Connected as SYSDG. DGMGRL> show configuration Configuration - SKANTORC_iad19m_SKANTORC_iad13 Protection Mode: MaxPerformance Members: SKANTORC_iad19m - Primary database SKANTORC_iad134 - Physical standby database Fast-Start Failover: Disabled Configuration Status: SUCCESS (status updated 103 seconds ago) DGMGRL> exit
Diagnostic Information needs to collect in case of failure in the Data Guard Association
Primary DB system
- dbcli list-jobs
- dbcli describe-job -id [job id of all jobs related to DG Config Service creation]
- All logs in /opt/oracle/dcs/log/.
- The OCID of Primary DB system
Standby DB system
- dbcli list-jobs
- dbcli describe-job -id [job id of all jobs related to DG Config Service creation]
- dbcli describe-job -id [job id of Database service creation with db name:[db name]]
- All logs in /opt/oracle/dcs/log/*.*
- RMAN log file in /opt/oracle/dcs/log/
/rman/bkup/*.log - The OCID of Standby DB system
All the activities logged in the dcs agent log file which is located in /opt/oracle/dcs/log/dcs-agent*.log. The rman duplicate command activity is logged in /opt/oracle/dcs/log/scoredr/rman/bkup/[yyyy-mm-dd]/rman_yyyy_mm_dd_[timestamp].log