1 数据库报错
Tue Mar 26 17:28:58 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
Tue Mar 26 17:28:59 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
Tue Mar 26 17:29:00 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
................
Wed Mar 27 07:44:50 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
Wed Mar 27 07:45:15 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
Wed Mar 27 07:45:40 GMT+08:00 2019ORA-1652: unable to extend temp segment by 128 in tablespace TEMP
2 查看临时表空间的使用率
SYS@host1>Select f.tablespace_name,sum(f.bytes_free + f.bytes_used) /1024/1024 "total MB",sum((f.bytes_free + f.bytes_used) - nvl(p.bytes_used, 0))/1024/1024 "Free MB",
2 sum(nvl(p.bytes_used, 0))/1024/1024 "Used MB",(sum(f.bytes_free + f.bytes_used)/sum(p.bytes_used))||'%' used
3 from sys.v_$temp_space_header f, dba_temp_files d, sys.v_$temp_extent_pool p
4 where f.tablespace_name(+) = d.tablespace_name and f.file_id(+) = d.file_id and p.file_id(+) = d.file_id group by f.tablespace_name;
TABLESPACE_NAME total MB Free MB Used MB USED
------------------------------ ---------- ---------- ---------- -----------------------------------------
TBS_PUB_TMP 6120 6120 0 %
TEMP 92119 24 92095 1.2%
TBS_OMCW_TMP 1020 1020 0 %
3 查看执行的SQL,发现多个SQL占用临时表空间相当大

4 查看相关SQl(83wwm4x3xkqac)的执行计划,走全表扫描 :
sql_id 83wwm4x3xkqac
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 83wwm4x3xkqac, child number 0
-------------------------------------
SELECT t.rule_status FROM UVMP_testxxx_RULE t WHERE t.area_id =:1
Plan hash value: 2149005957
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 3 (100)| |
|* 1 | TABLE ACCESS FULL| UVMP_testxxx_RULE | 1 | 36 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
查看UVMP_testxxx_RULE表的大小及行数
SYS@host1>select sum(bytes/1024/1024) from dba_segments where segment_nAME='UVMP_testxxx_RULE';
SUM(BYTES/1024/1024)
--------------------
.0625
SYS@host1>SELECT COUNT(*) FROM SGCAR.UVMP_testxxx_RULE;
COUNT(*)
----------
259
经查,此表占用空间不到1M,总行数259行,但为什么占用了17071M的临时表空间,
唯一的可能就是应用系统不释放资源导致的临时表空间耗尽。
查看多个SQL,都是相同的问题。
5 将应用的开发人员修改相关业务代码,问题得以彻底解决,经观察,半年内都未发生临时表空间足够用的情况 。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69996316/viewspace-2774055/ ,如需转载,请注明出处,否则将追究法律责任。