11GR2的新特性Deferred Segment Creation
今天在看Apress.Pro.Oracle.Database.11g.Administration.Dec.2010.pdf時候,發現11GR2下有一個新特性,叫做Deferred Segment Creation.
按照書上的例子測試看看並且摘要如下:
Starting with Oracle Database 11g Release 2, when you create a table, the creation of the associated segment is deferred until the first row is inserted into the table. This feature has some interesting implications. For example, if you have thousands of objects that you’re initially creating for an application (such as when you first install it), no space is consumed by any of the tables (or associated indexes) until data is inserted into the application tables. This means the initial DDL runs more quickly when you create a table, but the first INSERT statement runs slightly slower.
SQL> create table inv(inv_id number, inv_desc varchar2(30));
SQL> select table_name ,segment_created from user_tables where table_name='INV';
TABLE_NAME SEG
------------------------------ ---
INV NO
select segment_name ,segment_type ,bytes from user_segments where segment_name='INV' and segment_type='TABLE';
no rows selected
SQL> insert into inv values(1,'BOOK');
Rerun the query, selecting from USER_SEGMENTS, and notice that a segment has been created:
SEGMENT_NAME SEGMENT_TYPE BYTES
--------------- ------------------ ----------
INV TABLE 65536
■ Note You can disable the deferred-segment-creation feature by setting the database-initialization parameter
DEFERRED_SEGMENT_CREATION to FALSE. The default for this parameter is TRUE.
我在建立表後匯出表的定義如下:
CREATE TABLE "SCOTT"."INV"
( "INV_ID" NUMBER,
"INV_DESC" VARCHAR2(30)
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
TABLESPACE "USERS"
插入後,在匯出如下:
CREATE TABLE "SCOTT"."INV"
( "INV_ID" NUMBER,
"INV_DESC" VARCHAR2(30)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS"
這樣建立的表會很快,但是開始插入的時候要浪費一些時間.
另外這個還導致另外一個小問題exp/imp這些空表無法匯入:
exp scott/xxx file=test.dmp
alter table SCOTT.INV rename to INV1
imp scott/btbtms file=test.dmp full=Y
可以發現表inv沒有匯入!
alter table SCOTT.INV1 rename to INV
再執行如下:
$ exp scott/btbtms file=test.dmp tables=inv
Export: Release 11.2.0.1.0 - Production on Sat May 21 00:12:08 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
EXP-00011: SCOTT.INV does not exist
Export terminated successfully with warnings.
按照書上的例子測試看看並且摘要如下:
Starting with Oracle Database 11g Release 2, when you create a table, the creation of the associated segment is deferred until the first row is inserted into the table. This feature has some interesting implications. For example, if you have thousands of objects that you’re initially creating for an application (such as when you first install it), no space is consumed by any of the tables (or associated indexes) until data is inserted into the application tables. This means the initial DDL runs more quickly when you create a table, but the first INSERT statement runs slightly slower.
SQL> create table inv(inv_id number, inv_desc varchar2(30));
SQL> select table_name ,segment_created from user_tables where table_name='INV';
TABLE_NAME SEG
------------------------------ ---
INV NO
select segment_name ,segment_type ,bytes from user_segments where segment_name='INV' and segment_type='TABLE';
no rows selected
SQL> insert into inv values(1,'BOOK');
Rerun the query, selecting from USER_SEGMENTS, and notice that a segment has been created:
SEGMENT_NAME SEGMENT_TYPE BYTES
--------------- ------------------ ----------
INV TABLE 65536
■ Note You can disable the deferred-segment-creation feature by setting the database-initialization parameter
DEFERRED_SEGMENT_CREATION to FALSE. The default for this parameter is TRUE.
我在建立表後匯出表的定義如下:
CREATE TABLE "SCOTT"."INV"
( "INV_ID" NUMBER,
"INV_DESC" VARCHAR2(30)
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
TABLESPACE "USERS"
插入後,在匯出如下:
CREATE TABLE "SCOTT"."INV"
( "INV_ID" NUMBER,
"INV_DESC" VARCHAR2(30)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS"
這樣建立的表會很快,但是開始插入的時候要浪費一些時間.
另外這個還導致另外一個小問題exp/imp這些空表無法匯入:
exp scott/xxx file=test.dmp
alter table SCOTT.INV rename to INV1
imp scott/btbtms file=test.dmp full=Y
可以發現表inv沒有匯入!
alter table SCOTT.INV1 rename to INV
再執行如下:
$ exp scott/btbtms file=test.dmp tables=inv
Export: Release 11.2.0.1.0 - Production on Sat May 21 00:12:08 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
EXP-00011: SCOTT.INV does not exist
Export terminated successfully with warnings.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-695835/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Deferred Segment Creation】Oracle 11g新特性-延期建立段Oracle
- 我嘞個去,11G新特性deferred_segment_creation
- 【延遲段建立】Oracle 11gR2的延遲段建立(deferred segment creation)特性Oracle
- Oracle 11g的Deferred Segment CreationOracle
- oracle 11g deferred_segment_creation段延遲建立Oracle
- [20131109]deferred segment creation與12c的exp命令.txt
- 11GR2新特性(轉)
- oracle 11GR2 新特性Oracle
- 約束的DEFERRABLE and DEFERRED特性
- 【RAC】11gR2 新特性: Rebootless RestartbootREST
- 【11gR2新特性】result cache 的三種模式模式
- Oracle 11gr2 的新特性-延遲段建立Oracle
- 11gR2新特性---Gpnp守護程式
- 【11gR2新特性】extent延遲建立
- 11gR2新特性之二 - Flash Cache 的SSD支援
- 11gR2 新特性之—In-Memory Parallel executionParallel
- 11gR2新特性:STANDBY_MAX_DATA_DELAY
- oracle 11gR2 新特性 diskgroup 重新命名Oracle
- 11gR2 新特性--待定的統計資訊(Pending Statistic)
- ORACLE 11GR2 新特性CACHE表與以前的區別Oracle
- 11GR2新特性測試-閃迴歸檔
- 【11gR2新特性】密碼區分大小寫密碼
- oracle 11GR2新特性 Cluster Time Synchronization Service 配置Oracle
- 11gR2 新特性之(一)Adaptive Cursor Sharing(ACS)APT
- 11gR2新特性:LMHB Lock Manager Heart Beat後臺程式
- 【RAC】11gR2 新特性:Oracle Cluster Health Monitor(CHM)簡介Oracle
- 【11gR2新特性】DBMS_RESULT_CACHE管理結果快取的包快取
- Oracle 11gR2 ASM磁碟組管理與新特性實踐[1]OracleASM
- oracle 11gR2 新特性 orc和vote盤可以放在ASM中OracleASM
- DBMS_PARALLEL_EXECUTE 11GR2新特性,並行訂正大資料Parallel並行大資料
- jQuery 的deferred物件jQuery物件
- jQuery DeferredjQuery
- 新特性
- jQuery的Deferred物件概述jQuery物件
- Swift 4.1 的新特性Swift
- ES的那些新特性
- jQuery 3.0 的新特性jQuery
- C++的新特性C++