SlideShare a Scribd company logo
1 of 25
Download to read offline
Data Guard:
Additional Benefits apart from DR

Uwe Hesse
uhesse.com
On Twitter: @UweHesse
Blog:

Oracle Certified Master
Senior Principal Instructor at Oracle University
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is Active Data Guard?
•
•
•

Option for Oracle Database 11g Enterprise Edition
Used to offload resource-intensive activities from a
Production Database to a Standby Database
Includes 2 features:
– Real-time query (Main focus of this Presentation)
– Block Change Tracking on a Physical Standby Database

uwe.hesse@oracle.com http://uhesse.com
2

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The initial Data Guard Configuration
•

Primary & Physical Standby with Data Guard Broker:

DGMGRL> show configuration;
Configuration - myconf
Protection Mode: MaxPerformance
Databases:
prima - Primary database
physt - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

uwe.hesse@oracle.com http://uhesse.com
3

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The initial Physical Standby
•

Not yet doing Real-Time Query:

DGMGRL> show database physt
Database - physt
Role:
Intended State:
Transport Lag:
Apply Lag:
Real Time Query:
Instance(s):
physt

PHYSICAL STANDBY
APPLY-ON
0 seconds
0 seconds
OFF

Database Status:
SUCCESS

uwe.hesse@oracle.com http://uhesse.com
4

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Enabling Real-Time Query
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE
OPEN_MODE
---------------- -------------------PHYSICAL STANDBY MOUNTED
SQL> select status from v$managed_standby where process like 'MRP%';
STATUS
-----------APPLYING_LOG
SQL> alter database open;
Database altered.
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE
OPEN_MODE
---------------- -------------------PHYSICAL STANDBY READ ONLY WITH APPLY

uwe.hesse@oracle.com http://uhesse.com
5

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Read-Only OPEN without Real-Time Query:
DGMGRL> edit database physt set state=apply-off;
Succeeded.
DGMGRL> show database physt;
Database - physt
Role:
Intended State:
Transport Lag:
Apply Lag:
Real Time Query:
Instance(s):
physt

PHYSICAL STANDBY
APPLY-OFF
0 seconds
0 seconds
OFF

Database Status:
SUCCESS

SQL> select database_role,open_mode from v$database;
DATABASE_ROLE

OPEN_MODE

---------------- -------------------PHYSICAL STANDBY READ ONLY

uwe.hesse@oracle.com http://uhesse.com
6

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Client Connectivity & Active Data Guard
•
•

We need to get our Clients connected appropriately
That is done via services:
– One for the Primary (prod)
– One for the Standby (ronly)

•

We take Role Transitions into account with an Event
Trigger

uwe.hesse@oracle.com http://uhesse.com
7

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Creation of Services for Active Data Guard

●

On the Primary:

begin
dbms_service.create_service(service_name=>'prod',
network_name=>'prod');
dbms_service.start_service(service_name=>'prod');
end;
/
begin
dbms_service.create_service(service_name=>'ronly',
network_name=>'ronly');
end;
/

●

On the Standby:

begin
dbms_service.start_service(service_name=>'ronly');
end;
/

uwe.hesse@oracle.com http://uhesse.com
8

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Creation of the Event Trigger
for Service Management
create or replace trigger service_management
after startup on database
declare
vrole varchar(30);
vopen_mode varchar(30);
begin
select database_role into vrole from v$database;
select open_mode into vopen_mode from v$database;
if vrole = 'PRIMARY' then begin
dbms_service.start_service ('prod');
dbms_service.stop_service ('ronly');
end;
elsif vrole = 'PHYSICAL STANDBY' then begin
if vopen_mode like 'READ ONLY%' then
dbms_service.start_service ('ronly');
end if;
dbms_service.stop_service ('prod');
end;
end if;
end;
/

uwe.hesse@oracle.com http://uhesse.com
9

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Local Naming Method for Active Data Guard
●

Connect Descriptors in the tnsnames.ora:

PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = uhesse1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = uhesse2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prod)
)
)
RONLY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = uhesse1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = uhesse2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ronly)
)
)

uwe.hesse@oracle.com http://uhesse.com
10

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Implement TAF for Active Data Guard
●

On the Primary (reaches Standby via Redo-Apply):

begin
dbms_service.modify_service
(service_name=>'prod',
failover_method => 'BASIC',
failover_type => 'SELECT',
failover_retries => 200,
failover_delay => 1);
end;
/
begin
dbms_service.modify_service
(service_name=>'ronly',
failover_method => 'BASIC',
failover_type => 'SELECT',
failover_retries => 200,
failover_delay => 1);
end;
/

uwe.hesse@oracle.com http://uhesse.com
11

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Check Session Details with SYS_CONTEXT
●

Is my session „indestructible“?

set serveroutput on
begin
dbms_output.put_line('USER:
dbms_output.put_line('SESSION ID:
dbms_output.put_line('CURRENT_SCHEMA:
dbms_output.put_line('INSTANCE NAME:
dbms_output.put_line('DATABASE ROLE:
dbms_output.put_line('OS USER:
dbms_output.put_line('CLIENT IP ADDRESS:
dbms_output.put_line('SERVER HOSTNAME:
dbms_output.put_line('CLIENT HOSTNAME:
end;
/

●

'||sys_context('userenv','session_user'));
'||sys_context('userenv','sid'));
'||sys_context('userenv','current_schema'));
'||sys_context('userenv','instance_name'));
'||sys_context('userenv','database_role'));
'||sys_context('userenv','os_user'));
'||sys_context('userenv','ip_address'));
'||sys_context('userenv','server_host'));
'||sys_context('userenv','host'));

… after a Role Transistion? For example after a SWITCHOVER:

DGMGRL> switchover to physt;

uwe.hesse@oracle.com http://uhesse.com
12

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is Lag in a Data Guard Configuration?
•

A Standby Database may lag behind the Primary because
of:
– Insufficient CPU capacity
– High network latency
– Limited bandwidth

•

Real-Time Query can be configured to return results
according to a certain service level.

uwe.hesse@oracle.com http://uhesse.com
13

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Checking whether there is a Lag
•

For testing purpose, following command creates a
Transport Lag artificially:

DGMGRL> edit database physt set property logshipping=off;

•

Now we check for the Lag:

SQL > create database link ronly
connect to system identified by manager using 'ronly';
SQL > select (select current_scn from v$database) as primary_scn,
(select current_scn from v$database@ronly) as standby_scn
from dual;
SQL > select to_char(scn_to_timestamp((select current_scn from
v$database)),'hh24:mi:ss')
as p_time,
to_char(scn_to_timestamp((select current_scn from v$database@ronly)),'hh24:mi:ss')
as s_time
from dual;

uwe.hesse@oracle.com http://uhesse.com
14

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Difference between Transport Lag and Apply Lag
•

•

Apply Lag: Degree to which the data in a Standby
Database lags behind the data in the Primary, due to
delays in propagating and applying redo to the Standby
Transport Lag: Degree to which the transport of redo to the
Standby Database lags behind the generation of redo on
the primary database

uwe.hesse@oracle.com http://uhesse.com
15

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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

ALTER SESSION
SET STANDBY_MAX_DATA_DELAY = {INTEGER|NONE}

•

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.

uwe.hesse@oracle.com http://uhesse.com
16

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Configuring Zero Lag Between the Primary and
Standby Databases
•
•
•
•

Certain applications have zero tolerance for any lag.
Enforce by setting STANDBY_MAX_DATA_DELAY to 0.
Results are guaranteed to be the same as the primary
database, else ORA-3172 error is returned to the query.
SYNC must be specified for redo transport.

uwe.hesse@oracle.com http://uhesse.com
17

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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 readmostly applications if writes are redirected to the primary
database or a local database.
Writes can be transparently redirected 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.

uwe.hesse@oracle.com http://uhesse.com
18

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
An Example “Read-Mostly Application”:
•

The code below returns errors if run on the Standby
because of the inserts

vari c char(30)
exec select SYS_CONTEXT('USERENV','DATABASE_ROLE') into :c from
dual;
insert into flag values(:c, sysdate,null);
commit;
select * from dept;
insert into flag values(:c, null, sysdate);
commit;

uwe.hesse@oracle.com http://uhesse.com
19

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Transparently Redirecting Writes to the Primary
Database: The Big Picture

uwe.hesse@oracle.com http://uhesse.com
20

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Transparently Redirecting Writes to the Primary
Database: The dummy schema

grant create session to rmostly identified by rmostly;
grant select on scott.dept to rmostly;
grant all on scott.flag to rmostly;
create synonym rmostly.dept for scott.dept;
create public database link prod
connect to scott identified by tiger using 'prod';
create synonym rmostly.flag for scott.flag@prod;

uwe.hesse@oracle.com http://uhesse.com
21

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Transparently Redirecting Writes to the Primary
Database: Setting the dummy schema
Dummy schema rmostly is set on Standby with
Select on dept and Insert into flag@Primary
create or replace trigger switch_schema_trigger
after logon on scott.schema
begin
if (sys_context('userenv','database_role')
= ('PHYSICAL STANDBY'))
then
execute immediate
'alter session set current_schema = rmostly';
end if;
end;
/

uwe.hesse@oracle.com http://uhesse.com
22

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Enhancements to Block Media Recovery
•

•

Corrupted blocks in the primary database are automatically
repaired by using blocks from a physical standby
database.
Real-time query and Active Data Guard must be enabled
on the physical standby database.
Automatic Block Repair

Primary
database
uwe.hesse@oracle.com http://uhesse.com
23

Physical standby
database with
real-time query

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Queries
Enhancements to Block Media Recovery
•

•

Corrupted blocks in the physical standby database are
automatically repaired by using blocks from the primary
database
Real-time query and Active Data Guard must be enabled
on the physical standby database
Automatic Block Repair

Primary
database
uwe.hesse@oracle.com http://uhesse.com
24

Physical standby
database with
real-time query

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Queries
Thank you for your attention!

Any questions or remarks?

uwe.hesse@oracle.com http://uhesse.com
25

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

More Related Content

What's hot

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 Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesOracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesDeiby Gómez
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresJakkrapat S.
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12cuzzal basak
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Emre Baransel
 
Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?DLT Solutions
 
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert Bialek
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert BialekTrivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert Bialek
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert BialekTrivadis
 
Dg broker & client connectivity - High Availability Day 2015
Dg broker & client connectivity -  High Availability Day 2015Dg broker & client connectivity -  High Availability Day 2015
Dg broker & client connectivity - High Availability Day 2015aioughydchapter
 
Active dataguard
Active dataguardActive dataguard
Active dataguardManoj Kumar
 
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)Satishbabu Gunukula
 
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...Ludovico Caldara
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACKristofferson A
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Ludovico Caldara
 
Oracle 12c New Features_RAC_slides
Oracle 12c New Features_RAC_slidesOracle 12c New Features_RAC_slides
Oracle 12c New Features_RAC_slidesSaiful
 

What's hot (20)

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
 
Data Guard25 August
Data Guard25 AugustData Guard25 August
Data Guard25 August
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
Oracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesOracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New Features
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012Data Guard Deep Dive UKOUG 2012
Data Guard Deep Dive UKOUG 2012
 
Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?
 
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert Bialek
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert BialekTrivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert Bialek
Trivadis TechEvent 2016 Oracle Client Failover - Under the Hood by Robert Bialek
 
Dg broker & client connectivity - High Availability Day 2015
Dg broker & client connectivity -  High Availability Day 2015Dg broker & client connectivity -  High Availability Day 2015
Dg broker & client connectivity - High Availability Day 2015
 
Active dataguard
Active dataguardActive dataguard
Active dataguard
 
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
 
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?
 
Oracle Dataguard
Oracle DataguardOracle Dataguard
Oracle Dataguard
 
Oracle 12c New Features_RAC_slides
Oracle 12c New Features_RAC_slidesOracle 12c New Features_RAC_slides
Oracle 12c New Features_RAC_slides
 

Similar to Real-Time Query for Data Guard

Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001jucaab
 
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
 
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Nikhil Hiremath
 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBUniFabric
 
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
 
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...Jade Global
 
Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012Jade Global
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in DataguardJason Arneil
 
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Courtney Llamas
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOrgad Kimchi
 
Oracle Drivers configuration for High Availability
Oracle Drivers configuration for High AvailabilityOracle Drivers configuration for High Availability
Oracle Drivers configuration for High AvailabilityLudovico Caldara
 
What's new in Oracle Trace File Analyzer 12.2.1.3.0
What's new in Oracle Trace File Analyzer 12.2.1.3.0What's new in Oracle Trace File Analyzer 12.2.1.3.0
What's new in Oracle Trace File Analyzer 12.2.1.3.0Gareth Chapman
 
High Volume Payments using Mule
High Volume Payments using MuleHigh Volume Payments using Mule
High Volume Payments using MuleAdhish Pendharkar
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentationVimlendu Kumar
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationFrancisco Alvarez
 
JoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies
 
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesSven Sandberg
 
Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2gaougorg
 

Similar to Real-Time Query for Data Guard (20)

less08.ppt
less08.pptless08.ppt
less08.ppt
 
Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001
 
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...
 
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DB
 
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
 
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
 
Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in Dataguard
 
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New Features
 
Oracle Drivers configuration for High Availability
Oracle Drivers configuration for High AvailabilityOracle Drivers configuration for High Availability
Oracle Drivers configuration for High Availability
 
What's new in Oracle Trace File Analyzer 12.2.1.3.0
What's new in Oracle Trace File Analyzer 12.2.1.3.0What's new in Oracle Trace File Analyzer 12.2.1.3.0
What's new in Oracle Trace File Analyzer 12.2.1.3.0
 
High Volume Payments using Mule
High Volume Payments using MuleHigh Volume Payments using Mule
High Volume Payments using Mule
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c Presentation
 
JoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies - Azure SQL DB
JoTechies - Azure SQL DB
 
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
 
High availability disaster recovery 101
High availability   disaster recovery 101High availability   disaster recovery 101
High availability disaster recovery 101
 
Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2
 

Recently uploaded

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Real-Time Query for Data Guard

  • 1. Data Guard: Additional Benefits apart from DR Uwe Hesse uhesse.com On Twitter: @UweHesse Blog: Oracle Certified Master Senior Principal Instructor at Oracle University Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 2. What is Active Data Guard? • • • Option for Oracle Database 11g Enterprise Edition Used to offload resource-intensive activities from a Production Database to a Standby Database Includes 2 features: – Real-time query (Main focus of this Presentation) – Block Change Tracking on a Physical Standby Database uwe.hesse@oracle.com http://uhesse.com 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 3. The initial Data Guard Configuration • Primary & Physical Standby with Data Guard Broker: DGMGRL> show configuration; Configuration - myconf Protection Mode: MaxPerformance Databases: prima - Primary database physt - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS uwe.hesse@oracle.com http://uhesse.com 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4. The initial Physical Standby • Not yet doing Real-Time Query: DGMGRL> show database physt Database - physt Role: Intended State: Transport Lag: Apply Lag: Real Time Query: Instance(s): physt PHYSICAL STANDBY APPLY-ON 0 seconds 0 seconds OFF Database Status: SUCCESS uwe.hesse@oracle.com http://uhesse.com 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 5. Enabling Real-Time Query SQL> select database_role,open_mode from v$database; DATABASE_ROLE OPEN_MODE ---------------- -------------------PHYSICAL STANDBY MOUNTED SQL> select status from v$managed_standby where process like 'MRP%'; STATUS -----------APPLYING_LOG SQL> alter database open; Database altered. SQL> select database_role,open_mode from v$database; DATABASE_ROLE OPEN_MODE ---------------- -------------------PHYSICAL STANDBY READ ONLY WITH APPLY uwe.hesse@oracle.com http://uhesse.com 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6. Read-Only OPEN without Real-Time Query: DGMGRL> edit database physt set state=apply-off; Succeeded. DGMGRL> show database physt; Database - physt Role: Intended State: Transport Lag: Apply Lag: Real Time Query: Instance(s): physt PHYSICAL STANDBY APPLY-OFF 0 seconds 0 seconds OFF Database Status: SUCCESS SQL> select database_role,open_mode from v$database; DATABASE_ROLE OPEN_MODE ---------------- -------------------PHYSICAL STANDBY READ ONLY uwe.hesse@oracle.com http://uhesse.com 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7. Client Connectivity & Active Data Guard • • We need to get our Clients connected appropriately That is done via services: – One for the Primary (prod) – One for the Standby (ronly) • We take Role Transitions into account with an Event Trigger uwe.hesse@oracle.com http://uhesse.com 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8. Creation of Services for Active Data Guard ● On the Primary: begin dbms_service.create_service(service_name=>'prod', network_name=>'prod'); dbms_service.start_service(service_name=>'prod'); end; / begin dbms_service.create_service(service_name=>'ronly', network_name=>'ronly'); end; / ● On the Standby: begin dbms_service.start_service(service_name=>'ronly'); end; / uwe.hesse@oracle.com http://uhesse.com 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. Creation of the Event Trigger for Service Management create or replace trigger service_management after startup on database declare vrole varchar(30); vopen_mode varchar(30); begin select database_role into vrole from v$database; select open_mode into vopen_mode from v$database; if vrole = 'PRIMARY' then begin dbms_service.start_service ('prod'); dbms_service.stop_service ('ronly'); end; elsif vrole = 'PHYSICAL STANDBY' then begin if vopen_mode like 'READ ONLY%' then dbms_service.start_service ('ronly'); end if; dbms_service.stop_service ('prod'); end; end if; end; / uwe.hesse@oracle.com http://uhesse.com 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Local Naming Method for Active Data Guard ● Connect Descriptors in the tnsnames.ora: PROD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = uhesse1)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = uhesse2)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = prod) ) ) RONLY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = uhesse1)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = uhesse2)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ronly) ) ) uwe.hesse@oracle.com http://uhesse.com 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11. Implement TAF for Active Data Guard ● On the Primary (reaches Standby via Redo-Apply): begin dbms_service.modify_service (service_name=>'prod', failover_method => 'BASIC', failover_type => 'SELECT', failover_retries => 200, failover_delay => 1); end; / begin dbms_service.modify_service (service_name=>'ronly', failover_method => 'BASIC', failover_type => 'SELECT', failover_retries => 200, failover_delay => 1); end; / uwe.hesse@oracle.com http://uhesse.com 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12. Check Session Details with SYS_CONTEXT ● Is my session „indestructible“? set serveroutput on begin dbms_output.put_line('USER: dbms_output.put_line('SESSION ID: dbms_output.put_line('CURRENT_SCHEMA: dbms_output.put_line('INSTANCE NAME: dbms_output.put_line('DATABASE ROLE: dbms_output.put_line('OS USER: dbms_output.put_line('CLIENT IP ADDRESS: dbms_output.put_line('SERVER HOSTNAME: dbms_output.put_line('CLIENT HOSTNAME: end; / ● '||sys_context('userenv','session_user')); '||sys_context('userenv','sid')); '||sys_context('userenv','current_schema')); '||sys_context('userenv','instance_name')); '||sys_context('userenv','database_role')); '||sys_context('userenv','os_user')); '||sys_context('userenv','ip_address')); '||sys_context('userenv','server_host')); '||sys_context('userenv','host')); … after a Role Transistion? For example after a SWITCHOVER: DGMGRL> switchover to physt; uwe.hesse@oracle.com http://uhesse.com 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. What is Lag in a Data Guard Configuration? • A Standby Database may lag behind the Primary because of: – Insufficient CPU capacity – High network latency – Limited bandwidth • Real-Time Query can be configured to return results according to a certain service level. uwe.hesse@oracle.com http://uhesse.com 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. Checking whether there is a Lag • For testing purpose, following command creates a Transport Lag artificially: DGMGRL> edit database physt set property logshipping=off; • Now we check for the Lag: SQL > create database link ronly connect to system identified by manager using 'ronly'; SQL > select (select current_scn from v$database) as primary_scn, (select current_scn from v$database@ronly) as standby_scn from dual; SQL > select to_char(scn_to_timestamp((select current_scn from v$database)),'hh24:mi:ss') as p_time, to_char(scn_to_timestamp((select current_scn from v$database@ronly)),'hh24:mi:ss') as s_time from dual; uwe.hesse@oracle.com http://uhesse.com 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. Difference between Transport Lag and Apply Lag • • Apply Lag: Degree to which the data in a Standby Database lags behind the data in the Primary, due to delays in propagating and applying redo to the Standby Transport Lag: Degree to which the transport of redo to the Standby Database lags behind the generation of redo on the primary database uwe.hesse@oracle.com http://uhesse.com 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. 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 ALTER SESSION SET STANDBY_MAX_DATA_DELAY = {INTEGER|NONE} • 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. uwe.hesse@oracle.com http://uhesse.com 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. Configuring Zero Lag Between the Primary and Standby Databases • • • • Certain applications have zero tolerance for any lag. Enforce by setting STANDBY_MAX_DATA_DELAY to 0. Results are guaranteed to be the same as the primary database, else ORA-3172 error is returned to the query. SYNC must be specified for redo transport. uwe.hesse@oracle.com http://uhesse.com 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 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 readmostly applications if writes are redirected to the primary database or a local database. Writes can be transparently redirected 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. uwe.hesse@oracle.com http://uhesse.com 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. An Example “Read-Mostly Application”: • The code below returns errors if run on the Standby because of the inserts vari c char(30) exec select SYS_CONTEXT('USERENV','DATABASE_ROLE') into :c from dual; insert into flag values(:c, sysdate,null); commit; select * from dept; insert into flag values(:c, null, sysdate); commit; uwe.hesse@oracle.com http://uhesse.com 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. Transparently Redirecting Writes to the Primary Database: The Big Picture uwe.hesse@oracle.com http://uhesse.com 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. Transparently Redirecting Writes to the Primary Database: The dummy schema grant create session to rmostly identified by rmostly; grant select on scott.dept to rmostly; grant all on scott.flag to rmostly; create synonym rmostly.dept for scott.dept; create public database link prod connect to scott identified by tiger using 'prod'; create synonym rmostly.flag for scott.flag@prod; uwe.hesse@oracle.com http://uhesse.com 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. Transparently Redirecting Writes to the Primary Database: Setting the dummy schema Dummy schema rmostly is set on Standby with Select on dept and Insert into flag@Primary create or replace trigger switch_schema_trigger after logon on scott.schema begin if (sys_context('userenv','database_role') = ('PHYSICAL STANDBY')) then execute immediate 'alter session set current_schema = rmostly'; end if; end; / uwe.hesse@oracle.com http://uhesse.com 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. Enhancements to Block Media Recovery • • Corrupted blocks in the primary database are automatically repaired by using blocks from a physical standby database. Real-time query and Active Data Guard must be enabled on the physical standby database. Automatic Block Repair Primary database uwe.hesse@oracle.com http://uhesse.com 23 Physical standby database with real-time query Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Queries
  • 24. Enhancements to Block Media Recovery • • Corrupted blocks in the physical standby database are automatically repaired by using blocks from the primary database Real-time query and Active Data Guard must be enabled on the physical standby database Automatic Block Repair Primary database uwe.hesse@oracle.com http://uhesse.com 24 Physical standby database with real-time query Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Queries
  • 25. Thank you for your attention! Any questions or remarks? uwe.hesse@oracle.com http://uhesse.com 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.