SELECT
alloc.TARGET_NAME,TO_DATE(TO_CHAR(alloc.timestamp, 'MON RR'), 'MON RR') AS
CALENDAR_MONTH,
alloc.tablespace AS TABLESPACE,
round(avg(alloc.avg_size_mb), 2) AS SIZE_MB,
round(avg(used.avg_used_mb), 2) AS USED_MB,
round(avg(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MB,
round(avg((used.avg_used_mb*100)/ decode(alloc.avg_size_mb, 0, 1,
alloc.avg_size_mb)), 2) AS USED_PCT,
round(max(alloc.max_size_mb), 2) AS SIZE_MAX_MB,
round(max(used.max_used_mb), 2) AS USED_MAX_MB,
round(max(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MAX_MB,
round(max((used.avg_used_mb*100)/decode(alloc.avg_size_mb, 0, 1,
alloc.avg_size_mb)), 2) AS USED_MAX_PCT,
round(min(alloc.min_size_mb), 2) AS SIZE_MIN_MB,
round(min(used.min_used_mb), 2) AS USED_MIN_MB,
round(min(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MIN_MB,
round(min((used.avg_used_mb*100)/decode(alloc.avg_size_mb, 0, 1,
alloc.avg_size_mb)), 2) AS USED_MIN_PCT
FROM
(SELECT m.key_value AS
TABLESPACE,t.TARGET_NAME,
m.rollup_timestamp AS TIMESTAMP,
avg(m.average) AS avg_size_mb,
min(m.minimum) AS min_size_mb,
max(m.maximum) AS max_size_mb
FROM
mgmt$metric_daily m,
mgmt$target_type t
WHERE t.TARGET_NAME='DB_NAME'
AND
(t.target_type='rac_database'
OR t.target_type='oracle_pdb'
OR (t.target_type='oracle_database'
AND t.TYPE_QUALIFIER3 != 'RACINST'))
AND
m.target_guid=t.target_guid
AND
m.metric_guid=t.metric_guid
AND
t.metric_name='tbspAllocation'
AND
(t.metric_column='spaceAllocated')
AND m.rollup_timestamp >SYSDATE -360
GROUP BY
m.rollup_timestamp,t.TARGET_NAME,
m.key_value) alloc,
(SELECT m.key_value AS
TABLESPACE,t.TARGET_NAME,
m.rollup_timestamp AS TIMESTAMP,
avg(m.average) AS avg_used_mb,
min(m.minimum) AS min_used_mb,
max(m.maximum) AS max_used_mb
FROM mgmt$metric_daily
m,
mgmt$target_type t
WHERE
t.TARGET_NAME='DB_NAME'
AND
(t.target_type='rac_database'
OR t.target_type='oracle_pdb'
OR (t.target_type='oracle_database'
AND t.TYPE_QUALIFIER3 != 'RACINST'))
AND
m.target_guid=t.target_guid
AND
m.metric_guid=t.metric_guid
AND
t.metric_name='tbspAllocation'
AND
(t.metric_column='spaceUsed')
AND m.rollup_timestamp > SYSDATE -360
GROUP BY
m.rollup_timestamp,t.TARGET_NAME,
m.key_value) used
WHERE
alloc.timestamp=used.timestamp
AND
alloc.tablespace=used.tablespace
GROUP BY
alloc.TARGET_NAME,TO_CHAR(alloc.timestamp, 'MON RR'),
alloc.tablespace;
Hello Jayesh,
ReplyDeleteMy name Siva, is there any scripts for tablespaces which are reached 85% threshold and at the same time, the growth of tablespace on daily basis with in same script from OEM BI publisher.
Could you please share the script if you have any to me.
Gmail : dsnagendra.dba@gmail.com
Thanks in advace
You can use Information published reports for table space threshold. for daily growth use above script and group it on day basis. I will try to build the same scrip and share on your email id.
ReplyDeleteThe query shows missing right parenthesis in oem 13c, data model.
ReplyDeleteFor the time is not checked in 13 C i will update on this very soon
DeleteAny update on the 13 c query for this ?
DeleteHi Jayesh,
ReplyDeleteI am in search for Tablespace utilization monitoring script from OEM repository tables.
Can you please help me by sharing the script on below mail ID if you are having it.
chennareddyn@hotmail.com