Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
tpt-oracle/sgastatx.sql
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
69 lines (62 sloc)
1.67 KB
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
-- 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 | |
'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 |