Oracle Training - Day 11
Oracle Training - Day 11
Oracle Data Guard is a robust feature to ensure high availability, disaster recovery, and data
protection for Oracle databases. It maintains standby databases that can take over production
operations in the event of planned maintenance, unexpected outages, or disasters.
Primary Database
• The production database that processes user transactions and handles business operations.
Standby Database
• A copy of the primary database that synchronizes with the primary to stay current. Types
include:
o Logical Standby: Uses SQL apply to replicate changes at the SQL level, allowing it to
be open for queries and reporting.
• Transmits redo data from the primary database to the standby database.
Apply Services
• Applies redo data on the standby database to keep it synchronized with the primary:
• Manages transitions between primary and standby roles, supporting switchover and failover.
• A management and monitoring tool that simplifies setup, configuration, and role transitions.
Prerequisites
2. Network Configuration:
1
o Configure Oracle Net Services (TNS) on both primary and standby servers.
o Update tnsnames.ora with connection details for both primary and standby.
3. Disk Space:
o Ensure sufficient storage is available on the standby server for database files.
rman target /
rman target /
RESTORE CONTROLFILE FROM '/path/to/backup';
RESTORE DATABASE;
RECOVER DATABASE;
DB_UNIQUE_NAME='standby_db'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary_db,standby_db)'
LOG_ARCHIVE_DEST_1='LOCATION=/path/to/archivelogs'
LOG_ARCHIVE_DEST_2='SERVICE=primary_db'
FAL_SERVER='primary_db'
FAL_CLIENT='standby_db'
5. Verify Configuration:
2
3. Role Transition: Switchover and Failover
Switchover
• A planned role reversal between the primary and standby databases without data loss.
Steps:
Failover
• An unplanned role transition to the standby database, typically due to a primary database
failure.
Steps:
2. Initiate failover:
• Problem: Redo logs are not transmitted promptly from primary to standby.
• Solution: Optimize network settings, enable asynchronous redo transport, and monitor
using:
3
• Solution: Increase memory and CPU resources or enable parallel recovery:
• Solution:
1. High Availability:
o Ensures 24/7 availability of the booking system, even during server maintenance.
2. Disaster Recovery:
o Protects ticket booking data from corruption or loss due to natural disasters.
3. Data Protection:
4. Load Balancing:
o Use standby databases for read-heavy operations like flight searches and reporting.
Best Practices
2. Monitor Lags:
o Use OEM or custom scripts to continuously monitor redo transport and apply lags.
3. Automate Configuration:
4. Regular Backups:
o Complement Data Guard with RMAN backups for added data protection.
By implementing Oracle Data Guard effectively, a MODI airline ticket booking system can achieve
continuous availability, protect customer data, and handle unexpected failures without impacting
operations.
4
Oracle Data Guard provides three protection modes to maintain high availability and data protection
based on business requirements. Each mode offers a trade-off between data protection and
performance, allowing you to choose the most suitable mode for your environment.
Description:
This mode guarantees zero data loss. The primary database does not commit a transaction until it
confirms that the redo data has been written to at least one standby database.
How it Works:
• The primary database waits for acknowledgment from the standby database(s) before
completing a commit.
Configuration:
Use Case:
• Ideal for critical systems like financial institutions, stock exchanges, or airline ticketing
systems, where data loss is unacceptable.
Pros:
Cons:
• If no standby database is available, the primary database shuts down to prevent data
inconsistencies.
Description:
This mode prioritizes zero data loss while providing high availability. Transactions are committed only
after ensuring redo data is written to at least one standby database, but the primary database
remains operational if the standby is temporarily unavailable.
How it Works:
• Works similarly to Maximum Protection, but does not shut down the primary if all standbys
are unavailable.
5
• If the standby is unavailable, transactions are temporarily committed locally until the standby
is reachable.
Configuration:
Use Case:
• Suitable for critical systems like airline booking systems, where data loss must be minimized
but availability of the primary system is essential.
Pros:
• High availability: The primary database continues to function even if the standby database is
temporarily down.
Cons:
Description:
This mode prioritizes performance over zero data loss. Transactions are committed on the primary
database without waiting for acknowledgment from the standby database.
How it Works:
• Redo logs are shipped to the standby database asynchronously, ensuring minimal impact on
primary database performance.
Configuration:
Use Case:
• Best suited for systems where performance is critical and some data loss is acceptable, such
as reporting databases or low-priority applications.
Pros:
Cons:
• Potential for data loss if the primary database fails before the redo data is shipped and
applied to the standby.
6
Comparison Table
Impact on
High Medium Low
Performance
Shuts down if no
Primary Availability Remains operational Remains operational
standby
1. Maximum Protection:
o Use this mode for critical ticket booking operations where no data can be lost, such
as during peak travel seasons or when handling large transaction volumes.
2. Maximum Availability:
o Suitable for balancing ticket booking with high availability, ensuring smooth
operation even if one standby temporarily goes offline.
3. Maximum Performance:
o Useful for analytical reporting or ticketing logs, where minor data loss is acceptable
for maintaining better performance.
Each protection mode should be configured based on the business continuity plan and acceptable
trade-offs between performance and data safety.
Scenarios and Solutions for Oracle Data Guard in a MODI Airline Ticket Booking System
Problem:
Redo logs are not transmitted promptly from the primary database to the standby, causing delays in
synchronization.
Cause:
7
Solution:
o Use tools like ping or traceroute to measure latency and identify bottlenecks.
2. Enable Compression:
4. Monitor Gaps:
Problem:
The standby database cannot apply redo logs in real-time, causing data discrepancies.
Cause:
Solution:
1. Parallel Recovery:
2. Increase Memory:
8
Scenario 3: Archive Gap
Problem:
The standby database is missing some archived redo logs, resulting in an incomplete recovery.
Cause:
Solution:
Problem:
A planned switchover from primary to standby fails due to role transition errors.
Cause:
Solution:
1. Verify Synchronization:
9
SELECT DEST_ID, STATUS, ERROR FROM V$ARCHIVE_DEST WHERE TARGET='STANDBY';
4. Retry Switchover:
Problem:
The primary database crashes unexpectedly, requiring a failover to the standby database.
Cause:
Solution:
1. Activate Standby:
o Update the connection strings in the application to point to the new primary
database.
Problem:
The logical standby database starts showing data inconsistencies compared to the primary database.
Cause:
10
Solution:
EXEC DBMS_LOGSTDBY.SKIP_TRANSACTION('transaction_id');
o Rebuild the logical standby from the primary database using data export/import:
Problem:
Data Guard Broker fails to monitor or manage the configuration properly.
Cause:
Solution:
SHOW CONFIGURATION;
Problem:
The standby database becomes unavailable due to hardware failure.
Cause:
11
• Storage or server crash.
Solution:
1. Rebuild Standby:
2. Enable Synchronization:
These scenarios and solutions illustrate how Oracle Data Guard ensures high availability, disaster
recovery, and efficient operations in a mission-critical system like MODI airline ticket booking.
12