SlideShare a Scribd company logo
1 of 25
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Using Oracle Active Data Guard
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 2
Objectives
After completing this lesson, you should be able to:
• Use Real-time Query to access data on a physical standby
database
• Enable RMAN block change tracking for a physical
standby database
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 3
Oracle Active Data Guard
• Is an option for Oracle Database 11g Enterprise Edition
• Enhances quality of service by offloading resource-
intensive activities from a production database to a
standby database
• Includes the following features:
– Real-time query
– RMAN block change tracking on a physical standby
database
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 4
Using Real-Time Query
Physical standby
database
Primary
database
Redo
apply
Redo
stream
Redo
transport
Queries
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 5
Enabling Real-Time Query
1. Verify that real-time query mode is not enabled:
2. Open the database for read-only access:
3. Verify that real-time query mode is now enabled:
DGMGRL> show database pc01sby1
DGMGRL> show database pc01sby1
SQL> ALTER DATABASE OPEN READ ONLY;
Database altered.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 7
Disabling Real-Time Query
1. Shut down the standby database instance.
2. Restart the standby database instance in MOUNT mode.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 8
Checking the Standby’s Open Mode
• A physical standby database opened in read-only mode:
• A physical standby database opened in real-time query
mode:
SQL> SELECT open_mode FROM V$DATABASE;
OPEN_MODE
--------------------
READ ONLY
SQL> SELECT open_mode FROM V$DATABASE;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 9
Understanding Lag in an Active Data Guard
Configuration
• A standby database configured with real-time apply can
lag behind the primary database as a result of:
– Insufficient CPU capacity
– High network latency
– Limited bandwidth
• Queries on the standby database need to return current
results and/or be within an established service level.
• Ways to “manage” the standby database lag and take
necessary action:
– Configure Data Guard configuration with a maximum data
lag that will trigger an error when it is exceeded.
– Monitor the redo apply lag and take action when the lag is
unacceptable.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 10
Monitoring Apply Lag: V$DATAGUARD_STATS
• Apply lag: This is the difference, in elapsed time, between
when the last applied change became visible on the
standby and when that same change was first visible on
the primary.
• The apply lag row of the V$DATAGUARD_STATS view
reflects statistics that are computed periodically and to the
nearest second.
SQL> SELECT name, value, datum_time, time_computed
2> FROM v$dataguard_stats
3> WHERE name like 'apply lag';
NAME VALUE DATUM_TIME TIME_COMPUTED
--------- ------------- -------------------- --------------------
apply lag +00 00:00:00 27-MAY-2009 08:54:16 27-MAY-2009 08:54:17
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 11
Monitoring Apply Lag:
V$STANDBY_EVENT_HISTOGRAM
• View histogram of apply lag on a physical standby
database.
• Use to assess value for STANDBY_MAX_DATA_DELAY.
• Use to focus on periods of time when the apply lag
exceeds desired levels so that issue can be resolved.
SQL> SELECT * FROM V$STANDBY_EVENT_HISTOGRAM
2> WHERE NAME = 'apply lag' AND COUNT > 0;
NAME TIME UNIT COUNT LAST_TIME_UPDATED
--------- --------- -------- ----------- ------------------------
apply lag 0 seconds 79681 06/18/2009 10:05:00
apply lag 1 seconds 1006 06/18/2009 10:03:56
apply lag 2 seconds 96 06/18/2009 09:51:06
apply lag 3 seconds 4 06/18/2009 04:12:32
apply lag 4 seconds 1 06/17/2009 11:43:51
apply lag 5 seconds 1 06/17/2009 11:43:52
6 rows selected
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 12
Setting a Predetermined Service Level for
Currency of Standby Queries
• STANDBY_MAX_DATA_DELAY session parameter:
Specifies a session-specific limit for the amount of time (in
seconds) allowed to elapse between when changes are
committed on the primary and when those same changes
can be queried on the standby database
• If the limit is exceeded, an error message is returned:
ORA-3172 STANDBY_MAX_DATA_DELAY has been exceeded
• This setting is ignored for the SYS user.
ALTER SESSION
SET STANDBY_MAX_DATA_DELAY = {INTEGER|NONE}
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 13
Configuring Zero Lag Between the Primary and
Standby Databases
• Certain applications have zero tolerance for any lag.
• Query on the standby database must return the same
result as though it were executed on the primary database.
• Enforce by setting STANDBY_MAX_DATA_DELAY to 0.
• The standby database must have advanced to a value
equal to that of the current SCN on the primary database
at the time the query was issued.
• Results are guaranteed to be the same as the primary
database, else ORA-3172 error is returned to the query.
• The primary database must operate in maximum
availability or maximum protection mode.
• SYNC must be specified for redo transport.
• Real-time query must be enabled.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 14
Setting STANDBY_MAX_DATA_DELAY by Using an
AFTER LOGON Trigger
Create an AFTER LOGON trigger that:
• Is database role aware
– It uses DATABASE_ROLE, a new attribute in the USERENV
context.
– SQL and PL/SQL clients can retrieve the database role
programmatically using the SYS_CONTEXT function.
– It enables you to write role-specific triggers.
• Sets STANDBY_MAX_DATA_DELAY when the application
logs on to a real-time query–enabled standby database
• Allows for configuration of a maximum data delay without
changing the application source code
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 15
Example: Setting STANDBY_MAX_DATA_DELAY by
Using an AFTER LOGON Trigger
CREATE OR REPLACE TRIGGER sla_logon_trigger
AFTER LOGON
ON APP.SCHEMA
BEGIN
IF (SYS_CONTEXT('USERENV', 'DATABASE_ROLE')
IN ('PHYSICAL STANDBY'))
THEN execute immediate
'alter session set standby_max_data_delay=5';
ENDIF;
END;
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 16
Forcing Redo Apply Synchronization
• The ALTER SESSION SYNC WITH PRIMARY command:
– Performs a blocking wait on the standby database upon
execution
– Blocks the application until the standby database is in sync
with the primary database as of the time this command is
executed
• When the ALTER SESSION SYNC WITH PRIMARY
command returns control, the session can continue to
process queries without having to wait for standby redo
apply.
• An ORA-3173 Standby may not be synced with
primary error is returned if redo apply is not active or is
canceled before the standby database is in sync with the
primary database as of the time this command is executed.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 17
Creating an AFTER LOGON Trigger for
Synchronization
• Use an AFTER LOGON trigger to force a wait for
synchronization between primary and standby databases.
• Use for dedicated connection only.
• This ensures that the reporting application starts with the
current data without requiring a change to the application
source code.
CREATE TRIGGER adg_logon_sync_trigger
AFTER LOGON ON user.schema
BEGIN
IF (SYS_CONTEXT('USERENV','DATABASE_ROLE') IN
('PHYSICAL STANDBY'))
THEN
execute immediate 'alter session sync with primary';
END IF;
END;
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 18
Supporting Read-Mostly Applications
• Read-mostly applications are predominantly read-only
applications, but require limited read-write database
access.
• Active Data Guard supports the read-only portion of read-
mostly applications if writes are redirected to the primary
database or a local database.
• Redirection of read-write workload does not require
application code changes.
• Writes can be transparently redirected to the primary
database if the application adheres to the following:
– Modified objects must not be qualified by a schema name.
– SQL commands must be issued directly from the client, not
in stored procedures.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 19
Example: Transparently Redirecting Writes to the
Primary Database
• Application characteristics:
– Executes as user U
– Reads table U.R (R) and writes to table U.W (W)
– User S has S.R synonym for U.R and S.W synonym for
U.W@primary.
• Create an AFTER LOGON trigger on the standby database:
CREATE TRIGGER adg_logon_switch_schema_trigger
AFTER LOGON ON u.schema
BEGIN
IF (SYS_CONTEXT('USERENV','DATABASE_ROLE')
IN ('PHYSICAL STANDBY'))
THEN
execute immediate
'alter session set current_schema = S';
END IF;
END;
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 20
Enabling Block Change Tracking
on a Physical Standby Database
• Enable block change tracking on a physical standby
database for fast incremental backups.
• Data file blocks that are affected by each database update
are tracked in a block change tracking file.
• The block change tracking file is a binary file used by
RMAN to record changed blocks to improve incremental
backup performance.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 21
Creating Fast Incremental Backups
• Block change tracking optimizes incremental backups:
– Tracks the blocks that have changed since the last backup
• Oracle Database has integrated change tracking:
– A change tracking file is used.
– Changed blocks are tracked as redo is generated.
– Database backup automatically uses the changed-block list.
List of changed
blocks
Redo
generation
Redo log
1011001010110
0001110100101
1010101110011
Change-
tracking
file
SGA
CTWR
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 22
Enabling Block Change Tracking
ALTER DATABASE
{ENABLE|DISABLE} BLOCK CHANGE TRACKING
[USING FILE '...']
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 23
Monitoring Block Change Tracking
SQL> SELECT filename, status, bytes
2 FROM v$block_change_tracking;
SQL> SELECT file#, avg(datafile_blocks),
2 avg(blocks_read),
3 avg(blocks_read/datafile_blocks)
4 * 100 AS PCT_READ_FOR_BACKUP,
5 avg(blocks)
5 FROM v$backup_datafile
6 WHERE used_change_tracking = 'YES'
7 AND incremental_level > 0
8 GROUP BY file#;
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 24
Quiz
The STANDBY_MAX_DATA_DELAY parameter can be set at the
system level.
a. True
b. False
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 25
Summary
In this lesson, you should have learned how to:
• Use Real-time Query to access a physical standby
database
• Enable block change tracking on a physical standby
database
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
8 - 26
Practice 8: Overview
This practice covers the following topics:
• Using Real-time Query
• Enabling block change tracking

