Top Banner
113
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: UKOUG
Page 2: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR and ASH Deep Dive with Enterprise Manager 12c and BeyondKellyn Pot’VinConsulting Member of Enterprise Manager Technical TeamStrategic Customer ProgramDecember, 2014

Oracle Confidential

Page 3: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 4: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Safe Harbor Statement

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Oracle Confidential 4

Page 5: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

ASH/AWR Reports in EM12c

Compare ADDM

SQL Monitor

ASH/AWR Reporting from the Command Line

Search SQL, (Least Used Feature of EM)

ASH Queries

AWR Warehouse

Oracle Confidential 5

6

7

Page 6: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

When Someone Does’t Use AWR and ASH

Oracle Confidential 6

Page 7: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Brief History

• ASH= Active Session History

• AWR= Automatic Workload Repository

• Introduced in Oracle 10g

• Evolution to statspack, requests for performance reporting improvements.

• “Always on” approach to performance metrics with requirement of non-locking collection process.

• Requires Tuning Management Pack License from Oracle.

Page 8: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 9: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Where We Will be Spending our Time Today…

Page 10: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Running ASH Report from EM

• ASH is by time, not snapshot.• Set start date and time.• End date and time• Generate report

Page 11: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

HTML Format ASH

Page 12: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Main ASH Info

Page 13: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top SQL, Top Sessions

Page 14: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top SQL Details

Page 15: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top Parallel, Top DB Files

Page 16: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

How Often Are We Asked, “What Changed?”

• It ran fine last week, now it doesn’t!

• ETL loads have changed, but no one has released any new code!

• The DBA says there hasn’t been any parameter changes to this database, but I’m sure there have been.

• Compare ADDM Comparison Resolution

Page 17: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

What is in an ADDM Compare?

• Report Includes Following:

– Clear Demonstration of impact of change.

– Recommendations to address issue.

– Identifies causes behind change, (with limitations.)

– Lists Regressed SQL, too!

– Tip: If Installing to database for first time, (simple installation, nothing to concern about, just pkg to fulfill views) you must have preferred credentials SET of install will fail!

Page 18: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Executing a Report from EM12c

• Choose focus period

• Choose to compare to an Offset, Baseline or Custom

Page 19: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

A Comparison ADDM Report…

• Report Includes Following:• Clear Demonstration of impact of change.• Recommendations to address issue.• Identifies causes behind change, (with limitations.)• Lists Regressed SQL, too!

Tip: If Installing to database for first time, (simple installation, nothing to concern about, just pkg to fulfill views) you must have preferred credentials SET of install will fail!

Oracle Confidential 19

Page 20: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Performing a Comparison

Yes, you can compare one snapshot against another snapshot in DIFFERENT database if you are using this in AWR Warehouse!

Oracle Confidential 20

Page 21: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

2-3pm, Compared on the 12th vs. the 13th

• Familiar interface with visual wait event comparisons.

• Average # of sessions during each period are displayed.

Oracle Confidential 21

Page 22: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Detailed Report

High level data, highlight for analysis and recommendations

Oracle Confidential 22

Page 23: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Regression SQL

Any performance degradation is noted with the down arrow icon:

Oracle Confidential 23

Page 24: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top Segments Causing IO Waits

• High Level data• Click on “Show Hot Object Breakdown” to see more detail.

Oracle Confidential 24

Page 25: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Resource Comparisons

• Comparisons of Memory, CPU, IO and Interconnect.

• Memory Is there Virtual paging?

- Memory Base Period

- Memory Comparison Period

Oracle Confidential 25

Page 26: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Dashboard Provided for CPU, Memory, IO and Interconnect

• Is something OTHER than Oracle the cause?

Page 27: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

IO Bound Dashboard

• Base vs. comparison period

• Temp reads/writes specified

• Single block read latency

Page 28: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Monitor in EM12c

Status of Statement

Wait Events

Degree of Parallelism

SQL_ID

SQL Text

Page 29: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Exadata and Offloading

• Drill down to specific statement within SQL Monitor will display offload efficiency per statement.

Page 30: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Full Detail of SQL Execution

Page 31: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

View Report

Page 32: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Monitor Report CLISET LONG 1000000

