Oracle Initialization Parameters:DEFERRED_SEGMENT_CREATION

官方文档的说明:
DEFERRED_SEGMENT_CREATION


Property                 Description
Parameter type Boolean
Default value   true
Modifiable         ALTER SESSION, ALTER SYSTEM
Range of values true | false
Basic                 No
         DEFERRED_SEGMENT_CREATION specifies the semantics of deferred segment creation. If set to true, then segments for tables and their dependent objects (LOBs, indexes) will not be created until the first row is inserted into the table.
         Before creating a set of tables, if it is known that a significant number of them will not be populated, then consider setting this parameter to true. This saves disk space and minimizes install time.

         DEFERRED_SEGMENT_CREATION具体指segment延迟创建,如果DEFERRED_SEGMENT_CREATION的值时true,则当table创建时,该table以及依赖它的lob,index的segment都不会创建,知道第一行记录插入到该table。DEFERRED_SEGMENT_CREATION 参数从11.2.0.1引进,默认值为true;如果要使其恢复老版本功能,设置该参数为false.

        DEFERRED_SEGMENT_CREATION效果验证:

SQL>select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL>show parameter DEFERRED_SEGMENT_CREATION

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation            boolean     TRUE

SQL>create table t_hh (id number,name varchar2(10));

Table created.

SQL>create index ind_t_hh_id on t_hh(id);

Index created.

SQL>Select segment_name,segment_type from user_segments where segment_name in ('T_HH','IND_T_HH_ID');

no rows selected


SQL>insert into t_hh values(998,'hengheng');

1 row created.

SQL>Select segment_name,segment_type from user_segments where segment_name in ('T_HH','IND_T_HH_ID');

SEGMENT_NAME                                                                      SEGMENT_TYPE
--------------------------------------------------------------------------------- ------------------
T_HH                                                                              TABLE
IND_T_HH_ID                                                                       INDEX

    这里我们可以看到,当insert发生的时候,数据库会给该表创建segment并分配extent,无论该insert 操作是commit or rollback。but,deferred_segment_creation 参数对sys,system用户是无效的,下面我们来验证下:

SQL>show user
USER is "SYS"
SQL>create table t_sys_hh (id number,name varchar2(10));

Table created.

Elapsed: 00:00:00.17
SQL>Select segment_name,segment_type from dba_segments where segment_name = 'T_SYS_HH';

SEGMENT_NAME                                                                      SEGMENT_TYPE
--------------------------------------------------------------------------------- ------------------
T_SYS_HH                                                                          TABLE
   

    对于古老的导出工具exp来说,我们无法导出没有segment的表,故在exp之前需要给表分配extent,可以用:alter table tablename allocate extent; 


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值