More Related Content

Similar to less08.ppt

D17316 gc20 l06_dataprot_logtrans
D17316 gc20 l06_dataprot_logtransD17316 gc20 l06_dataprot_logtrans
D17316 gc20 l06_dataprot_logtransMoeen_uddin
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Glen Hawkins
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2Mario Redón Luz
 
Oracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAOracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAXoom Trainings
 
Data guard architecture
Data guard architectureData guard architecture
Data guard architectureVimlendu Kumar
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseParesh Patel
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1Ram Naani
 
Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Emre Baransel
 
Top 20 FAQs on the Autonomous Database
Top 20 FAQs on the Autonomous DatabaseTop 20 FAQs on the Autonomous Database
Top 20 FAQs on the Autonomous DatabaseSandesh Rao
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationBerry Clemens
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...NomanKhalid56
 
Oow14 con7681-rman-1
Oow14 con7681-rman-1Oow14 con7681-rman-1
Oow14 con7681-rman-1Dan Glasscock
 
High Volume Payments using Mule
High Volume Payments using MuleHigh Volume Payments using Mule
High Volume Payments using MuleAdhish Pendharkar
 
Rman 12c new_features
Rman 12c new_featuresRman 12c new_features
Rman 12c new_featuresNabi Abdul
 
D17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sqlD17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sqlMoeen_uddin
 

