oracle中ddl中enable,oracle 禁用表的DDL 实现真正的READ ONLY

首先提几个问题:

1,只读表空间可不可以后来创建表

2,只读表空间里先创建的表能不能删除

3,read only  是不是只禁用dml

下面看我的实验,环境oracle 1og R2

SQL> create tablespace tbsread datafile '/oradata/orcl/tbsread.dbf' size 10m ;

Tablespace created.

SQL> alter tablespace tbsread read only;

Tablespace altered.

SQL> conn anbob/anbob

Connected.

SQL> create table testread (id int) tablespace tbsread;

create table testread (id int) tablespace tbsread

*

ERROR at line 1:

ORA-01647: tablespace 'TBSREAD' is read only, cannot allocate space in it

SQL> conn system/oracle

Connected.

SQL> alter tablespace tbsread read write;

Tablespace altered.

SQL> conn anbob/anbob

Connected.

SQL> create table testread (id int) tablespace tbsread;

Table created.

SQL> insert into testread values(1);

1 row created.

SQL> commit;

Commit complete.

SQL> conn system/oracle

Connected.

SQL> alter tablespace tbsread read only;

Tablespace altered.

SQL> conn anbob/anbob

Connected.

SQL> delete table testread;

SP2-0544: Command "delete" disabled in Product User Profile

--为什么会报这个错,请查看http://www.anbob.com/?p=944 很有意思的方法

SQL> conn system/oracle

Connected.

SQL> delete from product_user_profile;

5 rows deleted.

SQL> commit;

Commit complete.

SQL> conn anbob/anbob

Connected.

SQL> delete from testread;

delete from testread

*

ERROR at line 1:

ORA-00372: file 18 cannot be modified at this time

ORA-01110: data file 18: '/oradata/orcl/tbsread.dbf'

SQL> drop table testread;

Table dropped.

SQL> conn system/oracle

Connected.

SQL> alter tablespace tbsread read write;

Tablespace altered.

SQL> create table anbob.testread (id int) tablespace tbsread;

Table created.

SQL> conn anbob/anbob

Connected.

SQL> alter table testread disable table lock;

Table altered.

SQL> insert into testread values(1);

1 row created.

SQL> commit;

Commit complete.

SQL> drop table testread;

drop table testread

*

ERROR at line 1:

ORA-00069: cannot acquire lock -- table locks disabled for TESTREAD

SQL> alter table testread enable table lock;

Table altered.

SQL> drop table testread;

Table dropped.

打赏

8732971891f4ba05583674ca6b8145ac.png微信扫一扫,打赏作者吧~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值