« 未雨绸缪 防患未然-《数据安全警示录》序言 | Blog首页 | 2012 Oracle中高级技能培训-性能优化深入浅析 »
只读表空间中创建对象-deferred_segment_creation
作者:eygle | 【转载请注出处】|【云和恩墨 领先的zData数据库一体机 | zCloud PaaS云管平台 | SQM SQL审核平台 | ZDBM 数据库备份一体机】
链接:https://www.eygle.com/archives/2012/07/deferred_segment_creation.html
有朋友发现可以在只读表空间里创建新的空表,提出疑问,这实际上是Oracle Database 11g的新特性Deferred Segment Creation在建表时的"副作用",由于无需分配空间,新建的数据表只需要增加元数据,就出现了可以在只读表空间中创建空表的现象。链接:https://www.eygle.com/archives/2012/07/deferred_segment_creation.html
以下是一个测试演示过程,当deferred_segment_creation设置为TRUE时,可以在只读表空间中创建数据表,但是当插入记录需要分配空间时,则会出现错误:
SQL> show parameter deferred_segment_creation当设置该参数为False时,则创建数据表时就需要分配空间,直接抛出异常,无法创建:
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean TRUE
SQL> alter tablespace users read only;
Tablespace altered.
SQL> connect eygle/eygle
Connected.
SQL> create table eygle (id number) tablespace users;
Table created.
SQL> select table_name,tablespace_name from dba_tables where table_name='EYGLE';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
EYGLE USERS
SQL> insert into eygle values(1);
insert into eygle values(1)
*
ERROR at line 1:
ORA-01647: tablespace 'USERS' is read-only, cannot allocate space in it
SQL> alter session set deferred_segment_creation=false;
Session altered.
SQL> create table e (id number) tablespace users;
create table e (id number) tablespace users
*
ERROR at line 1:
ORA-01647: tablespace 'USERS' is read-only, cannot allocate space in it
SQL> alter session set deferred_segment_creation=true;
Session altered.
记录一下文档中的描述:
You can drop items, such as tables or indexes, from a read-only tablespace, but you cannot create or alter objects in a read-only tablespace. You can execute statements that update the file description in the data dictionary, such as是以为新特性记录。ALTER TABLE...ADD
orALTER TABLE...MODIFY
, but you will not be able to utilize the new description until the tablespace is made read/write.
历史上的今天...
>> 2018-07-16文章:
>> 2011-07-16文章:
>> 2008-07-16文章:
>> 2007-07-16文章:
>> 2006-07-16文章:
By eygle on 2012-07-16 11:10 | Comments (0) | Oracle12c/11g | 3025 |