Check historical data/Monitor Temp tablespace usage [message #616368] |
Mon, 16 June 2014 04:17 |
|
ledo60
Messages: 63 Registered: May 2014
|
Member |
|
|
Hi,
Please assist for geting a script to read the historical data usage for TEMP tablespace .
Actualy i need the value of the MAX usage/day for the previous days i tested this code but it's not the same as toad when comparing.
Please advice
select thedate,
gbsize,
prev_gbsize,
gbsize-prev_gbsize diff
from (
select thedate,
gbsize,
lag(gbsize,1) over (order by r) prev_gbsize
from (
select rownum r,
thedate,
gbsize
from (
select trunc(thedate) thedate,
max(gbsize) gbsize
from (
select to_date(to_char(snapshot.begin_interval_time,'YYYY-MON-DD HH24:MI:SS'),'YYYY-MON-DD HH24:MI:SS') thedate,
round((usage.tablespace_usedsize*block_size.value)/1024/1024/1024,2) gbsize
from dba_hist_tbspc_space_usage usage,
v$tablespace tablespace,
dba_hist_snapshot snapshot,
v$parameter block_size
where usage.snap_id = snapshot.snap_id
and usage.tablespace_id = tablespace.ts#
and tablespace.name = '&tablespace'
and block_size.name = 'db_block_size'
)
group by
trunc(thedate)
order by
trunc(thedate)
)
)
);
CM: fixed end code tag. It needs to start with a /
[Updated on: Mon, 16 June 2014 04:27] by Moderator Report message to a moderator
|
|
|
|
|
|