贴篇metalink的文章

How To Free Temporary Segment in Temporary Tablespace Dynamically

Purpose

-------

The purpose of this article is to advise on how to free the sort segment in a

temporary tablespace of type TEMPORARY.

Scope & Application

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

DBAs

How to free a sort segment

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

You want to liberate the sort segment created in its current temporary

tablespace of type TEMPORARY.  The storage clause associated with this segment

is not correct and you must change it.  But, as explained in [NOTE:102339.1],

the sort segment is only freed by smon on startup of the instance.

Sometimes it will be interesting to change the storage clause of the sort

segment without shutting down the database.  Particularly when these storage

clauses are too small, it will be interesting to increase it, to avoid

splitting of the temporary segment on too many extents.

Too many extents on a temporary segment may lead to spinning of smon on the

next startup of the database.  Please note that this extent maintenance will

take place immediately after you have freed them.

Answer

------

If you consider a sort segment which is already created on the current

temporary TEMP segment.

SQL> select tablespace_name, CURRENT_USERS, TOTAL_BLOCKS, USED_BLOCKS, FREE_BLOCKS

2  from v$sort_segment;

TABLESPACE_NAME     CURRENT_USERS TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS

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

TEMP                            0          120           0         120

You can see that this segment is split on 120 extents.  If you consider now the

storage clauses of the tablespace TEMP, you can change the storage parameters

to get a better allocation of sort segments using the ALTER TABLESPACE command.

SQL> select * from dba_tablespaces

2  where tablespace_name = 'TEMP';

TABLESPACE_NAME                INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS

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

MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   EXTENT_MAN

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

ALLOCATIO PLU

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

TEMP                                    65536       65536           1

0      65536 ONLINE    TEMPORARY LOGGING   DICTIONARY

USER      NO

These new storage clauses will be inherited only when recreating the sort

segment.  This can be done with the following sql command:

SQL> alter tablespace TEMP

2  default storage (pctincrease 0);

Please note, changing the default storage can only affect new objects, because of

which we need to create a new segment (to make the change effective). The old

segment (and its space) is released when it is no longer needed and since it

is cleaned up, the free space will be coalesced too.

This is the expected behaviour. If this is not desirable, then altering the tablespace

during normal operations should be avoided. Depending on the size of the original

segment, you could experience ORA-1562 errors.

If we query now the v$sort_segment:

SQL> select tablespace_name, current_users, total_blocks, used_blocks, free_blocks

2  from v$sort_segment;

no rows selected

In dba_segments, the same result is presented:

SQL> select owner, segment_name, segment_type from dba_segments

2  where tablespace_name = 'TEMP';

no rows selected

You can now affect new default storage clause associated with TEMP. On the

first next sort, the temporary sort segment will be recreated with the new

storage clauses.

oracle清理temp表空间,请问在oracle中temp表空间如何才能释放。相关推荐

  1. linux 写pci配置空间,[转载]应用程序中pci配置空间读写

    应用程序中pci配置空间读写 ~~~~~~~~~~~~~~~~~~~~~~~ 1. 概述 主要讲述在linux操作系统中应用程序如何读写pci配置空间. 2. 基本原理 对于pci设备,由cpu通过一 ...

  2. oracle的ocr是什么意思,Oracle11gR2——RAC中的表決磁盤、OCR與OLR

    1.表決磁盤 Oracle集群件使用表決磁盤來解決分區集群中的集群成員資格問題. 例如一個8節點集群,其節點之間發生通信中斷,4個節點不能與另外4個節點通信.此時表決磁盤幫助確定哪一組節點應當繼續正常 ...

  3. mysql shell 所有表_删除mysql数据库中所有表的shell脚本

    分享一个可以删除mysql中所有表的shell脚本,代码如下: 复制代码 代码示例: #!/bin/bash # 删除mysql中所有表 # 示例: # Usage: ./script user pa ...

  4. mysql数据库所有表合并_mysql数据库如何将表合并我从数据库中倒出表导出后是这样的b 爱问知识人...

    我从数据库中倒出表导出后是这样的 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE `sg` ( `username` varc ...

  5. java中创建数据表,Java如何在数据库中创建表?

    在此示例中,您可以看到如何在MySQL数据库中创建表.我们创建了一个称为表books具有以下字段,isbn,title,published_year和price.我们首先创建与数据库的连接,然后执行创 ...

  6. oracle建表时添加comment,MYSQL中创建表时可以直接声明comment,ORACLE中似乎不可以,那么oracle该怎样简明地声明comment...

    CREATE TABLE `smbms_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `userCode` varch ...

  7. oracle的into的含义,请问在oracle 中select into是什么意思?

    1.INSERT INTO SELECT语句 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Tab ...

  8. oracle赋予一个用户查询另一个用户中所有表

    说明:让用户selame能够查询用户ame中的所有表(不能添加和删除) 1.创建用户selame create user selame identified by Password; 2.设置用户se ...

  9. mysql 改变表的类型吗_mysql中修改表类型所带来的问题探讨

    对于MySQL数据库,如果你要使用事务以及行级锁就必须使用INNODB引擎.如果你要使用全文索引,那必须使用myisam,那如何修改修改MySQL的引擎为INNODB呢,下面介绍一个修改方法. 对于M ...

最新文章

  1. 终于搞懂了sleep/wait/notify/notifyAll
  2. 【jquery仿datalist的一个问题,求助】——设置每行显示几列,块状DIV的解决办法...
  3. python中文名字叫什么-Python为什么取名为Python,很少人知道
  4. Web前端开发笔记——第四章 JavaScript程序设计 第一节 JavaScript的基础语法
  5. URLEncoder.encode问题
  6. 江阴南菁高考2021高考成绩查询,江阴8所四星级高中高考成绩公布 南菁高中本一进线率达到了92.97%...
  7. 常用的hooks入门
  8. 二叉树 的建立及遍历 过程
  9. 深入理解JavaScript中的闭包
  10. 两个水平排列的div顶部对齐~详细
  11. R中Matrix and TMB package version issues
  12. 无需越狱手机,下载越狱版本IPA的方法
  13. 观《怎样成为一个高手》后感
  14. SSM面试题及相关答案
  15. win10系统怎么改奇摩输入法_Yahoo! 奇摩输入法
  16. 7系列主板 规格对比
  17. Linux基础操作篇
  18. UML(用例图,类图,对象图,包图)
  19. halcon测量距离
  20. X32汇编AAA,AAS,AAM,AAD,DAS,DAA

热门文章

  1. 目前住院病人主要由护士护理,这样做不仅需要大量护士
  2. 计算机专业英语动名词句子,40句英文写作开头表达+五类加分句型
  3. linux查看exif软件,EXIF信息查看器使用教程及功能解析
  4. python技术分享_Python技术分享:爬虫
  5. HTML+CSS制作知乎登录页面
  6. 文献 | fMRI入门指南
  7. python中axis的理解
  8. 计算机国际会议口头报告范例,国际会议口头报告ppt演讲内容准备模板
  9. Appium 手机 App 自动化代码说明_启动微信app
  10. VM虚拟机ssh免密登录其他主机