Similar to less08.ppt (20)

D17316 gc20 l06_dataprot_logtrans
D17316 gc20 l06_dataprot_logtransD17316 gc20 l06_dataprot_logtrans
D17316 gc20 l06_dataprot_logtrans
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive
 
Less04_Database_Instance.ppt
Less04_Database_Instance.pptLess04_Database_Instance.ppt
Less04_Database_Instance.ppt
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
 
Oracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAOracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIA
 
Data guard architecture
Data guard architectureData guard architecture
Data guard architecture
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1
 
Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012
 
Top 20 FAQs on the Autonomous Database
Top 20 FAQs on the Autonomous DatabaseTop 20 FAQs on the Autonomous Database
Top 20 FAQs on the Autonomous Database
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentation
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
 
AWR, ASH with EM13 at HotSos 2016
AWR, ASH with EM13 at HotSos 2016AWR, ASH with EM13 at HotSos 2016
AWR, ASH with EM13 at HotSos 2016
 
Data guard oracle
Data guard oracleData guard oracle
Data guard oracle
 
Oow14 con7681-rman-1
Oow14 con7681-rman-1Oow14 con7681-rman-1
Oow14 con7681-rman-1
 
High Volume Payments using Mule
High Volume Payments using MuleHigh Volume Payments using Mule
High Volume Payments using Mule
 
