Skip to main content

Oracle Data Guard brief intro

Why to use Data Guard?

Following are the main reasons why we should configure Data Guard.

1. Data Guard provides HA (high availability), Data protection, disaster recovery.
2. It also provides consistent copies of production database, in case of production database is unavailable (may be planned or unplanned outage), We can convert Standby Database into primary role.
3. It reduces downtime in case of any outage to production environment.
4. Data Guard can also be used for Database Backup (To reduce load on Production Database).


Data Guard Configuration:

1. Data Guard consist of one Primary Database and one or more Standby Database.
2. Databases in a Data Guard are connected by Oracle Net services. There is no restriction on where the databases should be located, provided they can communicate with each other.
3. We can manage Primary Database and Standby Database with SQLPLUS or through Data Guard Command-Line Interface (DGMGRL).


Types of Standby Database:

1. Physical Standby Database.
2. Logical Standby Database.
3. Snapshot Standby Database.
4. Active Standby Database.


Physical Standby Database:

1. It is physically identical to the Primary Database.
2. Physical Standby Database is kept synchronized with the primary database, through REDO APPLY, which receives the redo data from the primary database and applies it to the physical standby database.
3. Physical Standby Database runs in MOUNT state and its control file type is “STANDBY”, which can be seen with the help of below query.
SQL> select name, open_mode, log_mode, database_role, controfile_type from Database;
4. Physical Standby Database can be used for Disaster Recovery and also for Database Backup.


Logical Standby Database:

1. It contains the same logical information as the production database, although the physical structure of the data can be different.
2. Logical standby database is kept synchronized with the primary database through SQL APPLY, which transforms the data in the redo received from the primary database into SQL statements and then executes the SQL statements on the standby database.
3. Logical Standby Database is opened in READ WRITE mode and its control file type is “CURRENT”,
4. It can be used concurrently for data protection, reporting, and database upgrades.


Snapshot Standby Database:


1. It is an unique feature where Physical Standby Database can be opened in READ WRITE mode to perform Application Testing.
2. Snapshot Standby Database receives and archives, but does not apply redo data received from a primary database.
3. Redo data received from the primary database is applied only when Snapshot Standby Database is converted back into Physical Standby Database.
4. Whenever a physical standby database is converted into a snapshot standby database, a guaranteed restore point is automatically created.
5. When we convert back the snapshot standby to physical standby, oracle flashbacks to the restore point that was created earlier which means the transactions which were made in standby database while it was open in READ WRITE mode will be flushed out.
NOTE:  Best practice is to create restore point manually before converting Physical Standby Database to Snapshot Standby Database.


Active Standby Database:

1. Active Data Guard means, the standby database is opened in READ ONLY WITH APPLY mode, even when redo logs are getting applied in real time.
2. All reporting queries can be offloaded to standby database.
3. Physical block corruptions are repaired automatically either at primary or physical standby database.
4. RMAN backups can be initiated from standby, instead of primary which will reduce CPU load from primary.
NOTE :  To use ADG (Active Data Guard), we need additional Oracle License.


Types of Protection Mode:

1. Maximum Protection Mode.
2. Maximum Availability Mode.
3. Maximum Performance Mode. ----- (Default Mode).


Maximum Protection Mode:

1. This protection mode provides max protection with zero data loss.
2. In this mode redo/transaction should be written on online redo logfile and at least one standby logfile before transaction is committed.
3. In case if it fails to write on any one of standby logfile then production will shut down to protect data.

Oracle recommends to have more then one standby database in this protection mode.


Maximum Availability Mode:

1. It provides the highest level of data protection that is possible without affecting the availability of the primary database.
2. Transactions are not allowed to commit until all redo data are written to the online redo logs and propagated to at least one synchronized secondary database.
3. If for any reason, the primary database cannot propagate its redo stream to one secondary database, the primary will NOT shut down and operates as it were in maximum performance mode until issues are fixed.


Maximum Performance Mode:

1. This is the default protection mode.
2. It provides the highest level of data protection that is possible without affecting the performance of the primary database.
3. It allows transaction to commit as soon as redo data is generated and written into online redo logfile.
4. Also redo data stream is also written to at least one standby database which is written in asynchronously.


If you have any doubt on this topic, you can ask in comments. Thanks for reading. :)


Comments