Script to find TEMP tablespace usage
Posted by Pavan DBA on December 27, 2011
Many a times we would be facing problem that “temp tablespace is out of space” and even after resizing or adding tempfile, still problem will exist. We really want to know who is consuming the space. The below queries will help you in identifying the culprit….
####################################
FINDING TEMP USAGE
###################################
SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)
FROM V$temp_space_header
GROUP BY tablespace_name;
===Utilization by User:
select s.username, u.”USER”, u.tablespace, u.contents, u.extents, u.blocks
from sys.v_$session s, sys.v_$sort_usage u
where s.saddr = u.session_addr;
SELECT distinct p.NAME,
s.VALUE
FROM v$sessTat s,
v$sTatName p
WHERE s.sTatIsTic# = p.sTatIsTic#
AND p.NAME IN (‘session uga memory’,
‘session uga memory max’)
AND s.sId IN (SELECT sId
FROM v$Session
WHERE UserName = ‘&USERNAME’);
Leave a Reply