重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1113|回复: 0
打印 上一主题 下一主题

[参考文档] Temporary Segments In Permanent Tablespaces Aren't Cleaned For A Long Time

[复制链接]
跳转到指定楼层
楼主
发表于 2021-8-10 22:40:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Temporary Segments In Permanent Tablespaces Aren't Cleaned For A Long Time (Doc ID 1271120.1)        To BottomTo Bottom       


APPLIES TO:
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.

SYMPTOMS
Querying DBA_Segments shows a number of temporary segments in permanent tablespaces that aren't being cleaned up for a long time.

OWNER             SEGMENT_NAME  SEGMENT_TYPE  TABLESPACE_NAME
---------         ------------- ------------- -------------------------------------------
<schema_name>     6.4491        TEMPORARY     TBS_1
<schema_name>     22.3723       TEMPORARY     TBS_2

Checking V$sessions doesn't show any sessions for the owner of the segments:

SQL> select pid from v$process where addr in (select paddr from v$session where username='<schema_name>');

no rows selected

Checking V$session_longops doesn't show any related entries:

SQL> Select to_char(start_time,'dd-mm hh24:mi') start_time, to_char(sysdate, 'dd-mm hh24:mi') cur_time, username from V$session_longops;

no rows selected

Checking if SMON is disabled for cleanup of temporary segments:

SQL> show parameter events

-- If event 10061 is set at level 10, it implies that cleanup of temp segments by SMON is disabled
-- and 1st a check needs to be done if after disabling the event the segments are cleaned up:

SQL> alter system set events '10061 trace name context off';

Forcing SMON to clean up the temporary segments in the tablespace like below does not work:

SQL> ALTER TABLESPACE TBS_1 coalesce;

Bouncing the database does not clean up these segments.

CAUSE
This might be caused by having the permanent tablespaces in read-only mode before the temporary segments were cleaned up.
This causes SMON to not be able to clean them afterwards even when forcing it to using 'alter tablespace ... coalesce'.

Querying DBA_tablespaces shows that the tablespaces are in read-only mode.

SQL> Select tablespace_name, status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
TBS_1                       READ ONLY
TBS_2                       READ ONLY
SOLUTION
Change the tablespace to read-write mode. Then force SMON to clean-up the temporary segments. If needed put the tablespace back in read-only mode.

1. Put one of the table spaces in read-write mode.

SQL> alter tablespace TBS_1 read write;

2. Force SMON to clean up the temporary segments.

SQL> alter tablespace TBS_1 coalesce;

3. Put the table space back in read-only mode.

SQL> alter tablespace TBS_1 read only;


REFERENCES
NOTE:102339.1 - Temporary Segments: What Happens When a Sort Occurs
NOTE:106717.1 - How To Determine The Cause Of a Large TEMPORARY Segment In PERMANENT Tablespace
NOTE:177334.1 - Overview of Temporary Segments

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-26 05:58 , Processed in 0.083579 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表