What Is Data Guard
Oracle Data Guard delivers high availability, data protection, and disaster recovery for the enterprise data.
Data Guard configuration consists of one production database, having primary role, and one or more standby databases, having standby roles.
Standby database can take over the production service either for planned or unplanned outages.
Apart from that it can be used for offloading the reporting and backup operations from production.
The databases in a Data Guard configuration are connected by Oracle Net and might be arranged geographically.
There are no strict network requirements for the databases to be in the same subnet and etc. It could be LAN, WAN or internet connection.
Data Guard configuration and control could be managed via:
- SQL command line interface;
- Data Guard Broker interface: using DGMRL for command line interface and GUI delivered via Oracle Enterprise Manager. Data Guard broker tool is included in Enterprise edition license. This tool provides simplified and automatic data guard maintenance and configuration procedures. How to use it I will describe later in this article.
Oracle Data Guard could be deployed among different platforms(x86, Power, Itanium, SPARC), Operating systems(32/64 bit) and Oracle software versions (32/64bit) with limitations.
Check This notes : 413484.1 and 1085687.1 On MOS.
Data Guard deployment examples
Examples provided here are using fast start failover technology for automatic failover operations.
Without fast start failover in place all failover operations must be performed manually.
The depiction of solution above demonstrates high level HA ready deployment leveraging fast start fail-over configuration and active data guard option on physical standby for reporting&queries.
Here observer is data guard broker executable utility, used in fast start failover configurations, which could run on either laptop, server or workstation.
Disaster ready setup
The depiction of solution below demonstrates high level DR ready deployment leveraging fast start failover configuration and logical standby for reporting&queries. As depicted it involves 3 different sites to provide desired functionality. Although it is not intended to provide reporting services in case of Site A outage, it could be done by putting additional standby server in site B though.
Standby databases overview
Data Guard provides three different types of standby databases:
- Physical standby. This is physically identical copy of primary database compared on block level. All database physical and logical structures like data files, schemas are the same. Standby database is synchronized through Redo Apply mechanism, which delivers redo data and applies it on the physical standby database. For such purpose so called standby redo logs are used in standby which are providing similar functionality as online redo logs.
- Logical standby. This type of database contains only the same logical information as the production database, but the physical structure of the data can be different, like different data file organization and etc. The logical standby database is synchronized through SQL Apply mechanism, which first transforms the data, in the redo received, into SQL statements – DML’s and DDL’s – and then executes them on the standby. Here LogMiner component of SQL Apply is used. Standby databases are functioning in read write mode.
- Snapshot standby. This type of physical standby database appeared first with 11g release. It is more like a data guard mode than a different configuration. The only difference from latter ones, when enabled it is fully operational – read and write mode – production database copy, where users can access and perform any data manipulations. Meantime redo data is being received from the primary database, archived, but not applied until snapshot standby database is reverted back to the physical standby database.
- Starting with Oracle database release 11g there is new active data guard feature which allows reporting and queries while redo apply is active on physical standby. This data guard option must be purchased as add-on to Enterprise edition license.
- Can be used to offload backup operations from production server.
- Supports all database datatypes, types of tables, DDL and DML operations
* Logical standby
- Typically is used for reporting and queries while sql apply is active on logical standby.
- Could be used for database upgrades with minimal downtime.
- Can maintain other database objects not belonging to primary database.
- Logical standby database has limitation on support of datatypes, types of tables, DDL and DML operations.
Data Guard protection modes
Databases running with Data Guard implemented could be configured to act differently when primary server outage is taking place.
Default protection mode. This protection mode provides maximum protection without affecting primary database performance. Here transactions on primary are committed as soon as redo log is filled with all relevant redo data without waiting for write accomplishment from standby databases – it is being done asynchronously. Therefore such protection mode does not guarantee complete data restore until last transaction.
This protection mode guarantees that no data loss will occur if primary database fails. Transactions do not commit until all relevant redo data is written in redo and standby redo logs of standby database. In such configuration standby database is kept completely synchronized with primary. In case of standby database outage or whatever reasons preventing to write/send redo data into standby locations, primary database is kept running to preserver availability.
This protection mode guarantees that no data loss will occur if primary database fails. The only difference from the Maximum Availability mode is that if primary database cannot write/send redo data into standby database locations it will be shutdown. Since such configuration prioritizes data protection over primary database’s availability, the recommended deployment is to have at least several standby databases.
How to enable, change protection modes
from SQLPlus on primary :
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY/PERFORMANCE/PROTECTION;
from Data Guard broker command line interface :
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY/MAXPROTECTION/MAXPERFORMANCE;