Michael -

I've had similar problems (although the pain isn't high enough for me to get
in there and fix them yet).  To do this I've set up a cron job to check
every 15 minutes.  The script I run is:

set lines 100 pages 87

column username format a10
column tablespace format a6 heading 'TBSP'
column segfile# format 999 heading 'FILE#'
column extents format 99999 heading 'EXT'
column blocks format 9999999

spool /tmp/sort&1

select s.username,
  su.session_addr,
  su.session_num,
  su.sqladdr,
  su.tablespace,
  su.contents,
  su.segtype,
  su.segfile#,
  sum(su.extents) extents,
  sum(su.blocks) blocks, 
  sum((su.blocks*p.value)/1024/1024) M,
  sa.sql_text
from v$sort_usage su, 
  v$session s, 
  v$sqlarea sa, 
  v$parameter p
where su.session_num = s.serial#
  and s.sql_address=sa.address
  and p.name = 'db_block_size'
  and s.username <> 'SYS'
group by s.username,
  su.session_addr,
  su.session_num,
  su.sqladdr,
  su.tablespace,
  su.contents,
  su.segtype,
  su.segfile#,
  sa.sql_text
/
select *
from v$sort_segment
/

exit;

My ksh script checks to see if there are rows returned and if so sends me
the information.  

HTH!

Linda

-----Original Message-----
Sent: Monday, September 10, 2001 10:20 AM
To: Multiple recipients of list ORACLE-L


Does anybody have a script that will tell you which session_ids are using
temp and how much they are using?  We occasionally get runaway sessions that
don't release temp and this would allow us to easily locate the offending
session.

I've already checked OraMag and used google with no significant results.

Thanks in advance.

--Michael
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jenkins, Michael
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Seley, Linda
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to