查看临时表空间的使用情况

Temporary Tablespaces 
  Data that is only used for the duration of a session is stored in a temporary tablespaces. Such data is for example the result of a sort (order by) operation. More specifically, the date is held in temporary segments. It is normal if temporary tablespaces appear full after a while. This is because the extents are not managed in the data dictionary but in memory. The reason is simple: updating the data dictionary would be an expensive operation. v$sort_usage and v$sort_segment can be used to find out who occupies the space in temporary Tablespaces. 

--查看谁在表空间临时表空间上做什么

SELECT se.username,
       se.sid,
       su.extents,
       su.blocks * to_number(rtrim(p.VALUE)) AS Space,
       su.tablespace,
       su.segtype,
       s.sql_text   
  FROM v$sort_usage su, v$parameter p, v$session se, v$sql s
 WHERE p.NAME = 'db_block_size'
   AND su.session_addr = se.saddr
   AND s.hash_value = su.sqlhash
   AND s.address = su.sqladdr   
 ORDER BY se.username, se.sid;

 

V$SORT_USAGE
Describes sort usage.

ColumnDatatypesDescription
USERNAMEVARCHAR2(30)User who requested temporary space
USERVARCHAR2(30)User who requested temporary space
SESSION_ADDRRAW(4)Address of shared SQL cursor
SESSION_NUMNUMBERSerial number of session
SQLADDRRAW(4)Address of SQL statement
SQLHASHNUMBERHash value of SQL statement
TABLESPACEVARCHAR2(31)Tablespace in which space is allocated
CONTENTSVARCHAR2(9)Indicates whether tablespace is TEMPORARY/PERMANENT
SEGTYPEVARCHAR2(9)
SEGFILE#NUMBERFile number of initial extent
SEGBLK#NUMBERBlock number of the initial extent
EXTENTSNUMBERExtents allocated to the sort
BLOCKSNUMBERExtents in blocks allocated to the sort
SEGRFNO#NUMBERRelative file number of initial extent
   

v$sort_segment

This view contains information about every sort segment in a given instance. The view is only updated when the tablespace is of the TEMPORARY type.

ColumnDatatypeDescription
TABLESPACE_NAMEVARCHAR2(31)Name of tablespace
SEGMENT_FILENUMBERFile number of the first extent
SEGMENT_BLOCKNUMBERBlock number of the first extent
EXTENT_SIZENUMBERExtent size
CURRENT_USERSNUMBERNumber of active users of the segment
TOTAL_EXTENTSNUMBERTotal number of extents in the segment
TOTAL_BLOCKSNUMBERTotal number of blocks in the segment
USED_EXTENTSNUMBERExtents allocated to active sorts
USED_BLOCKSNUMBERBlocks allocated to active sorts
FREE_EXTENTSNUMBERExtents not allocated to any sort
FREE_BLOCKSNUMBERBlocks not allocated to any sort
ADDED_EXTENTSNUMBERNumber of extent allocations
EXTENT_HITSNUMBERNumber of times an unused extent was found in the pool
FREED_EXTENTSNUMBERNumber of deallocated extents
FREE_REQUESTSNUMBERNumber of requests to deallocate
MAX_SIZENUMBERMaximum number of extents ever used
MAX_BLOCKSNUMBERMaximum number of blocks ever used
MAX_USED_SIZENUMBERMaximum number of extents used by all sorts
MAX_USED_BLOCKSNUMBERMaximum number of blocks used by all sorts
MAX_SORT_SIZENUMBERMaximum number of extents used by an individual sort
MAX_SORT_BLOCKSNUMBERMaximum number of blocks used by an individual sort
RELATIVE_FNONUMBERRelative file number of the sort segment header

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22514512/viewspace-614612/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22514512/viewspace-614612/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值