Rman 12c new_features
Rman 12c new_featuresRman 12c new_features
Rman 12c new_features
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
D17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sqlD17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sql
 
Les 12 fl_db
Les 12 fl_dbLes 12 fl_db
Les 12 fl_db
 

More from منیزہ ہاشمی

Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdf
Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdfImprove_Application_Availability_and_Performance_Sales_Crib_Sheet.pdf
Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdfمنیزہ ہاشمی
 
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdf
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdfSolution_Use_Case_-_DDoS_Incident_Monitoring.pdf
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdfمنیزہ ہاشمی
 
Solution_Use_Case_-_CDN_Performance_Monitoring.pdf
Solution_Use_Case_-_CDN_Performance_Monitoring.pdfSolution_Use_Case_-_CDN_Performance_Monitoring.pdf
Solution_Use_Case_-_CDN_Performance_Monitoring.pdfمنیزہ ہاشمی
 
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdf
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdfSolution_Use_Case_-_Collaboration_Services_Monitoring.pdf
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdfمنیزہ ہاشمی
 
97 Things Every Cloud Engineer Should Know.pdf
97 Things Every Cloud Engineer Should Know.pdf97 Things Every Cloud Engineer Should Know.pdf
97 Things Every Cloud Engineer Should Know.pdfمنیزہ ہاشمی
 

More from منیزہ ہاشمی (7)

Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdf
Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdfImprove_Application_Availability_and_Performance_Sales_Crib_Sheet.pdf
Improve_Application_Availability_and_Performance_Sales_Crib_Sheet.pdf
 
Pricing_101_v2.pdf
Pricing_101_v2.pdfPricing_101_v2.pdf
Pricing_101_v2.pdf
 
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdf
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdfSolution_Use_Case_-_DDoS_Incident_Monitoring.pdf
Solution_Use_Case_-_DDoS_Incident_Monitoring.pdf
 
Pricing_103_-_services.pdf
Pricing_103_-_services.pdfPricing_103_-_services.pdf
Pricing_103_-_services.pdf
 
Solution_Use_Case_-_CDN_Performance_Monitoring.pdf
Solution_Use_Case_-_CDN_Performance_Monitoring.pdfSolution_Use_Case_-_CDN_Performance_Monitoring.pdf
Solution_Use_Case_-_CDN_Performance_Monitoring.pdf
 
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdf
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdfSolution_Use_Case_-_Collaboration_Services_Monitoring.pdf
Solution_Use_Case_-_Collaboration_Services_Monitoring.pdf
 
97 Things Every Cloud Engineer Should Know.pdf
97 Things Every Cloud Engineer Should Know.pdf97 Things Every Cloud Engineer Should Know.pdf
97 Things Every Cloud Engineer Should Know.pdf
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

