时间:2021-07-01 10:21:17 帮助过:32人阅读
官方文档的说明: 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
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;