如何锁定数据库表 用什么方法可以禁止对表中数据进行增加、删除、修改操作,而只能进行查询操作 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from tablename for update lock table test in exclusive mode nowait; 把这个表放在一个单独的表空间中设置该表空间为read only create tablespace tbsname datafile 'd:\123.mdf'size 10M;alter tablespace tbsname read only;然后把表建在这个表空间上面这只是换了一个思路 对于用户只给某些表的查询权限就行grant select on table_name to user_name;个人意见,你可以试试! 有权限来控制把。grant select on username ; 使用lock table test in exclusive mode nowait之后,也可以插入数据。SQL> create table test(x number(2)); Table created SQL> lock table test in exclusive mode nowait; Table(s) locked SQL> insert into test(x) values(1); 1 row inserted SQL> commit; Commit complete SQL> select * from test; X--- 1 SQL> SQL> create table test(x number(2)); Table created SQL> lock table test in exclusive mode nowait; Table(s) locked SQL> insert into test(x) values(1); 1 row inserted SQL> commit; Commit complete SQL> select * from test; X--- 1 SQL> lock table test in exclusive mode nowait; 你这是在当前 session。在新session里试试?无限期等待。虽然无法实现11g里真正的只读表的目的,但是其他session肯定无法写该表!!!!! ww20042005 (ww20042005) 等 级: 结帖率:0.00% 如果用同一oracle用户访问,只读视图是较好的create view v_test as select * from test with read only; 新的session一样可以写表,我的是ORACLE 9I。 select * from tablename for update select * from tablename for update 是表锁定。 用触发器或者在建一个用户,将表的select权限赋给他 Oracle Database Upgrade for solaris 的可行性 PL/SQL创建表空间问题 数据库优化问题 请问如何向一个日期型子段增加内容(即日期格式是什么样的) 为什么我的OracleOraHome81ManagementServer启动不起来. 求救。关于12560错误 存储过程问题(急,送分!) 求解:64位WIN2008下连oracle报ORA-12537: TNS: 连接关闭 急,求大神写PLSQL脚本实现多个表中修改表的字段类型 这道数据库的面试题难道我了 oracle occi连接问题 替换问题
datafile 'd:\123.mdf'
size 10M;alter tablespace tbsname read only;然后把表建在这个表空间上面这只是换了一个思路
使用lock table test in exclusive mode nowait之后,也可以插入数据。SQL> create table test(x number(2));
Table created
SQL> lock table test in exclusive mode nowait;
Table(s) locked
SQL> insert into test(x) values(1);
1 row inserted
SQL> commit;
Commit complete
SQL> select * from test;
X
---
1
SQL>
Table created
SQL> lock table test in exclusive mode nowait;
Table(s) locked
SQL> insert into test(x) values(1);
1 row inserted
SQL> commit;
Commit complete
SQL> select * from test;
X
---
1
SQL>
你这是在当前 session。
在新session里试试?
无限期等待。
虽然无法实现11g里真正的只读表的目的,但是其他session肯定无法写该表!!!!!
(ww20042005) 等 级:
结帖率:0.00%
create view v_test as select * from test with read only;
新的session一样可以写表,我的是ORACLE 9I。
或者在建一个用户,将表的select权限赋给他