-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2482d82
commit c0f4e2c
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com | ||
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions. | ||
|
||
-------------------------------------------------------------------------------- | ||
-- | ||
-- File name: sgastatx | ||
-- Purpose: Show shared pool stats by sub-pool from X$KSMSS | ||
-- | ||
-- Author: Tanel Poder | ||
-- Copyright: (c) http://www.tanelpoder.com | ||
-- | ||
-- Usage: @sgastatx <statistic name> | ||
-- @sgastatx "free memory" | ||
-- @sgastatx cursor | ||
-- | ||
-- Other: The other script for querying V$SGASTAT is called sgastat.sql | ||
-- | ||
-- | ||
-- | ||
-------------------------------------------------------------------------------- | ||
|
||
COL sgastatx_subpool HEAD SUBPOOL FOR a30 | ||
|
||
PROMPT | ||
PROMPT -- All allocations: | ||
|
||
SELECT | ||
'numa pool' | ||
, ksmnssidx | ||
, ksmnsprocgrp | ||
-- , ksmnsnam | ||
, ksmssgbl | ||
, sum(CASE WHEN ksmnsnam = 'free memory' THEN 0 ELSE ksmnslen END) mem_used | ||
, sum(CASE WHEN ksmnsnam = 'free memory' THEN ksmnslen ELSE 0 END) mem_free | ||
, sum(ksmnslen) mem_total | ||
from x$ksmns | ||
group by | ||
'numa pool' | ||
, ksmnssidx | ||
, ksmnsprocgrp | ||
-- , ksmnsnam | ||
, ksmssgbl | ||
order by | ||
1,2,3 | ||
/ | ||
|
||
SELECT | ||
'numa pool' | ||
, ksmnssidx | ||
, ksmnsprocgrp | ||
, ksmnsnam | ||
, ksmssgbl | ||
, sum(ksmnslen) | ||
from x$ksmns | ||
where lower(ksmnsnam) like lower('%&1%') | ||
group by | ||
'numa pool' | ||
, ksmnssidx | ||
, ksmnsprocgrp | ||
, ksmnsnam | ||
, ksmssgbl | ||
order by | ||
1,2,3 | ||
/ | ||
|
||
-- SELECT | ||
-- 'shared pool ('||NVL(DECODE(TO_CHAR(ksmdsidx),'0','0 - Unused',ksmdsidx), 'Total')||'):' sgastatx_subpool | ||
-- , SUM(ksmsslen) bytes | ||
-- , ROUND(SUM(ksmsslen)/1048576,2) MB | ||
-- FROM | ||
-- x$ksmss | ||
-- WHERE | ||
-- ksmsslen > 0 | ||
-- --AND ksmdsidx > 0 | ||
-- GROUP BY ROLLUP | ||
-- ( ksmdsidx ) | ||
-- ORDER BY | ||
-- sgastatx_subpool ASC | ||
-- / | ||
-- | ||
-- BREAK ON sgastatx_subpool SKIP 1 | ||
-- PROMPT -- Allocations matching "&1": | ||
-- | ||
-- SELECT | ||
-- subpool sgastatx_subpool | ||
-- , name | ||
-- , SUM(bytes) | ||
-- , ROUND(SUM(bytes)/1048576,2) MB | ||
-- FROM ( | ||
-- SELECT | ||
-- 'shared pool ('||DECODE(TO_CHAR(ksmdsidx),'0','0 - Unused',ksmdsidx)||'):' subpool | ||
-- , ksmssnam name | ||
-- , ksmsslen bytes | ||
-- FROM | ||
-- x$ksmss | ||
-- WHERE | ||
-- ksmsslen > 0 | ||
-- AND LOWER(ksmssnam) LIKE LOWER('%&1%') | ||
-- ) | ||
-- GROUP BY | ||
-- subpool | ||
-- , name | ||
-- ORDER BY | ||
-- subpool ASC | ||
-- , SUM(bytes) DESC | ||
-- / | ||
|
||
BREAK ON sgastatx_subpool DUP |