Oracle Initialization Parameters:DEFERRED

php中文网
发布: 2016-06-07 15:51:06
原创
1299人浏览过

官方文档的说明: DEFERRED_SEGMENT_CREATION Property Description Parameter typeBoolean Default value true Modifiable ALTER SESSION, ALTER SYSTEM Range of valuestrue | false Basic No DEFERRED_SEGMENT_CREATION specifies the semantics of defer

官方文档的说明:
DEFERRED_SEGMENT_CREATION


Property                Description
Parameter typeBoolean
Default value  true
Modifiable        ALTER SESSION, ALTER SYSTEM
Range of valuestrue | 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; 

CreateWise AI
CreateWise AI

为播客创作者设计的AI创作工具,AI自动去口癖、提交亮点和生成Show notes、标题等

CreateWise AI 133
查看详情 CreateWise AI

相关标签:
最佳 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号