Chinaunix首页 | 论坛 | 博客
  • 博客访问: 379842
  • 博文数量: 120
  • 博客积分: 5051
  • 博客等级: 大校
  • 技术积分: 1255
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-03 01:25
文章分类

全部博文(120)

文章存档

2011年(2)

2010年(11)

2009年(28)

2008年(26)

2007年(53)

我的朋友

分类: Oracle

2008-08-01 16:36:37

整理自由空间碎片
 
一个段可能包含多个区间,这些区间不一定彼此相邻,由于数据库总是寻找表空间中最大的自由区间来使用, 这样一来就形成了越来越多离散的,分隔的,较小的自由空间,即碎片。而最大自由区间越来越小,这样就会导至表空间中的速度下降,所以有必要对这些碎片进行整理。
 
在此处插入extent management的说明:

The extent_management_clause lets you specify how the extents of the tablespace will be managed.

 
EXTENT MANAGEMENT
   { DICTIONARY
   | LOCAL
     [ AUTOALLOCATE
     | UNIFORM
       [ SIZE size_clause ]
     ]
   }
对于extent有两种管理方式:
一是本地管理表空间,即local,它又有种两种方式
                                       autoallocate,系统自动管理
                                       uniform 自已定义extent的大小,默认是1M
一是在数据字典中管理,即dictionary

If you do not specify the extent_management_clause, then Oracle Database interprets the MINIMUM EXTENT clause and the DEFAULT storage_clause to determine extent management.

  • If you do not specify the DEFAULT storage_clause, then the database creates a locally managed autoallocated tablespace.

  • If you did specify the DEFAULT storage_clause, then:

    • If you specified the MINIMUM EXTENT clause, then the database evaluates whether the values of MINIMUM EXTENT, INITIAL, and NEXT are equal and the value of PCTINCREASE is 0. If they are equal, then the database creates a locally managed uniform tablespace with extent size = INITIAL. If the MINIMUM EXTENT, INITIAL, and NEXT parameters are not equal, or if PCTINCREASE is not 0, then the database ignores any extent storage parameters you may specify and creates a locally managed, autoallocated tablespace.

    • If you did not specify MINIMUM EXTENT clause, then the database evaluates only whether the storage values of INITIAL and NEXT are equal and PCTINCREASE is 0. If they are equal, then the tablespace is locally managed and uniform. Otherwise, the tablespace is locally managed and autoallocated.

如果PCTINCREASE为0,则Segment中所有新增加的Extent的大小都相同,等于NEXT的值;
要进行碎片的整理,有两种方法:
一是利用smon后台进程;(用这种方法时注意设置pctincrease的值必须为非0,一般设为1)
alter tablespace temp default storage (pctinscrease 1);
一是手工进行。
alter tablespace temp coalesce;
 
 
阅读(702) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~