Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
+ added sga target advice for end_snapshot to AWR stats
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.izzysoft.de/public/osprep/trunk@468 b04bc735-7639-0410-8817-d65b05825077
  • Loading branch information
IzzySoft committed Oct 10, 2011
1 parent d49c1c7 commit c8482b1
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/history
Expand Up @@ -12,6 +12,8 @@ v0.4.7
+ some more context help
+ added pga target advice for end_snapshot to AWR stats (created depending
on MK_PGAA)
+ added sga target advice for end_snapshot to AWR stats (created depending
on MK_SGASUM)

v0.4.6 (17.09.2011)
-------------------
Expand Down
1 change: 1 addition & 0 deletions plugins/pga_head.pls
Expand Up @@ -114,6 +114,7 @@

PROCEDURE pgat IS
/** PGA Target Advice -- AWR only*/
BEGIN
NULL;
EXCEPTION
WHEN OTHERS THEN
Expand Down
1 change: 1 addition & 0 deletions plugins/sga_body.pls
@@ -1,5 +1,6 @@
-- Undo Segment Stats
sga_sum;
sga_advice;
IF MK_SGABREAK = 1 THEN
sga_break;
END IF;
Expand Down
10 changes: 10 additions & 0 deletions plugins/sga_head.pls
@@ -1,5 +1,6 @@

PROCEDURE sga_sum IS
/** SGA Memory Summary */
SIZ VARCHAR2(10);
CURSOR C_SGASum IS
SELECT name,
Expand Down Expand Up @@ -31,7 +32,16 @@
WHEN OTHERS THEN print(TABLE_CLOSE);
END;

PROCEDURE sga_advice IS
/** SGA Target Advice -- AWR only */
BEGIN
NULL;
EXCEPTION
WHEN OTHERS THEN NULL;
END;

PROCEDURE sga_break IS
/** SGA BreakDown Difference */
CURSOR C_SGABreak IS
SELECT nvl(replace(b.pool,'pool',''),' ') pool,
b.name name,
Expand Down
110 changes: 110 additions & 0 deletions plugins/sga_head_awr.pls
@@ -0,0 +1,110 @@

PROCEDURE sga_sum IS
/** SGA Memory Summary */
SIZ VARCHAR2(10);
CURSOR C_SGASum IS
SELECT name,
value val
FROM stats$sga
WHERE snap_id = EID
AND dbid = DB_ID
AND instance_number = INST_NUM
ORDER BY name;
BEGIN
L_LINE := TABLE_OPEN||'<TR><TH COLSPAN="2"><A NAME="sga">SGA Memory Summary</A></TH></TR>'||
' <TR><TD COLSPAN="2" ALIGN="center">Values at the time of the End SnapShot</TD></TR>';
print(L_LINE);
L_LINE := ' <TR><TH CLASS="th_sub">SGA Region</TH><TH CLASS="th_sub">Size</TH>';
print(L_LINE);
I1 := 0;
FOR R_SGASum in C_SGASum LOOP
SIZ := format_fsize(R_SGASum.val);
I1 := I1 + R_SGASum.val;
L_LINE := ' <TR><TD CLASS="td_name">'||R_SGASum.name||'</TD><TD ALIGN="right">'||
SIZ||'</TD></TR>';
print(L_LINE);
END LOOP;
SIZ := format_fsize(I1);
L_LINE := ' <TR><TD>Sum</TD><TD ALIGN="right">'||SIZ||
'</TD></TR>'||TABLE_CLOSE;
print(L_LINE);
EXCEPTION
WHEN OTHERS THEN print(TABLE_CLOSE);
END;