SET LONGCHUNKSIZE 1000000

SET LINESIZE 1000

SET PAGESIZE 0

SET TRIM ON

SET TRIMSPOOL ON

SET ECHO OFF

SET FEEDBACK OFF

SELECT DBMS_SQLTUNE.report_sql_monitor(

sql_id => '5vh6y3b7tnv8r',

type => 'TEXT',

report_level => 'ALL') AS report

FROM dual;

Page 33: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Text Output of SQL Monitor

Page 34: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

One of the Best & Least Used Features in EM(10g, 11g, 12c)

Search SQL

Problem Query

Page 35: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

We Have the SQL_ID, What Next?

4v2tsp8dz0nhn is our SQL_ID

Go to the EM Console, (Example is EM12c)

Page 36: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Search SQL Interface

• Choose AWR Snapshots, (change Time Period), AWR Baselines and put SQL_ID

Page 37: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Click on Search

• SQL_ID link for SQL Details

• Split up by tabs for Cursor, AWR, Baselines and SQL Tuning Sets

• Plan Hash Value

• Elapsed Time

Page 38: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Data

Page 39: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Snapshot IDs

• Click on Snapshot ID and gather valuable data on resource usage during snapshot time or choose to view report.

Page 40: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Report or Run ADDM Report

Page 41: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR and ASH from the CLI

All DBAs should know how to do this, (plus, Thor commands it!)

Page 42: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Running Reports, Command Line

$ORACLE_HOME/rdbms/admin/awrrpt.sql;

$ORACLE_HOME/rdbms/admin/ashrpt.sql;

$ORACLE_HOME/rdbms/admin/awrsqlrpt.sql;Less Known AWR Reports:

awrinfo.sql General AWR Info

awrddrpt.sql Comparison report between snapshots

awrblmig.sql Migrates pre-11g baseline data into 11g Baseline tables.

awrgrpt.sql RAC Aware AWR Report.

Page 43: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Info Report

• Snapshot Interval Information

• Basic Info on Instances and Nodes

• No User or Application Schema info.

• Space Usage by SYSAUX

• WRH$ and Non- AWR Objects, ordered by size

• Snapshot info and if any errors.

• Advisor Tasks

• Use for sizing AWR Warehouse estimates.

Page 44: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Info Report

Page 45: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Report@$ORACLE_HOME/rdbms/admin/awrrpt.sql;

-Report Format: Text or HTML-Days to view snapshot IDs-Beginning and Ending Snapshot ID’s- Name of Report

Page 46: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Report@$ORACLE_HOME/rdbms/admin/ashrpt.sql;

-Report Format: Text or HTML.-Timestamp to being report from.-Duration in minutes.-Name of report.

Page 47: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL_ID Specific AWR Report

Page 48: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

“Interesting Part”

Page 49: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Finale!

Select * from table(dbms_xplan.display_awr(‘43mp3mjufgnkg’));

Page 50: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Querying ASH Data Directly

• More defined reporting

• No need to pull full report

• Detail on waits that are of interest

• Join to non-AWR objects

• Examples and Ideas…

Page 51: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

V$ACTIVE_SESSION_HISTORY• SAMPLE_ID- This is a unique identifier within an ASH sample.

• SAMPLE_TIME- A unit of time used by Active Session History, (not to be confused with DB_TIME)

• USER_ID- Identifier for a user that’s executing the session.

• SESSION_ID- Same as the SID or Session ID and can be used to join to SID in other views/tables.

• SESSION_STATE- What was the state of the session when ASH recorded the sample.

• ON CPU/WAITING- The two session states in Active Session History. ON CPU is Active, vs. Waiting, which is self-explanatory.

• EVENT- Type of event that the session is currently active or waiting on.

• TIME_WAITED- How long the session has been waiting if waiting.

• WAIT_TIME- Confusing- but this is populated by any wait time if the session is currently active and for the previous waits.

• SQL_ID- The unique identifier for the SQL statement being executed.

• SQL_CHILD_NUMBER-The cursor child number.

Page 52: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Session Averagesselect

ROUND(RATIO_TO_REPORT(SUM(1)) OVER () * 100 ,2) PERCENTAGE, ash.session_type

