查询临时表空间使用率:
SELECT d.status "Status", d.tablespace_name "Name", d.contents "Type", d.extent_management "Extent",
TO_CHAR(NVL(a.bytes / 1024 / 1024, 0),'99,999,999') "Size (M)",
TO_CHAR(NVL(t.bytes,0)/1024/1024,'999,999,999') "Used (M)",
TO_CHAR(NVL(t.bytes / a.bytes * 100, 0), '990.00') "Used %" FROM sys.DBA_tablespaces d,
(select tablespace_name, sum(bytes) bytes from dba_temp_files group by tablespace_name) a, (select
tablespace_name, sum(bytes_cached) bytes from v$temp_extent_pool group by tablespace_name) t WHERE
d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = t.tablespace_name(+) AND d.contents like 'TEMPORARY';
Status Name Type Extent Size (M) Used (M) Used %
--------- ------------------------------ --------- ---------- ----------- ------------ -------
ONLINE TEMP TEMPORARY LOCAL 16,384 16,280 99.37
ONLINE TEMP_SZFS TEMPORARY LOCAL 18,048 9,016 49.96
查询其实际用了多少,给谁用:
SQL> select tablespace_name,current_users,total_blocks,used_blocks,free_blocks from v$sort_segment;
TABLESPACE_NAME CURRENT_USERS TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
------------------------------- ------------- ------------ ----------- -----------
TEMP 10 2083840 1280 2082560
TEMP_SZFS 0 1154048 0 1154048
SQL> select username,session_addr,sqladdr,sqlhash from v$sort_usage;
USERNAME SESSION_ADDR SQLADDR SQLHASH
------------------------------ ---------------- ---------------- ----------
GGATE 070000069CC5A4D0 070000064C4280F8 2415331538
07000006A913E3F0 0700000659E796F8 3428604210
07000006A913E3F0 0700000659E796F8 3428604210
GGATE 070000069CC5A4D0 070000064C4280F8 2415331538
GGATE 070000069CC5A4D0 070000064C4280F8 2415331538
GGATE 070000069CC5A4D0 070000064C4280F8 2415331538
GGATE 070000069CC5A4D0 070000064C4280F8 2415331538
GGATE 07000006ACFE0668 07000006167C1BF0 1716416632
SZFS 07000006A8E7C568 07000006322C1EC8 3424766009
SZFS 07000006A8E7C568 07000006322C1EC8 3424766009
解决方法: 由于老有投诉说临时表空间告警,增加了很多次,还是不行,解释的时候说真正在用的很少,没关系的,但是非自动扩展,我建议不要改成自动扩展,像这种方式,
重建临时表空间,临时表空间使用率下降,过一天后又达99%, 怀疑可能是磁盘排序导致,
据google介绍,磁盘排序完,会由smon进程释放临时段; The sort segment is created by the first statement that uses a temporary tablespace for sorting, after startup, and is released only at shutdown,但官网描述是这样的。
进一步连续做了几天的awr报告. In-momory sort 是100%.现在真不知从何查询起,向大师请教! |
|