PROCEDURE sga_advice IS
/** SGA Target Advice -- AWR only */
FSI NUMBER; SIZ VARCHAR2(20); FAC VARCHAR2(10); TIM VARCHAR2(15); EPR VARCHAR2(15);
CURSOR C_Ad IS
SELECT sga_size,
sga_size_factor factor,
estd_db_time dbtime,
estd_physical_reads phyreads
FROM dba_hist_sga_target_advice
WHERE snap_id = EID
AND dbid = DB_ID
AND instance_number = INST_NUM
ORDER BY factor;
BEGIN
L_LINE := TABLE_OPEN||'<TR><TH COLSPAN="4"><A NAME="sga">SGA Target Advice</A></TH></TR>'||
' <TR><TD COLSPAN="4" ALIGN="center">Values at the time of the End SnapShot ('||EID||')</TD></TR>';
print(L_LINE);
L_LINE := ' <TR><TH CLASS="th_sub" TITLE="Value used for this estimation">SGA Size</TH>'||
'<TH CLASS="th_sub" TITLE="Size factor based on current setting">Factor</TH>';
print(L_LINE);
L_LINE := '<TH CLASS="th_sub" TITLE="Estimated DB Time">DBTime</TH>'||
'<TH CLASS="th_sub" TITLE="Estimated Physical Reads">PhyReads</TH></TR>';
print(L_LINE);
FOR rec IN C_Ad LOOP
FSI := rec.sga_size*1.024*1024*1024; -- values are in "false MB"
SIZ := format_fsize(FSI);
FAC := TO_CHAR(rec.factor,'99.999');
TIM := numformat(rec.dbtime);
EPR := numformat(rec.phyreads);
L_LINE := ' <TR><TD ALIGN="right">'||SIZ||'</TD><TD ALIGN="right">'||FAC||'</TD><TD ALIGN="right">'||TIM||'</TD><TD ALIGN="right">'||EPR||'</TD></TR>';
print(L_LINE);
END LOOP;
print(TABLE_CLOSE);
EXCEPTION
WHEN OTHERS THEN NULL;
END;

PROCEDURE sga_break IS
/** SGA BreakDown Difference */
CURSOR C_SGABreak IS
SELECT nvl(replace(b.pool,'pool',''),'&nbsp;') pool,
b.name name,
to_char(b.bytes,'999,999,999,999') snap1,
to_char(e.bytes,'999,999,999,999') snap2,
to_char(100* (e.bytes - b.bytes)/b.bytes,'9,990.00') diff
FROM stats$sgastat b, stats$sgastat e
WHERE b.snap_id = BID
AND e.snap_id = EID
AND b.dbid = DB_ID
AND e.dbid = DB_ID
AND b.dbid = e.dbid
AND b.instance_number = INST_NUM
AND e.instance_number = INST_NUM
AND b.instance_number = e.instance_number
AND b.name = e.name
AND nvl(b.pool,'a') = nvl(e.pool,'a')
ORDER BY b.pool, b.name;
BEGIN
L_LINE := TABLE_OPEN||'<TR><TH COLSPAN="5">SGA BreakDown Difference</TH></TR>'||
' <TR><TH CLASS="th_sub">Pool</TH><TH CLASS="th_sub">Name</TH>'||
'<TH CLASS="th_sub">Begin Value</TH>';
print(L_LINE);
L_LINE := '<TH CLASS="th_sub">End Value</TH><TH CLASS="th_sub">% Diff</TH></TR>';
print(L_LINE);
FOR R_SGASum in C_SGABreak LOOP
L_LINE := ' <TR><TD CLASS="td_name">'||R_SGASum.pool||'</TD><TD CLASS="td_name">'||
R_SGASum.name||'</TD><TD ALIGN="right">'||R_SGASum.snap1||
'</TD><TD ALIGN="right">'||R_SGASum.snap2||'</TD><TD ALIGN="right">'||
R_SGASum.diff||'</TD></TR>';
print(L_LINE);
END LOOP;
L_LINE := TABLE_CLOSE;
print(L_LINE);
EXCEPTION
WHEN OTHERS THEN NULL;
END;
6 changes: 5 additions & 1 deletion sreport.sh
Expand Up @@ -245,7 +245,11 @@ if [ "${MK_CACHSIZ}${MK_LC}${MK_DC}" != "000" ]; then
CACHEBODY=$PLUGINDIR/cache_body.pls
fi
if [ $MK_SGASUM -eq 1 ]; then
SGAHEAD=$PLUGINDIR/sga_head.pls
if [ $IS_AWR -eq 1 ]; then
SGAHEAD=$PLUGINDIR/sga_head_awr.pls
else
SGAHEAD=$PLUGINDIR/sga_head.pls
fi
SGABODY=$PLUGINDIR/sga_body.pls
fi
if [ $MK_IORA -eq 1 ]; then
Expand Down

0 comments on commit c8482b1

Please sign in to comment.