less08.ppt

  • 1. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Using Oracle Active Data Guard
  • 2. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 2 Objectives After completing this lesson, you should be able to: • Use Real-time Query to access data on a physical standby database • Enable RMAN block change tracking for a physical standby database
  • 3. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 3 Oracle Active Data Guard • Is an option for Oracle Database 11g Enterprise Edition • Enhances quality of service by offloading resource- intensive activities from a production database to a standby database • Includes the following features: – Real-time query – RMAN block change tracking on a physical standby database
  • 4. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 4 Using Real-Time Query Physical standby database Primary database Redo apply Redo stream Redo transport Queries
  • 5. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 5 Enabling Real-Time Query 1. Verify that real-time query mode is not enabled: 2. Open the database for read-only access: 3. Verify that real-time query mode is now enabled: DGMGRL> show database pc01sby1 DGMGRL> show database pc01sby1 SQL> ALTER DATABASE OPEN READ ONLY; Database altered.
  • 6. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 7 Disabling Real-Time Query 1. Shut down the standby database instance. 2. Restart the standby database instance in MOUNT mode.
  • 7. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 8 Checking the Standby’s Open Mode • A physical standby database opened in read-only mode: • A physical standby database opened in real-time query mode: SQL> SELECT open_mode FROM V$DATABASE; OPEN_MODE -------------------- READ ONLY SQL> SELECT open_mode FROM V$DATABASE; OPEN_MODE -------------------- READ ONLY WITH APPLY
  • 8. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 9 Understanding Lag in an Active Data Guard Configuration • A standby database configured with real-time apply can lag behind the primary database as a result of: – Insufficient CPU capacity – High network latency – Limited bandwidth • Queries on the standby database need to return current results and/or be within an established service level. • Ways to “manage” the standby database lag and take necessary action: – Configure Data Guard configuration with a maximum data lag that will trigger an error when it is exceeded. – Monitor the redo apply lag and take action when the lag is unacceptable.
  • 9. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 10 Monitoring Apply Lag: V$DATAGUARD_STATS • Apply lag: This is the difference, in elapsed time, between when the last applied change became visible on the standby and when that same change was first visible on the primary. • The apply lag row of the V$DATAGUARD_STATS view reflects statistics that are computed periodically and to the nearest second. SQL> SELECT name, value, datum_time, time_computed 2> FROM v$dataguard_stats 3> WHERE name like 'apply lag'; NAME VALUE DATUM_TIME TIME_COMPUTED --------- ------------- -------------------- -------------------- apply lag +00 00:00:00 27-MAY-2009 08:54:16 27-MAY-2009 08:54:17
  • 10. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 11 Monitoring Apply Lag: V$STANDBY_EVENT_HISTOGRAM • View histogram of apply lag on a physical standby database. • Use to assess value for STANDBY_MAX_DATA_DELAY. • Use to focus on periods of time when the apply lag exceeds desired levels so that issue can be resolved. SQL> SELECT * FROM V$STANDBY_EVENT_HISTOGRAM 2> WHERE NAME = 'apply lag' AND COUNT > 0; NAME TIME UNIT COUNT LAST_TIME_UPDATED --------- --------- -------- ----------- ------------------------ apply lag 0 seconds 79681 06/18/2009 10:05:00 apply lag 1 seconds 1006 06/18/2009 10:03:56 apply lag 2 seconds 96 06/18/2009 09:51:06 apply lag 3 seconds 4 06/18/2009 04:12:32 apply lag 4 seconds 1 06/17/2009 11:43:51 apply lag 5 seconds 1 06/17/2009 11:43:52 6 rows selected
  • 11. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 12 Setting a Predetermined Service Level for Currency of Standby Queries • STANDBY_MAX_DATA_DELAY session parameter: Specifies a session-specific limit for the amount of time (in seconds) allowed to elapse between when changes are committed on the primary and when those same changes can be queried on the standby database • If the limit is exceeded, an error message is returned: ORA-3172 STANDBY_MAX_DATA_DELAY has been exceeded • This setting is ignored for the SYS user. ALTER SESSION SET STANDBY_MAX_DATA_DELAY = {INTEGER|NONE}
  • 12. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 13 Configuring Zero Lag Between the Primary and Standby Databases • Certain applications have zero tolerance for any lag. • Query on the standby database must return the same result as though it were executed on the primary database. • Enforce by setting STANDBY_MAX_DATA_DELAY to 0. • The standby database must have advanced to a value equal to that of the current SCN on the primary database at the time the query was issued. • Results are guaranteed to be the same as the primary database, else ORA-3172 error is returned to the query. • The primary database must operate in maximum availability or maximum protection mode. • SYNC must be specified for redo transport. • Real-time query must be enabled.
  • 13. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 14 Setting STANDBY_MAX_DATA_DELAY by Using an AFTER LOGON Trigger Create an AFTER LOGON trigger that: • Is database role aware – It uses DATABASE_ROLE, a new attribute in the USERENV context. – SQL and PL/SQL clients can retrieve the database role programmatically using the SYS_CONTEXT function. – It enables you to write role-specific triggers. • Sets STANDBY_MAX_DATA_DELAY when the application logs on to a real-time query–enabled standby database • Allows for configuration of a maximum data delay without changing the application source code
  • 14. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 15 Example: Setting STANDBY_MAX_DATA_DELAY by Using an AFTER LOGON Trigger CREATE OR REPLACE TRIGGER sla_logon_trigger AFTER LOGON ON APP.SCHEMA BEGIN IF (SYS_CONTEXT('USERENV', 'DATABASE_ROLE') IN ('PHYSICAL STANDBY')) THEN execute immediate 'alter session set standby_max_data_delay=5'; ENDIF; END;
  • 15. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 16 Forcing Redo Apply Synchronization • The ALTER SESSION SYNC WITH PRIMARY command: – Performs a blocking wait on the standby database upon execution – Blocks the application until the standby database is in sync with the primary database as of the time this command is executed • When the ALTER SESSION SYNC WITH PRIMARY command returns control, the session can continue to process queries without having to wait for standby redo apply. • An ORA-3173 Standby may not be synced with primary error is returned if redo apply is not active or is canceled before the standby database is in sync with the primary database as of the time this command is executed.
  • 16. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 17 Creating an AFTER LOGON Trigger for Synchronization • Use an AFTER LOGON trigger to force a wait for synchronization between primary and standby databases. • Use for dedicated connection only. • This ensures that the reporting application starts with the current data without requiring a change to the application source code. CREATE TRIGGER adg_logon_sync_trigger AFTER LOGON ON user.schema BEGIN IF (SYS_CONTEXT('USERENV','DATABASE_ROLE') IN ('PHYSICAL STANDBY')) THEN execute immediate 'alter session sync with primary'; END IF; END;
  • 17. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 18 Supporting Read-Mostly Applications • Read-mostly applications are predominantly read-only applications, but require limited read-write database access. • Active Data Guard supports the read-only portion of read- mostly applications if writes are redirected to the primary database or a local database. • Redirection of read-write workload does not require application code changes. • Writes can be transparently redirected to the primary database if the application adheres to the following: – Modified objects must not be qualified by a schema name. – SQL commands must be issued directly from the client, not in stored procedures.
  • 18. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 19 Example: Transparently Redirecting Writes to the Primary Database • Application characteristics: – Executes as user U – Reads table U.R (R) and writes to table U.W (W) – User S has S.R synonym for U.R and S.W synonym for U.W@primary. • Create an AFTER LOGON trigger on the standby database: CREATE TRIGGER adg_logon_switch_schema_trigger AFTER LOGON ON u.schema BEGIN IF (SYS_CONTEXT('USERENV','DATABASE_ROLE') IN ('PHYSICAL STANDBY')) THEN execute immediate 'alter session set current_schema = S'; END IF; END;
  • 19. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 20 Enabling Block Change Tracking on a Physical Standby Database • Enable block change tracking on a physical standby database for fast incremental backups. • Data file blocks that are affected by each database update are tracked in a block change tracking file. • The block change tracking file is a binary file used by RMAN to record changed blocks to improve incremental backup performance.
  • 20. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 21 Creating Fast Incremental Backups • Block change tracking optimizes incremental backups: – Tracks the blocks that have changed since the last backup • Oracle Database has integrated change tracking: – A change tracking file is used. – Changed blocks are tracked as redo is generated. – Database backup automatically uses the changed-block list. List of changed blocks Redo generation Redo log 1011001010110 0001110100101 1010101110011 Change- tracking file SGA CTWR
  • 21. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 22 Enabling Block Change Tracking ALTER DATABASE {ENABLE|DISABLE} BLOCK CHANGE TRACKING [USING FILE '...']
  • 22. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 23 Monitoring Block Change Tracking SQL> SELECT filename, status, bytes 2 FROM v$block_change_tracking; SQL> SELECT file#, avg(datafile_blocks), 2 avg(blocks_read), 3 avg(blocks_read/datafile_blocks) 4 * 100 AS PCT_READ_FOR_BACKUP, 5 avg(blocks) 5 FROM v$backup_datafile 6 WHERE used_change_tracking = 'YES' 7 AND incremental_level > 0 8 GROUP BY file#;
  • 23. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 24 Quiz The STANDBY_MAX_DATA_DELAY parameter can be set at the system level. a. True b. False
  • 24. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 25 Summary In this lesson, you should have learned how to: • Use Real-time Query to access a physical standby database • Enable block change tracking on a physical standby database
  • 25. Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 8 - 26 Practice 8: Overview This practice covers the following topics: • Using Real-time Query • Enabling block change tracking