Oracle收缩临时表空间

php中文网
发布: 2016-06-07 17:29:54
原创
1457人浏览过

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

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

与之相关的内容参考:

Oracle 表空间与数据文件

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

Oracle 彻底 kill session

一、临时表空间何时释放

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

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

Smart Picture
Smart Picture

Smart Picture 智能高效的图片处理工具

Smart Picture 77
查看详情 Smart Picture

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


1、查看当前临时表空间的情况
SQL> select * from v$version where rownum

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未使用

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号