- 最后登录
- 2014-8-1
- 在线时间
- 37 小时
- 威望
- 0
- 金钱
- 194
- 注册时间
- 2013-2-4
- 阅读权限
- 10
- 帖子
- 25
- 精华
- 0
- 积分
- 0
- UID
- 914
|
1#
发表于 2013-9-3 15:55:10
|
查看: 5756 |
回复: 6
Maclean您好:
环境:
OS: 64bit RHEL 5.4
Oracle: 11.2.0.1.0
RAC: 2 nodes
有一句创建中间表的sql语句,涉及到很多表的join,hanging了很长时间,通过EM里面看到主要的等待事件是enq: TS - Contention. AWR的Top 5里面也是该事件排在第一位。我Google了一下, 可以通过下面的语句来释放临时表空间
alter session set events 'immediate trace name DROP_SEGMENTS level TS#+1';
正好看到刘大你的那篇《了解你所不知道的SMON功能(一):清理临时段》的文章里提到了这个方法。但是我执行
select * from dba_segments where segment_type='TEMPORARY';
却没有任何行返回回来,请问这个应该怎么解决?
03:41:00 SQL> select inst_id, tablespace_name TSNAME, TOTAL_EXTENTS TOTAL, USED_EXTENTS USED, FREE_EXTENTS FREE
03:41:16 2 from gv$sort_segment
03:41:25 3 order by 1;
INST_ID TSNAME TOTAL USED FREE
---------- ------------------------------- ---------- ---------- ----------
1 TEMPORARY_DATA 672234 15 672219
1 TEMP_TBLSP_GROUP 0 0 0
2 TEMPORARY_DATA 673439 673439 0
2 TEMP_TBLSP_GROUP 0 0 0
03:44:56 SQL> select inst_id, tablespace_name, round((total_blocks*8192)/(1024*1024*1024),2) "Space(GB)"
03:45:06 2 from gv$sort_segment
03:45:08 3 order by 1;
INST_ID TABLESPACE_NAME Space(GB)
---------- ------------------------------- ----------
1 TEMPORARY_DATA 326.48
1 TEMP_TBLSP_GROUP 0
2 TEMPORARY_DATA 330.62
2 TEMP_TBLSP_GROUP 0
SELECT d.tablespace_name "Name",
TO_CHAR(NVL(a.bytes / 1024 / 1024, 0),'99,999,990.900') "Size (M)",
TO_CHAR(NVL(t.hwm, 0)/1024/1024,'99999999.999') "HWM (M)",
TO_CHAR(NVL(t.hwm / a.bytes * 100, 0), '990.00') "HWM % " ,
TO_CHAR(NVL(t.bytes/1024/1024, 0),'99999999.999') "Using (M)",
TO_CHAR(NVL(t.bytes / a.bytes * 100, 0), '990.00') "Using %"
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) hwm, sum(bytes_used) 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.extent_management like 'LOCAL'
AND d.contents like 'TEMPORARY'
Name Size(M) HWM(M) HWM % Using(M) Using %
TEMPORARY_DATA 1,345,784.188 662634.000 49.24 15.000 0.00
另附上过去一小时的AWR report |
|