测试表明,
一个表空间如果read only,对这个表空间中的对像所做的DDL操作是否能够成功和这个表中是否存在数据有关,见下面测试,
[php]
SYS@yxyup>select * from yxyup.t12;
no rows selected
SYS@yxyup>
SYS@yxyup>alter tablespace yxyup read write;
Tablespace altered.
SYS@yxyup>desc yxyup.t12;
Name
Null?Type
------------------------------------------------------------------------ -------- -------------------------------------------------
ID
NUMBER
NAME
CHAR(8)
REMARK
DATE
DT
NOT NULL DATE
NAME1
NOT NULL VARCHAR2(30)
NAME2
NOT NULL VARCHAR2(30)
SYS@yxyup>
SYS@yxyup>
SYS@yxyup>insert into yxyup.t12 values(1,'yxyup',sysdate,sysdate,'a','b');
1 row created.
SYS@yxyup>commit;
Commit complete.
SYS@yxyup>alter tablespace yxyup read only;
Tablespace altered.
SYS@yxyup>alter table yxyup.t12 add (name3 varchar2(30) default 'ytk' not null);
alter table yxyup.t12 add (name3 varchar2(30) default 'ytk' not null)
*
ERROR at line 1:
ORA-00372: file 11 cannot be modified at this time
ORA-01110: data file 11: '/opt/oracle/oradata/yxyup/yxyup03.dbf'
SYS@yxyup>alter tablespace yxyup read write;
Tablespace altered.
SYS@yxyup>delete yxyup.t12;
1 row deleted.
SYS@yxyup>commit;
Commit complete.
SYS@yxyup>alter tablespace yxyup read only;
Tablespace altered.
SYS@yxyup>alter table yxyup.t12 add (name3 varchar2(30) default 'ytk' not null);
Table altered.
SYS@yxyup>
[/php]
[ 本帖最后由 yxyup 于 2007-12-25 12:19 编辑 ]
|