SESS_TYPE,

session_state STATUS, decode(nvl(sql_id,'-1'),'-1','nonsql','sql') SQL_TYPE,

count(distinct to_char(session_id)|| to_char(session_serial#)) SESS_CNT from

v$active_session_history ash

where

sample_time > sysdate - 30/(24*60) and (( ash.session_state = 'ON CPU' )

or ( ash.session_type != 'BACKGROUND' ))

group by

ash.session_type,

ash.session_state, decode(nvl(sql_id,'-1'),'-1','nonsql','sql')

order by count(*)

/

Page 53: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Session Avg. Output

• Note the % of Background processes

Page 54: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Inspecting Whatselect * from (select

ash.SQL_ID , ash.SQL_PLAN_HASH_VALUE Plan_hash, aud.name type,

sum(decode(ash.session_state,'ON CPU',1,0)) "CPU",

sum(decode(ash.session_state,'WAITING',1,0)) "WAITING",

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'User I/O',1,0),0))

"IO WAIT" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class,'User I/O',1,0),0))

"IO" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'Concurrency',1,0)))

"CONCURRENCY" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'Application',1,0)))

"Application" , sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL“

from v$active_session_history ash, audit_actions aud

where SQL_ID is not NULL

and ash.sql_opcode=aud.action and ash.sample_time > sysdate - &minutes /( 60*24)

group by sql_id, SQL_PLAN_HASH_VALUE , aud.name

order by sum(decode(session_state,'ON CPU',1,1)) desc) where rownum < 5;

Page 55: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

10 Min. View of Waits by SQL_ID

• Choose Time in Minutes To Review, (10 in our example)

• SQL_ID and Plan Hash Value Shown

• Waits for CPU, Wait, IO Wait and others.

Page 56: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Quantity of Events Occurred Over Small Amounts of TimeCol event for a50

select event, count(1)

from v$active_session_history

where sample_time between

to_date('21-FEB-14 01.43.00 PM','dd-MON-yy hh:mi:ssPM')

and

to_date('21-FEB-15 01.53.00 PM','dd-MON-yy hh:mi:ssPM')

group by event

order by event;

Page 57: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Results, Where to Focus?

Page 58: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Transaction Wait Detailselect

to_char(sample_time,'HH:MI') st, substr(event,0,20) event,

ash.session_id sid, mod(ash.p1,16) lm, ash.p2,ash.p3,

