large sort [message #115923] |
Fri, 15 April 2005 05:31  |
_simma_dba
Messages: 34 Registered: November 2003
|
Member |
|
|
We have temporary tablespace that gorws very large from time to time. I know there is problem with sorting but I cant find query that couse problem. My question is: how can I find query that use temp tablespace so i can tune it?
thx in advance s.
|
|
|
Re: large sort [message #115929 is a reply to message #115923] |
Fri, 15 April 2005 05:53   |
Frank Naude
Messages: 4566 Registered: April 1998
|
Senior Member |
|
|
Try something like this:
SQL> col sid format 999 heading "Session ID"
SQL> col username format a10 heading "User Name"
SQL> col tablespace format a10 heading "Tablespace"
SQL> col mb format 999,999,990 heading "Used Space (Meg)"
SQL> col pct format 990.00 heading "% of Avail TS Space"
SQL> col sql_text heading "SQL"
SQL>
SQL> select s.sid,
2 s.username,
3 u.tablespace,
4 u.blocks/128 mb,
5 a.sql_text
6 from v$sort_usage u,
7 v$session s,
8 v$sqlarea a
9 where s.saddr = u.session_addr
10 and a.address (+) = s.sql_address
11 and a.hash_value (+) = s.sql_hash_value
12 group by s.sid, s.username, u.tablespace, u.blocks/128, a.sql_text
13 /
Session ID User Name Tablespace Used Space (Meg)
---------- ---------- ---------- ----------------
SQL
--------------------------------------------------------------------------------
146 SCOTT TEMP 4
select * from bigemp order by ename
Best regards.
Frank
|
|
|
|
|
|