Rem awrcrt.sql Rem Rem Copyright (c) 2017 Oracle ACS. All rights reserved. Rem Rem NAME Rem awrcrt.sql Rem Rem DESCRIPTION Rem This script defaults the dbid and instance number to that of the Rem current instance connected-to, then produce Rem the Workload Repository CHART report. Rem VERSION Rem 2.0 Rem MODIFIED (MM/DD/YY) Rem Wang Wenjie 2015-06-12 - Created 0.1 version Rem Wang Wenjie 2016-03-26 - release 1.0 version Rem Wang Wenjie 2016-12-06 - Created 2.0 version Rem Ma Xuefeng 2016-01-10 - Modified, replaced sql to plsql Rem Wang Wenjie 2016-01-16 - Modified, replaced sql to plsql Rem Wang Wenjie 2016-01-18 - Modified major bug set feedback off prompt prompt Current Instance prompt ~~~~~~~~~~~~~~~~ select d.dbid dbid , d.name db_name , i.instance_number inst_num , i.instance_name inst_name from v$database d, v$instance i; prompt prompt Specify the number of days of snapshots to choose from prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ define days=&0 set linesize 999 select a.snap_id, to_char(a.begin_interval_time,'yyyy-mm-dd hh24:mi:ss') snap_time from dba_hist_snapshot a where a.instance_number=(select b.instance_number from v$instance b) and a.begin_interval_time > sysdate-&days order by 1; /***************************************** --parameter1 begin snap id --parameter2 end snap id --parameter3 split X ( input 80 for thinkpad X230,X250) --parameter4 instance number Author: Date : 2017-01 *****************************************/ set termout on set echo off set heading on prompt Specify the Begin and End Snapshot Ids prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ COLUMN spool_time NEW_VALUE _spool_time NOPRINT SELECT TO_CHAR(SYSDATE,'YYYYMMDDhh24miss') spool_time FROM dual; COLUMN iv NEW_VALUE _iv NOPRINT select trunc(3600*24*(sysdate+snaP_interval-sysdate)) iv from dba_hist_wr_control; COLUMN dbname NEW_VALUE _dbname NOPRINT SELECT name dbname FROM v$database; prompt begin snap id is define bid=&1 prompt end snap id is define eid=&2 prompt time point limit to split X-axis is : (for instance ,using thinkpad x230, better to be 80) define maxx=&3 prompt instance number is define inid=&4 set termout on set echo off set heading on set long 2000000 set pages 0 set linesize 999 set termout off set echo off set feedback off set heading off set verify off set wrap on set trimspool on set serveroutput on size unlimited set escape on COLUMN vp NEW_VALUE _vp NOPRINT SELECT case when &eid-&bid>500 then 6 when &eid-&bid>350 then 4 else 2 end vp FROM dual; --spool awrcrt_&_dbname._&_spool_time..html spool awrcrt_&_dbname._&inid._&bid._&eid..html prompt prompt prompt prompt promptAWR Chart Report 1.2 prompt prompt prompt prompt promptprompt WORKLOAD REPOSITORY CHART report for prompt
prompt promptprompt
prompt promptprompt DB Name DB Id Instance Inst num Release RAC Host prompt SELECT A.NAME||' ' ||A.DBID||' '||(SELECT B.INSTANCE_NAME||' '||&inid||' '||B.VERSION || ' '||(SELECT value FROM V$PARAMETER C WHERE C.NAME ='cluster_database')||' '||b.HOST_NAME FROM V$INSTANCE B WHERE B.INSTANCE_NUMBER=1) FROM V$DATABASE A; prompt prompt
prompt prompt promptprompt Snap Id Snap Time prompt Begin Snap: &bid select nvl((select to_char(a.begin_interval_time,'yyyy-mm-dd hh24:mi:ss') from dba_hist_snapshot a where a.instance_number=&inid and a.snap_id=&bid), 'minimum snap time') from dual; prompt prompt End Snap: &eid select nvl((select to_char(a.begin_interval_time,'yyyy-mm-dd hh24:mi:ss') from dba_hist_snapshot a where a.instance_number=&inid and a.snap_id=&eid), 'maximum snap time') from dual; prompt prompt Main Report prompt
prompt
promptprompt
prompt prompt- CPU Utilization
prompt- Time Model : DB TIME DB CPU SQL EXEC TIME
prompt- Active session history
prompt- SQL execution count
prompt- Average SQL execution time
prompt- Session logic reads
prompt- Physical writes and reads
prompt- User commits
prompt- Connections
prompt- Redo Size
prompt- Global cache transformation
prompt- Global cache lost
prompt- GCS/GES messages
prompt- Global Cache Average CR Time
prompt- Global Cache Average Current Get Time
prompt- Buffer Cache Hit POINT
prompt- PGA Cache Hit POINT
prompt- Library Hit POINT
prompt- Latch Hit POINT
prompt- Latch:shared pool
prompt- Latch:row cache objects
prompt- Latch:cache buffers chains
prompt- Latch:cache buffers lru chain
prompt- Latch:gc element
prompt- Latch:DML lock allocation
prompt- Parse count
prompt- Hard parse count
prompt- Slowest File Average Read Wait time
prompt- Table fetch continued row
prompt- Dirty buffers inspected
prompt- Cell physical IO bytes eligible for predicate offload
prompt- Cell physical IO bytes saved by storage index
prompt- Cell physical IO interconnect bytes returned by smart scan
prompt- Cell IO uncompressed bytes
prompt- Top 5 Wait Event
prompt- Top 5 Wait Event trends
promptCpu Utilization
promptprompt
promptprompt promptSERVER CPU promptDB CPU promptBACKUP CPU promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptTime model: DB TIME , DB CPU TIME, SQL EXECUTION TIME
promptprompt
promptprompt promptDB TIME promptDB CPU promptSQL EXEC TIMES promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptActive Session History
promptprompt
promptprompt promptCPU promptConcurrency promptSystemio promptuserio promptAdministrative promptConfiguration promptApplication promptNetwork promptCommit promptScheduler promptCluster promptQueueing promptOther promptCPU promptConcurrency promptSystemio promptuserio promptAdministrative promptConfiguration promptApplication promptNetwork promptCommit promptScheduler promptCluster promptQueueing promptOther promptCPU promptConcurrency promptSystemio promptuserio promptAdministrative promptConfiguration promptApplication promptNetwork promptCommit promptScheduler promptCluster promptQueueing promptOther promptCPU promptConcurrency promptSystemio promptuserio promptAdministrative promptConfiguration promptApplication promptNetwork promptCommit promptScheduler promptCluster promptQueueing promptOther promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptWorkload: SQL EXECUTION COUNT
promptprompt
promptprompt promptSQL EXECUTION COUNT Per Second promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptAVERAGE SQL EXECUTION TIME
promptprompt
promptprompt promptAVG SQL EXECUTION TIME promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptSESSION LOGIC READS AND CONSISTENT GETS
promptprompt
promptprompt promptSESSION LOGIC READ Per Second promptCONSISTENT GETS Per Second promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptPHYSICAL WRITES AND READS
promptprompt
promptprompt promptPHYSICAL READ (MB) Per Second promptPHYSICAL WRITE (MB) Per Second promptComments: promptpromptprompt Back to Top prompt promptprompt promptprompt>USER COMMITS
promptprompt
promptprompt promptUSER COMMITS Per Second promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptCONNECTIONS
promptprompt
promptprompt promptPROCESSES promptSESSIONS promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptREDO SIZE
promptprompt
promptprompt promptREDO LOG SIZE(MB) promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptGLOBAL CACHE TRANSFORMATION
promptprompt
promptprompt promptGlobal Cache blocks received KB / second promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptGLOBAL CACHE LOST
promptprompt
promptprompt promptGlobal Cache blocks lost promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptGCS/GES MESSAGES
promptprompt
promptprompt promptGCS/GES messages sent: promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptGlobal Cache Average CR Time
promptprompt
promptprompt promptAverage promptMaxval promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptGlobal Cache Average Current Get Time
promptprompt
promptprompt promptAverage promptMaxval promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptBuffer Cache hit point
promptprompt
promptprompt prompthit point promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptPGA Cache hit point
promptprompt
promptprompt prompthit point promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptLibrary Hit Point
promptprompt
promptprompt prompthit point promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptLatch hit point
promptprompt
promptprompt promptLatch hit point % promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:shared pool
promptprompt
promptprompt promptLatch:shared pool - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:row cache objects
promptprompt
promptprompt promptLatch:row cache objects - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:cache buffers chains
promptprompt
promptprompt promptLatch:cache buffers chains - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:cache buffers lru chain
promptprompt
promptprompt promptLatch:cache buffers lru chain - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:gc element
promptprompt
promptprompt promptLatch:gc element - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptLatch:DML lock allocation
promptprompt
promptprompt promptLatch:DML lock allocation - MISSES RATE N/10000 promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptParses
promptprompt
promptprompt promptParses Per Second (count) promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptHard Parse
promptprompt
promptprompt promptHard Parses Per Second (count) promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptTop3 File Average Read Time
promptprompt
promptprompt promptTop3 File Average Read Time MS promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptTable fetch continued row
promptprompt
promptprompt promptTable fetch continued row / Second promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptDirty buffers inspected
promptprompt
promptprompt promptDirty buffers inspected / Second promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptCell physical IO MB eligible for predicate offload
promptprompt
promptprompt promptCell physical IO MB eligible for predicate offload / Second promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptCell physical IO MB saved by storage index
promptprompt
promptprompt promptCell physical IO MB saved by storage index / Second promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptCell physical IO interconnect MB returned by smart scan
promptprompt
promptprompt promptCell physical IO interconnect MB returned by smart scan / Second promptComments: promptpromptprompt Back to Top prompt prompt promptprompt promptpromptCell IO uncompressed MB
promptprompt
promptprompt promptCell IO uncompressed MB / Second promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptTop5 Wait Event
promptprompt
promptprompt promptTop5 Wait Event Of Whole Period promptComments: promptpromptprompt Back to Top prompt promptprompt promptpromptTop 5 Wait Event trends
promptpromptprompt Back to Top prompt prompt prompt promptdeclare vevent varchar2(100); vtime number; vavgtime number; vpctwt number; vwaits number; vwaitclass varchar2(100); vbid number ; veid number ; vinid number:=&inid; startid number:=&bid; endid number:=&eid; vstarttime varchar2(200); vendtime varchar2(200); cursor c1 is SELECT EVENT, WAITS, trunc(TIME,2), trunc(DECODE(WAITS, NULL, TO_NUMBER(NULL), 0, TO_NUMBER(NULL), TIME / WAITS * 1000),2) AVGWT, trunc(PCTWTT,2) , WAIT_CLASS FROM (SELECT EVENT, WAITS, TIME, PCTWTT, WAIT_CLASS FROM (SELECT E.EVENT_NAME EVENT, E.TOTAL_WAITS_FG - NVL(B.TOTAL_WAITS_FG, 0) WAITS, (E.TIME_WAITED_MICRO_FG - NVL(B.TIME_WAITED_MICRO_FG, 0)) / 1000000 TIME, 100 * (E.TIME_WAITED_MICRO_FG - NVL(B.TIME_WAITED_MICRO_FG, 0)) / ((SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL e WHERE e.SNAP_ID = veid AND e.INSTANCE_NUMBER = vinid AND e.STAT_NAME = 'DB time') - (SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL b WHERE b.SNAP_ID = vbid AND b.INSTANCE_NUMBER = vinid AND b.STAT_NAME = 'DB time')) PCTWTT, E.WAIT_CLASS WAIT_CLASS FROM DBA_HIST_SYSTEM_EVENT B, DBA_HIST_SYSTEM_EVENT E WHERE B.SNAP_ID(+) = vbid AND E.SNAP_ID = veid AND B.INSTANCE_NUMBER(+) = vinid AND E.INSTANCE_NUMBER = vinid AND B.EVENT_ID(+) = E.EVENT_ID AND E.TOTAL_WAITS > NVL(B.TOTAL_WAITS, 0) AND E.WAIT_CLASS != 'Idle' UNION ALL SELECT 'CPU time' EVENT, TO_NUMBER(NULL) WAITS, ((SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL e WHERE e.SNAP_ID = veid AND e.INSTANCE_NUMBER = vinid AND e.STAT_NAME = 'DB CPU') - (SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL b WHERE b.SNAP_ID = vbid AND b.INSTANCE_NUMBER = vinid AND b.STAT_NAME = 'DB CPU')) / 1000000 TIME, 100 * ((SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL e WHERE e.SNAP_ID = veid AND e.INSTANCE_NUMBER = vinid AND e.STAT_NAME = 'DB CPU') - (SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL b WHERE b.SNAP_ID = vbid AND b.INSTANCE_NUMBER = vinid AND b.STAT_NAME = 'DB CPU')) / ((SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL e WHERE e.SNAP_ID = veid AND e.INSTANCE_NUMBER = vinid AND e.STAT_NAME = 'DB time') - (SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL b WHERE b.SNAP_ID = vbid AND b.INSTANCE_NUMBER = vinid AND b.STAT_NAME = 'DB time')) PCTWTT, NULL WAIT_CLASS from dual WHERE ((SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL e WHERE e.SNAP_ID = veid AND e.INSTANCE_NUMBER = vinid AND e.STAT_NAME = 'DB CPU') - (SELECT sum(value) FROM DBA_HIST_SYS_TIME_MODEL b WHERE b.SNAP_ID = vbid AND b.INSTANCE_NUMBER = vinid AND b.STAT_NAME = 'DB CPU')) > 0) ORDER BY TIME DESC, WAITS DESC) WHERE ROWNUM <= 5; begin for i in startid..endid-1 loop vbid:=i; veid:=i+1; select to_char(a.end_interval_time,'yyyy-mm-dd hh24:mi') into vstarttime from dba_hist_snapshot a where snap_id=vbid and instance_number=&inid; select to_char(a.end_interval_time,'yyyy-mm-dd hh24:mi') into vendtime from dba_hist_snapshot a where snap_id=veid and instance_number=&inid; dbms_output.put_line('prompt'); end loop; end; / prompt
'||vstarttime||' to '||vendtime); dbms_output.put_line(' '); open c1; loop fetch c1 into vevent,vwaits,vtime,vavgtime,vpctwt,vwaitclass; exit when c1%notfound; dbms_output.put_line( ' Event Waits '); dbms_output.put_line('Time(s) Avg wait (ms) % DB time Wait Class ' ); dbms_output.put_line(' ' ); end loop; close c1; dbms_output.put_line(''||vevent||' ' ); dbms_output.put_line(''||vwaits||' ' ); dbms_output.put_line(''||vtime||' ' ); dbms_output.put_line(''||vavgtime||' ' ); dbms_output.put_line(''||vpctwt||' ' ); dbms_output.put_line(''||vwaitclass||' ' ); dbms_output.put_line('
prompt prompt The License of Awr Chart prompt
prompt Permission is hereby granted by Author, free of charge, to any person abotaining a copy of this software, prompt
prompt to deal in the software without restriction, including without limitation the rights to use,copy or distribute . prompt
prompt The copy right of Chart javascript belongs to its author Nick Downie (http://www.nickdownie.com/) . This js is an open source project which prompt
prompt is under MIT license. prompt
prompt Author : prompt
Wang,Wenjie prompt
Ma,Xuefeng From promptprompt Oracle Advanced Customer Support prompt
prompt
prompt Technical support: Send email to WangWenjie - valen.wang@oracle.com prompt
prompt Version : 1.2 prompt
prompt Date : 2016-10 prompt prompt spool off set termout on !cat awrcrt_&_dbname._&inid._&bid._&eid..html|grep ORA-; prompt report wrote to awrcrt_&_dbname._&inid._&bid._&eid..html
Friday, June 16, 2017
awr
Subscribe to:
Posts (Atom)