Download Data Guard vs. Active Data Guard

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Oracle Database wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Clusterpoint wikipedia , lookup

SQL wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

PL/SQL wikipedia , lookup

Transcript
Under The Hood of Active
Data Guard
Author & Presenter: Nassyam Basha
Date: 27-FEB-2015
Nassyam Basha
•
•
•
•
•
•
•
•
Post Graduation in computers from University of Madras
Oracle Database Consultant @ Pythian
Frequent OTN contributor (CKPT)) /MOSC certified GURU
Co-Author
Author of Oracle 11gR2 Data Guard administration beginners Guide
Blogger
Author of OTN Articles
11g Oracle Certified Master
Co-Founder of
@nassyambasha
/nassyambasha
2
© 2014 Pythian
Under The Hood of Active Data Guard
• Data Guard vs. Active Data Guard
•
•
•
•
•
•
•
•
•
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby
Applications & ADG
3
© 2014 Pythian
Data Guard vs. Active Data Guard
Data Guard
•
•
Resources are locked
Stale results by opening standby in read-only
read
after MRP termination.
Active Data Guard
•
•
•
•
•
•
4
Additional License for the usage of Active Data Guard from 11g
Improves performance of Primary by offloading queries, reporting with real-time
real
data
Complex queries, Sorting, Web-based
based access while redo apply
Read-Only applications
Best suits for Enquiries, Tracking status (No DML/DDL)
Unlocks the resources (System, Storage….)
© 2014 Pythian
Active Data Guard
Oracle Net
PRIMARY DATABASE
LGWR
NSS/
NSA
RFS
SRL’s
ORL’s
ARC
H
5
ARC
H
© 2015 Pythian
STANDBY
DATABASE
Data Guard
•
•
Real Time apply is applicable
No Real-Time
Time Queries, Database will be in Mount Status
6
© 2014 Pythian
Under The Hood of Active Data Guard
• Data Guard vs. Active Data Guard
• Setup of ADG
•
•
•
•
•
•
•
•
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby & Applications
Applications & ADG
7
© 2014 Pythian
Set up of ADG
•
•
•
•
•
8
Compatible=11.0.0
Ensure Real-Time apply is On.
Uncomplicated procedure
Broker manages everything to bounce MRP
Standby can be RAC or non-RAC
RAC and Broker is supported.
© 2015 Pythian
Under The Hood of Active Data Guard
• Data Guard vs. Active Data Guard
• Setup of ADG
• Real-Time Query
•
•
•
•
•
•
•
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby & Applications
Applications & ADG
9
© 2014 Pythian
Real Time Query
•
10
Here you go
© 2015 Pythian
Real-Time
Time Query Validation
Monitoring data apply on standby database to track real-time
real
apply
11
© 2015 Pythian
Real-Time Query Test
•
12
No scope for the stale data
© 2015 Pythian
Guarantee Data Currency
•
•
•
SESSION_MAX_DATA_DELAY parameter applicable only for non-administrator
non
users
Session specific apply lag tolerance
If session_max_data_delay set to None
ne, query results regardless of the apply lag
with primary database.
Standby
SQL> connect c##nassyam/oracle@india;
Connected.
SQL> alter session set standby_max_data_delay=30;
=30;
Session altered.
DGMGRL> edit database india set state='APPLY-OFF';
OFF';
Succeeded.
DGMGRL>
Primary
SQL> set time on
07:59:01 SQL> insert into adg_table values (150, 'PUNE');
1 row created.
07:59:14 SQL> commit;
Commit complete.
13
© 2015 Pythian
Guarantee Data Currency
Standby
SQL> select count(*) from adg_table;
select count(*) from adg_table
*
ERROR at line 1:
ORA-00604:
00604: error occurred at recursive SQL level 2
ORA-03172:
03172: STANDBY_MAX_DATA_DELAY of 30 seconds exceeded
14
© 2015 Pythian
Guarantee Data Currency
SQL> select name,value from v$dataguard_stats;
;
NAME
VALUE
-------------------------------- -----------------------------transport lag
+00 00:00:00
apply lag
+00 00:14:55
apply finish time
estimated startup time
13
•
To avoid stale data for any specific triggers with parameter standby_max_delay
works.
CREATE OR REPLACE TRIGGER max_data_delay
AFTER LOGON ON database
BEGIN
IF (SYS_CONTEXT(‘USERENV’,’DATABASE_ROLE’) in (‘PHYSICAL STANDBY’) and
SYS_CONTEXT(‘USERENV’,’SESSION_USER’)=‘C##NASSYAM’)
’SESSION_USER’)=‘C##NASSYAM’)
THEN
execute immediate ‘ALTER SESSION SET STANDBY_MAX_DATA_DELAY=5;’
END IF;
END;
/
15
© 2015 Pythian
Under The Hood of Active Data Guard
• Data Guard vs. Active Data Guard
• Setup of ADG
• Real-Time Query
• Gap Detection and Resolution
•
•
•
•
•
•
16
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby & Applications
Applications & ADG
© 2014 Pythian
Gap Detection and Resolution
•
Missing redo stream with full log file or into parts
–
Network Outage
–
Deletion or Missing of log files before they applied on standby
–
Bad configuration
–
Can be FRA, Corruption, Data files issue
–
Consider reviewing the alert log and views v$archived_log, v$archive_gap,
v$archive_dest, v$database,
•
v$dataguard_status v$managed_standby, v$log_history
v$dataguard_status,
Resolution:
–
Resolution not required for Good configuration , Oracle take cares in resolving
GAP by RFS
–
17
FAL parameter
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
• BCT & Fast Incremental Backups
•
•
•
•
•
18
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby & Applications
Applications & ADG
© 2014 Pythian
Block Change Tracking
•
•
•
•
19
BCT can quickly identifies the blocks changes since last backup.
BCT on Standby supported from 11.2
Many bugs with 11.2
< 11gR2 CTWR cannot write in BCT when recovery in progress.
© 2015 Pythian
Block Change Tracking
•
20
BCT works only on Incremental backups
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
• Automatic Block Repair
•
•
•
•
21
Statspack & ASH
Exporting Data from ADG
DML’s on Standby & Applications
Applications & ADG
© 2014 Pythian
Automatic Block Repair
•
•
•
•
•
Automatic Block repair feature of ADG from 11g
Media recovery works in 2-way
Real-Time query should be working.
Automatically repairs physical corruption.
Increases availability and maintaining data protection all time.
STANDBY DATABASE
PRIMARY DATABASE
22
© 2015 Pythian
Automatic Block Repair
•
Without ADG
SQL> select count(*) from c##nassyam.adg_table
nassyam.adg_table;
select count(*) from c##nassyam.adg_table
*
ERROR at line 1:
ORA-01578:
01578: ORACLE data block corrupted (file # 6, block # 354)
ORA-01110:
01110: data file 6: '/u02/app/oracle/oradata/mcdb/users01.dbf'
•
With the power of ADG
SQL> select count(*) from C##NASSYAM.ADG_TABLE;
COUNT(*)
---------3
Reading datafile '/u02/app/oracle/oradata/mcdb/users01.dbf'
/users01.dbf' for corruption at rdba: 0x01800164 (file 6,
block 356)
Reread (file 6, block 356) found same corrupt data (no logical check)
Automatic block media recovery requested for (file# 6, block# 356)
Sat Feb 21 22:24:07 2015
Automatic block media recovery successful for (file# 6, block# 356)
Sat Feb 21 22:24:07 2015
Automatic block media recovery successful for (file# 6, block# 355)
Sat Feb 21 22:24:07 2015
Automatic block media recovery successful for (file# 6, block# 355)
Automatic block media recovery successful for (file# 6, block# 356)
23
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
• Statspack & ASH
• Exporting Data from ADG
• DML’s on Standby & Applications
• Applications & ADG
24
© 2014 Pythian
Tuning Reports: Statspack
•
With ADG we can measure performance by interpreting Tuning tools
–
–
Statspack on standby is available from 11gR1
Before using Statspack, must have schema and Statspack related objects, If not available they can created
using spcreate.sql
Statspack Installation
SQL> alter session set "_oracle_script"=true;
"=true;
SQL> @?/rdbms/admin/spcreate
Standby Statspack Installation, creates “STDBYPERF” user for Standby.
SQL> @?/rdbms/admin/sbcreate.sql
Add additional Standby from “STDBYPERF” user
SQL> @?/rdbms/admin/sbaddins
Creating Snapshot Manually (exec statspack_<db_unique_name
db_unique_name>_<instance_name>.snap)
SQL> exec statspack_india_drmcdb.snap
Generate Statspack report(Test case) from “STDBYPERF” user
SQL> exec statspack_india_drmcdb.snap
SQL> @?/rdbms/admin/sbreport
25
© 2015 Pythian
Tuning Reports: Sample Statspack Report
•
ADG allows more scope to review performance of standby database also.
D:\All Oracle\
Community & User Groups\OTN
26
© 2015 Pythian
Tuning Reports: ASH Report
•
•
ASH report is very useful to track active sessions and also Historical.
Ability to generate reports same as Primary with HTML and Text based.
SQL> select db_unique_name,database_role from v$database;
DB_UNIQUE_NAME
DATABASE_ROLE
-------------------- ---------------india
PHYSICAL STANDBY
SQL> @?/rdbms/admin/ashrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id
DB Name
Inst Num Instance
----------- ------------ -------- -----------3793852408 MCDB
1 drmcdb
........
You are running ASH report on a Standby database. To generate the report
over data sampled on the Primary database, enter 'P'.
Defaults to 'S' - data sampled in the Standby database.
Enter value for stdbyflag: S
Using Primary (P) or Standby (S): S
27
© 2015 Pythian
Tuning Reports: ASH Report
•
28
ASH report is very useful to track active sessions and also Historical.
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
• Exporting Data from ADG
• DML’s on Standby & Applications
• Applications & ADG
29
© 2014 Pythian
Exporting Data from Standby
•
•
Creates only master table at Primary database
Disk reads, Memory consumption of processes from standby database.
SQL> !mkdir -p /home/oracle/working/nassyam
nassyam/
SQL> create or replace directory exp_adg as '/home/oracle/working/nassyam';
'/home/oracle/working/
Directory created.
SQL> grant read,write,execute on directory exp_adg to public;
Grant succeeded.
SQL> create public database link exp_adg connect to system identified by oracle
using 'india';
Database link created.
SQL>
30
© 2015 Pythian
Exporting Data from Standby
-bash-3.2$ expdp system/oracle directory=exp_adg dumpfile=exp_full.dmp
dumpfile
logfile=exp_full.log schemas=
c##nassyam network_link=exp_adg
Export: Release 12.1.0.1.0 - Production on Fri Feb 20 18:03:59 2015
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
WARNING: Oracle Data Pump operations are not typically needed when connected to the root or seed of a
container database.
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=exp_adg
directory=
dumpfile=exp_full.dmp
logfile=exp_full.log schemas= network_link=exp_adg
exp_adg
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 247.0 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "C##NASSYAM"."TEST_UPDATE"
208.7 MB 4000000 rows
. . exported "C##NASSYAM"."ADG_TABLE"
6.179 KB
3 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/working/nassyam/exp_full.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Feb 20 18:05:59 2015 elapsed 0
00:01:57
31
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
• DML’s on Standby
• Applications & ADG
32
© 2014 Pythian
DML’s on Standby & Applications
•
•
•
•
•
Active Data Guard feature from 12.1.0.1
Key Parameter: TEMP_UNDO_ENABLED(Dynamic)
Compatible parameter should be 12.0.0
DDL’s should be issued from Primary
Transactions splits, Temporary objects will be used temporary undo and normal objects in Permanent undo.
SQL> create global temporary table ADG_GTT on commit preserve rows as select * from testobj;
Table created.
DDL only on Primary
SQL>
SQL> conn c##nassyam/oracle
Connected.
SQL> select count(*) from adg_gtt;
COUNT(*)
---------0
SQL> insert into ADG_GTT select * from testobj;
DML on Standby
91431 rows created.
SQL> select count(*) from adg_gtt;
New rows on Standby
COUNT(*)
---------91431
33
© 2015 Pythian
DML’s on Standby & Applications
•
12 New feature
SQL> set autotrace traceonly statistics;
SQL> insert into ADG_GTT select * from testobj;
91431 rows created.
Statistics
---------------------------------------------------------312 recursive calls
8499 db block gets
3542 consistent gets
1534 physical reads
0 redo size
854 bytes sent via SQL*Net to client
841 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
35 sorts (memory)
0 sorts (disk)
91431 rows processed
SQL> select count(*) from adg_gtt;
COUNT(*)
---------182862
34
© 2015 Pythian
Under The Hood of Active Data Guard
•
•
•
•
•
•
•
•
•
Data Guard vs. Active Data Guard
Setup of ADG
Real-Time Query
Gap Detection and Resolution
BCT & Fast Incremental Backups
Automatic Block Repair
Statspack & ASH
Exporting Data from ADG
DML’s on Standby
• Applications & ADG
35
© 2014 Pythian
Applications & ADG
•
•
Key role is compatibility of applications with ADG
Peoplesoft
–
–
–
–
•
•
•
•
36
8.5.1 Nvision reports are supported to use and run on ADG
Nvisions are mostly select queries(PS_LEDGER, PS_LEDGER_BUDG)
Reports can run from modules FIN, HR, or EPM(DWH).
Database Links to access primary system for DML/DDL using triggers
EBS
Top Links(FMW)
Oracle BI(10.1.3.4)
SAP does not work with ADG
© 2015 Pythian
Finally……
These all are with single License ☺
37
© 2015 Pythian
Thank you and Q&A
[email protected]
@nassyambasha
www.oracle-ckpt.com
ckpt.com
38
© 2015 Pythian