nvl(o.object_name,ash.current_obj#) objn,

substr(o.object_type,0,10) otype, CURRENT_FILE# fn,

CURRENT_BLOCK# blockn, ash.SQL_ID,

BLOCKING_SESSION bsid

from v$active_session_history ash, all_objects o

where event like 'enq: TX%'

and o.object_id (+)= ash.CURRENT_OBJ#

and sample_time > sysdate - 10/(60*24)

order by sample_time;

Page 59: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Transaction Lock Output

• What TX row locks are occurring!

Page 60: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Knowing What’s in the ASH Buffer

• Deters from making assumptions on what data is being queried.• Know your samples!

Page 61: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Wait Events Across Nodes

Page 62: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Query top 10 SQL_ID’s in the last 10 minutes?

Page 63: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL_ID and CPU Usage

Page 64: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

IO Waits by Object from ASH

Page 65: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Text with ASH

• SQL for most recent five minutes of sample data from ASH

Page 66: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Results

• SQL_ID, SQL Text, Sample Time that Process was captured in.

Page 67: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Average Activity- Graphed

Page 68: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SELECT

to_char(to_date(tday||' '||tmod*&v_secs,'YYMMDD SSSSS'),'DD-MON HH24:MI:SS') tm, samples npts,total/&samples aas,

substr(substr(substr(rpad('+',round((cpu*&v_bars)/&samples),'+') || rpad('-',round((waits*&v_bars)/&samples),'-') ||

rpad(' ',p.value * &v_bars,' '),0,(p.value * &v_bars)) || p.value || substr(rpad('+',round((cpu*&v_bars)/&samples),'+')

|| rpad('-',round((waits*&v_bars)/&samples),'-') || rpad(' ',p.value * &v_bars,' '),(p.value * &v_bars),10) ,0,30)

,0,&v_graph)graph,total,cpu, waits

FROM (

SELECT to_char(sample_time,'YYMMDD')tday, trunc(to_char(sample_time,'SSSSS')/&v_secs) tmod,

sum(decode(session_state,'ON CPU',1,decode(session_type,'BACKGROUND',0,1))) total, (max(sample_id) - min(sample_id) + 1 )

samples, sum(decode(session_state,'ON CPU' ,1,0) cpu,

sum(decode(session_type,'BACKGROUND',0,decode(session_state,'WAITING',1,0))) waits

FROM v$active_session_history

WHERE sample_time > sysdate - &v_hours/24

GROUP BY trunc(to_char(sample_time,'SSSSS')/&v_secs), to_char(sample_time,'YYMMDD')

UNION ALL

SELECT

to_char(sample_time,'YYMMDD')tday, trunc(to_char(sample_time,'SSSSS')/&v_secs) tmod, sum(decode(session_state,'ON

CPU',10,decode(session_type,'BACKGROUND',0,10))) total, (max(sample_id) - min(sample_id) + 1 ) samples,

sum(decode(session_state,'ON CPU' ,10,0))cpu,

sum(decode(session_type,'BACKGROUND',0,decode(session_state,'WAITING',10,0))) waits

FROM dba_hist_active_sess_history WHERE sample_time > sysdate - &v_hours/24 AND sample_time < (select min(sample_time)

FROM v$active_session_history)

GROUP BY trunc(to_char(sample_time,'SSSSS')/&v_secs), to_char(sample_time,'YYMMDD')) ash, v$parameter p

WHERE p.name='cpu_count‘ ORDER BY to_date(tday||' '||tmod*&v_secs,'YYMMDD SSSSS');

Page 69: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Pivot the Wait Events

Page 70: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Digging into History

• DBA_HIST_ACTIVE_SESS_HISTORY

– SNAP_ID

– SAMPLE_ID

– SAMPLE_TIME

– SESSION_ID

– USER_ID

– SQL_ID

–WAIT_CLASS

– SESSION_STATE

– PGA_ALLOCATED

Page 71: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Process InformationSELECT * FROM (

SELECT /*+ PARALLEL(4) */

count(*) AS count,

user_id, program, module, sql_id

FROM SYS.DBA_HIST_ACTIVE_SESS_HISTORY

WHERE sample_time > TO_DATE('19-FEB-2014 03.00.00 PM','dd-MON-yy hh:mi:ss PM')

AND sample_time < TO_DATE('19-FEB-2014 08.00.00 PM','dd-MON-yy hh:mi:ss PM')

AND program LIKE 'oracle@%'

GROUP BY user_id, program, module, machine, sql_id

ORDER BY count(*) desc

)

WHERE rownum <= 20

/

Page 72: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Results of Process History

Page 73: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Tyler Muth ASH Mining Query

Page 74: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Mining Output

Additional Options:• Physical Read Averages• Physical Writes, (Max/Averages)• Redo Info• Login Info• Hard Parsing, etc.

Page 75: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Best Practice When Querying ASH Data

• Keep it Simple and don’t reinvent the wheel.

• Samples are an alias for time, not for counts.

• Understand what is valuable and compare to packaged reports.

• Be aware on RAC of node specific data.

• Take care when querying Obj#, File# and Block#, (still issues in different versions…)

• Check the time that is available in buffer, don’t assume!

Page 76: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR/ASH Links/Blogs

• Tyler Muth: http://tylermuth.wordpress.com/

• Kyle Hailey, John Beresniewicz, Graham Wood: http://ashmasters.com/

• Mine- “For the Love of ASH and AWR” http://dbakevlar.com/2011/02/for-the-love-of-awr-and-ash/

• Karl Arao- http://karlarao.tiddlyspot.com/

• Guy Harrison- http://guyharrison.squarespace.com/opsgsamples/

Page 77: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Why an AWR Warehouse?

1. Centralized location offers space savings to retain AWR data in local SYSAUX tablespace.

2. Ability to offload resource demands when doing deep analysis and historical trending of AWR data on source database.

3. Centralizing the data, identified by Database identifier, host, allows analysis on more than one database without database links.

Oracle Confidential 77

Page 78: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse in EM12c• Automatic Workload Repository

(AWR) is the de factoperformance repository for Oracle databases since 10g

• Default retention period of 8 days prevents diagnosis of long term performance problems (“Compare performance during this quarter’s books close with last quarter’s”)

• Increasing AWR retention period increases overhead and cost in critical production environments

CRMFinance Supply Chain

0%

30%

60%

90%

120%

0%

30%

60%

90%

120%

0%

30%

60%

90%

120%

Page 79: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Requirements

• AWR Warehouse Repository -11.2.0.4 or higher.

• Preferred Credentials set up for all targets involved.

• Discover the database you will use for your repository in the EM12c

• Pre-discover any source database before able to add.

• For a RAC target or AWR Warehouse, ensure you’ve set up a shared location for the ETL load files.

Oracle Confidential 79

Page 80: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse - Architecture• Central warehouse configured for

long term AWR data retention

• Historical and ongoing AWR snapshots collected from databases enabled for AWR warehouse

• ETL jobs moves snapshots from source databases into AWR warehouse

• Retention period configurable for weeks, months, years or forever (default)

Page 81: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Requirements

• AWR Warehouse Repository database must be 11.2.0.4 with patch or 12.1.0.2 with patch.

• Will support source databases 10.2.0.4 12.1.0.x

• EM12c 12.1.0.4 with

• Requires diagnostic and tuning pack. With these, limited EE license for use of AWR Warehouse Repository database.

• As long as no additional, (RAC, Dataguard, etc.) on AWR Warehouse repository database, the limited EE license will support.

Oracle Confidential 81

Page 82: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR ETL Jobs

Oracle Confidential – Internal/Restricted/Highly Restricted 82

DBMS Job on Source Database to directory

Job in EM Job Service that pulls file from Source Target and then pushes to AWR Warehouse Target Directory Final DBMS Job Inserts data

into AWR Warehouse

All data identified by OLD/NEW DBID and with the EM_ID, (CAW_DBID_MAPPING in AWR WAREHOUSE)

Source Target

Enterprise Manager

AWR Warehouse

Page 83: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Source Database ETL Job

DBMS Scheduler Job Name: MGMT_CAW_EXTRACT

Exec Call: begin dbsnmp.mgmt_caw_extract.run_extract; end;

How Often: 3 Hour Intervals if “playing catch up”, otherwise, 24 hr interval.

Oracle Confidential 83

Page 84: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

EM12c EM Job

• Agent to agent push.

• No other interaction with EM12c outside of interface.

Oracle Confidential 84

Page 85: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse ETL Load Job

DBMS Scheduler Job Name: MGMT_CAW_LOAD

Exec Call: begin dbsnmp.mgmt_caw_load.run_master;

How Often: 5 Minute Intervals

Biggest Resource Demand from the “run_master”:

begin dbms_swrf_internal.move_to_awr(schname => :1); end;

Oracle Confidential 85

Page 86: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

New DBSNMP Objects

CAW_EXTRACT_PROPERTIES : Information on ETL job, dump location and intervals.

CAW_EXTRACT_METADATA : All data about extracts- times, failures, details.

Oracle Confidential 86

Page 87: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Accessing

• First access, will be asked to set up AWR Warehouse to database.

• Request to add first source database to repository.

Oracle Confidential 87

Page 88: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse Interface• Warehouse dashboard tracking

ETL jobs

• All AWR features available on long term AWR data

• Performance page

• AWR report

• ASH analytics

• Compare Period ADDM

• Compare Period Report

• Integrated seamlessly into EM UI

• Zero runtime overhead on source Production databases

Page 89: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

How Do You Know You are Using it?

• Upper right hand corner drop down

• Can switch between and if non-existent, console will inform the user.

Oracle Confidential 89

Page 90: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse Configurations

Along with AWR Warehouse Basics-

• Configuration Status

• Version of Repository Database

• Host Information

• Connect Info, (SID/Service Name, Port)

• Space Usage, Upload Interval and Retention

Oracle Confidential 90

Page 91: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Databases and Reports

Considerable report options

Add or remove source databases to the warehouse.

Oracle Confidential 91

Page 92: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Snapshots

View snapshot loads per day

High loads due to catch up, new source db’s.

Oracle Confidential 92

Page 93: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Database Details

• Database, go to DB Details Page

• DB Type, DB Name, Version, Owner, Enabled

• Snapshot Information

Oracle Confidential 93

Page 94: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Upload Information

• Add

• Highlight, Remove

• Highlight, View Errors

• Privileges to Manage Snapshots

Oracle Confidential 94

Page 95: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Snapshot Information

• Oldest timestamp

• Newest timestamp

• Days of Snapshots

• Count

Oracle Confidential 95

Page 96: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Database List

Clicking on Target Name will TAKE YOU TO DB Performance Home Page!

Oracle Confidential 96

Page 97: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Menu

Oracle Confidential 97

Page 98: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ETL Load Errors

Oracle Confidential 98

Page 99: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Managing Snapshot Privileges

• Viewing Access

• Manage Snapshots

• Retention Time

• Removal of Snapshots

Oracle Confidential 99

Page 100: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Centralized AWR Warehouse Objects

Simple and clean schema edition to the DBNSMP.

Oracle Confidential 100

Page 101: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

What Can I do with the AWR Warehouse?

Oracle Confidential – Internal/Restricted/Highly Restricted 101

0

50000

100000

150000

200000

250000

300000

350000

400000

June 10, 2013

l_reads_s read_iops_max read_iops_direct read_iops_direct_max

0

100000

200000

300000

400000

500000

600000

June 10, 2014

l_reads_s read_iops_max read_iops_direct read_iops_direct_max

Page 102: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

CPU Usage Issues

“Nothing’s changed in months…”

Oracle Confidential 102

Page 103: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Using the AWR Warehouse for Capacity Planning

“Do we really need more partitioning and pruning? Our disk usage hasn’t increased this last year….”

Oracle Confidential 103

Page 104: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

CAW_DBID_MAPPING Table

Most important table for anyone querying the AWR Warehouse!

Oracle Confidential 104

Page 105: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Querying the AWR Warehouse Tips

Update Scripts with DBID identified to filter.

Join:

• CAW_DBID_MAPPING on OLD_DBID/NEW_DBID=DBID

• CAW_DBID_MAPPING on TARGET_NAME=TARGET_NAME

Oracle Confidential 105

Page 106: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

How Current AWR Queries Change

from dba_hist_sys_time_model stm, dba_hist_snapshot s, gv$parameter p, dbsnmp.caw_dbid_mapping m

where stm.stat_name in ('DB CPU','background cpu time')

and LOWER(m.target_name)= '&dbname'

and s.dbid= m.new_dbid and s.snap_id = stm.snap_id

and s.dbid = stm.dbid and s.instance_number = stm.instance_number

and p.name = 'cpu_count' and p.inst_id = s.instance_number)

Oracle Confidential 106

Page 107: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Answer Specific IT Questions

Page 108: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Updating Existing AWR Queries to Go Across Hosts

select * from (selectm.target_name,sum(CPU_TIME_DELTA),sum(DISK_READS_DELTA),count(*)fromDBA_HIST_SQLSTAT a, dba_hist_snapshot s, dba_hist_database_instance di, dbsnmp.caw_dbid_mapping mwhere di.host_name='&host'and di.dbid in m.new_dbidand m.new_dbid = a.dbidand a.snap_id = s.snap_idand s.begin_interval_time > sysdate -120group by m.target_nameorder bysum(CPU_TIME_DELTA) desc)

Page 109: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Graphing CPU Usage Per DB for One Host

Page 110: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Warehouse Scripts at DBAKevlar.com

More scripts added as time goes by…

Oracle Confidential 110

Page 111: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Want to Learn More?

Oracle Screenwatch: https://www.youtube.com/watch?v=StydMitHtuI

DBAKevlar Blog Posts:

http://dbakevlar.com/2014/06/awr-warehouse-in-em12c-rel-4/

http://dbakevlar.com/2014/06/awr-warehouse-in-em12c-rel-4-part-ii/

Scripts: http://dbakevlar.com/scripts/

Oracle Confidential 111

Page 112: UKOUG

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential 112

Connect with me via Social Media:

Page 113: UKOUG