oracle表空间怎么缩容,Oracle收缩临时表空间

当排序操作、重建索引等大型操作无法在内存中完成时,临时表空间将为排序提供便利。一般情况下临时表空间为多个用户,多个会话所

当排序操作、重建索引等大型操作无法在内存中完成时,,临时表空间将为排序提供便利。一般情况下临时表空间为多个用户,多个会话所共享。不能为会话分批空间配额。临时表空间耗用过度且在不能自动扩展的情形下将收到“ORA-1652:unable to extend temp segment” 错误.下面描述了过度扩展后如何释放临时表空间。

与之相关的内容参考:

Oracle 表空间与数据文件

Oracle 临时表空间的管理与受损恢复

Oracle 彻底 kill session

一、临时表空间何时释放

检索数据的会话游标关闭时,占用的临时空间即被释放

数据库关闭,重启(一般情况),会话 log off

二、释放过大的临时表空间

1、查看当前临时表空间的情况

SQL> select * from v$version where rownum<2;

BANNER

----------------------------------------------------------------

Oracle Database 10g Release 10.2.0.3.0 - 64bit Production

SQL> @temp_sort_segment

+==================================================================================+

| Segment Name : The segment name is a concatenation of the |

| SEGMENT_FILE (File number of the first extent) |

| and the |

| SEGMENT_BLOCK (Block number of the first extent) |

| Current Users : Number of active users of the segment |

| Total Temp Segment Size : Total size of the temporary segment in MB |

| Currently Used Bytes : Bytes allocated to active sorts |

| Extent Hits : Number of times an unused extent was found in the pool |

| Max Size : Maximum number of MB ever used |

| Max Used Size : Maximum number of MB used by all sorts |

| Max Sort Size : Maximum number of MB used by an individual sort |

| Free Requests : Number of requests to deallocate |

+==================================================================================+

-->此时临时表空间go_temp中达到了32GB

Tablespace Segment Current Currently Pct. Extent Max Max Used Max Sort Free

Name Name Users Used MB Used Hits Size MB Size MB Size MB Requests

-------------- -------- ------- --------- ---- -------- -------- -------- -------- --------

TEMP SYS.0.0 4 4 2 1,864 217 217 217 0

GO_TEMP SYS.0.0 0 0 0 1,305 32,766 367 367 0

************** ------- --------- -------- -------- -------- -------- --------

sum 4 4 3,169 32,983 584 584 0

SQL> col tbsname format a15

SQL> select s.name tbsname,t.name,(t.bytes/1024/1024) mb,t.status

2 from v$tablespace s,v$tempfile t

3 where s.ts# = t.ts#;

TBSNAME NAME MB STATUS

--------------- -------------------------------------------------- ---------- -------

TEMP /u02/database/ORADB/temp/tempORADB.dbf 235 ONLINE

GO_TEMP /u02/database/ORADB/temp/ORADB_tempORADB.dbf 32767 ONLINE

SQL> @temp_usage2 -->此时temp已使用的为4MB,而GO_TEMP未使用

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值