Oracle 11g 新特性 -- 只读表(read-only table)
来源:互联网 发布:cf手游切屏软件 编辑:程序博客网 时间:2024/05/16 04:25
原文:http://blog.csdn.net/tianlesoftware/article/details/8223668
一.Read only table说明
在Oracle 11g之前,如果我们想要对一个表设置为只读的,可以通过授予某些用户select 权限。 但是对于表的所有者来说,还是读写的。
在Oracle 11g中,我们可以直接对表的读写权限进行设置:
ALTER TABLE table_name READ ONLY;
ALTER TABLE table_name READ WRITE;
二.示例
--创建表
SQL> create table dave as select * fromdba_objects;
Table created.
--设置为只读:
SQL> alter table dave read only;
Table altered.
--查看表状态:
SQL> select table_name,status,read_onlyfrom dba_tables where table_name='DAVE';
TABLE_NAME STATUS REA
------------------------------ -------- ---
DAVE VALID YES
--这里显示是只读的。
--对Dave表进行DML操作:
SQL> insert into dave select * fromdave;
insert into dave select * from dave
*
ERROR at line 1:
ORA-12081: update operation not allowed ontable "SYS"."DAVE"
SQL> update dave set object_id=88;
update dave set object_id=88
*
ERROR at line 1:
ORA-12081: update operation not allowed ontable "SYS"."DAVE"
SQL> delete from dave;
delete from dave
*
ERROR at line 1:
ORA-12081: update operation not allowed ontable "SYS"."DAVE"
SQL> truncate table dave;
truncate table dave
*
ERROR at line 1:
ORA-12081: update operation not allowed ontable "SYS"."DAVE"
SQL> alter table dave add(namevarchar(20));
alter table dave add(name varchar(20))
*
ERROR at line 1:
ORA-12081: update operation not allowed ontable "SYS"."DAVE"
--虽然表示只读的,但是我们对表进行与索引相关的操作,因为索引修改的是数据字典,和表不相关。
SQL> create index idx_id on dave(object_id);
Index created.
SQL> drop index idx_id;
Index dropped.
--将表改成读写:
SQL> alter table dave read write;
Table altered.
SQL> drop table dave;
Table dropped.
- 只读表(Read-only)--Oracle 11g 新特性
- Oracle 11g 新特性 -- 只读表(read-only table)说明
- Oracle 11g 新特性 -- 只读表(read-only table)
- Oracle 11g新特性之--只读表(read only table)
- oracle 11g 新特性---只读表
- Oracle 11g 的新特性 —— 只读表
- Oracle Read-only Tablespace(只读表空间)
- Oracle 11g 新特性
- Oracle 11g新特性
- oracle 11g 新特性
- ORACLE 11G新特性
- ORACLE 11g新特性
- ORACLE 11G新特性
- Oracle 11g新特性
- oracle 11g 新特性
- 【】oracle 11g 新特性
- ORACLE 11G新特性
- Oracle 11g新特性
- 搭建DB2 DPF(多分区) for Linux/Unix操作步骤
- VS2012使用验证控件报错问题
- 女子减肥减成“活骷髅” 如今体重仅27公斤(图)
- 迄今见过的最好的职业规划的文章,毕生受益
- 腾讯抄你怎么办
- Oracle 11g 新特性 -- 只读表(read-only table)
- VLC 命令行控制参数
- 17_2_2比较两个字符串
- 在使用C#调用COM组件操作Excel的时候阻止其他程序对此文件操作
- linux find 忽略文件夹
- Struts2中<s:iterator>基本用法及示例
- 婆罗洲发现新种懒猴能分泌毒液致人休克(图)
- android手机root后的安全问题 (一)
- 十一、交通灯管理系统