Linux 临时表空间满了,Temporary表空间100%解决方案

本文档介绍了如何使用Oracle的DROP_SEGMENTS事件来手动清理temp表空间中的未锁定临时段。这个事件允许用户在SMON(系统监视器)未能及时清理时介入,主要适用于8.0及以上版本。通过指定表空间号,可以针对特定表空间或所有表空间执行此操作。例如,若temp表空间号为5,可以通过ALTER SESSION设置事件来立即执行清理。建议在大量删除临时段后使用ALTER TABLESPACE COALESCE进行整理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

说明:

temp表空间的TS# 为 3*, So TS#+ 1= 4

一下是摘自Metalink的说明

The DROP_SEGMENTS event

~~~~~~~~~~~~~~~~~~~~~~~

Available from 8.0 onwards.

DESCRIPTION

Finds all the temporary segments in a tablespace which are not

currently locked and drops them.

For the purpose of this event a "temp" segment is defined as a

segment (seg$ entry) with TYPE#=3. Sort space in a TEMPORARY

tablespace does not qualify under this definition as such

space is managed independently of SEG$ entries.

PARAMETERS

level - tablespace number+1. If the value is 2147483647 then

temp segments in ALL tablespaces are dropped, otherwise, only

segments in a tablespace whose number is equal to the LEVEL

specification are dropped.

NOTES

This routine does what SMON does in the background, i.e. drops

temporary segments. It is provided as a manual intervention tool which

the user may invoke if SMON misses the post and does not get to

clean the temp segments for another 2 hours. We do not know whether

missed post is a real possibility or more theoretical situation, so

we provide this event as an insurance against SMON misbehaviour.

Under normal operation there is no need to use this event.

It may be a good idea to

alter tablespace coalesce;

after dropping lots of extents to tidy things up.

*SQL Session (if you can connect to the database):

alter session set events 'immediate trace name DROP_SEGMENTS level TS#+1';

The TS# can be obtained from v$tablespace view:

select ts# from v$tablespace where name = '';

Or from SYS.TS$:

select ts# from sys.ts$ where name = '' and online$ != 3;

If ts# is 5, an example of dropping the temporary segments in that tablespace

would be:

alter session set events 'immediate trace name DROP_SEGMENTS level 6';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值