Thursday, August 14, 2008

V$TEMPSEG_USAGE

 Thank you for visiting Spatial DBA - Oracle and ArcSDE.

Please visit Oracle DBA Tips (http://www.oracledbatips.com) for more Oracle DBA Tips.

====================================================================


V$TEMPSEG_USAGE describes temporary segment usage.

Column
Datatype
Description
USERNAME
VARCHAR2(30)
User who requested temporary space
USER
VARCHAR2(30)
This column is obsolete and maintained for backward compatibility. The value of this column is always equal to the value in USERNAME.
SESSION_ADDR
RAW(4 | 8)
Address of shared SQL cursor
SESSION_NUM
NUMBER
Serial number of session
SQLADDR
RAW(4 | 8)
Address of SQL statement
SQLHASH
NUMBER
Hash value of SQL statement
SQL_ID
VARCHAR2(13)
SQL identifier of SQL statement
TABLESPACE
VARCHAR2(31)
Tablespace in which space is allocated
CONTENTS
VARCHAR2(9)
Indicates whether tablespace is TEMPORARY or PERMANENT
SEGTYPE
VARCHAR2(9)
Type of sort segment:
· SORT
· HASH
· DATA
· INDEX
· LOB_DATA
· LOB_INDEX
SEGFILE#
NUMBER
File number of initial extent
SEGBLK#
NUMBER
Block number of the initial extent
EXTENTS
NUMBER
Extents allocated to the sort
BLOCKS
NUMBER
Extents in blocks allocated to the sort
SEGRFNO#
NUMBER
Relative file number of initial extent
Note:
1. The script to find who and what sql is using temp segments
For 8.1.7 to 9.2
SELECT a.username, a.sid, a.serial#, a.osuser, b.tablespace, b.blocks, c.sql_text
FROM v$session a, v$sort_usage b, v$sqlarea c
WHERE a.saddr = b.session_addr
AND c.address= a.sql_address
AND c.hash_value = a.sql_hash_value
ORDER BY b.tablespace, b.blocks;
For 10.1 and above
SELECT a.username, a.sid, a.serial#, a.osuser, b.tablespace, b.blocks, c.sql_text
FROM v$session a, v$tempseg_usage b, v$sqlarea c
WHERE a.saddr = b.session_addr
AND c.address= a.sql_address
AND c.hash_value = a.sql_hash_value
ORDER BY b.tablespace, b.blocks;
2. The V$TEMPSEG_USAGE view identifies the current sort users in the temporary tablespace sort segments.

Oracle data dictionary views

Last updated: August 4, 2009
Thank you for visiting Spatial DBA - Oracle and ArcSDE.

I have stopped updating the blog.

Please visit Oracle DBA Tips (http://www.oracledbatips.com) for more Oracle DBA Tips.

====================================================================

No comments:

Post a Comment