各位:
   如何创建一用户,该用户只拥有对表的select权限,无update、delete等权限?
   还有没有其他方式实现这种只拥有查询权限的控制?

解决方案 »

  1.   

    用户对自己拥用的表具有update,insert,select权限。
    除非另建立一个用户,否则无法控制。例:
    用户A的表t1,用户C只能select
    连接到: 
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining optionsSQL> grant connect,resource to a identified by a;授权成功。SQL> grant connect,resource to c identified by c;授权成功。SQL> connect a/[email protected]
    已连接。
    SQL> create table t1(id number);表已创建。SQL> insert into t1 values(1);已创建 1 行。SQL> commit;提交完成。SQL> grant select on t1 to c;授权成功。SQL> connect c/[email protected]
    已连接。
    SQL> select * from a.t1;        ID
    ----------
             1SQL> insert into a.t1 values(2);
    insert into a.t1 values(2)
                  *
    第 1 行出现错误:
    ORA-01031: 权限不足
    SQL> update a.t1 set a.id=2;
    update a.t1 set a.id=2
                    *
    第 1 行出现错误:
    ORA-00904: "A"."ID": 标识符无效
    SQL> 
      

  2.   

    楼主说的是对该用户对其他用户的表的权限吗?
    如果是对其他用户表的权限,
    在给这个用户权限的时候,
    不能给它create session的权限。如果有的话,先收回它的create session权限revoke create session from [user];这样给权限即可:grant connect to [user];
    grant select [user1].table to [user];
    如果已经有了更新权限,用下面语句revoke掉:revoke update ANY TABLE FROM [user];
      

  3.   

    楼上两位大哥的意思基本就是:对于某用户归属的表,是没办法取消其对该表的update、delete权限的,只能通过创建另一个用户,并只授权select,是这样吗?有没有更好的实现方法?
      

  4.   

    直接授予查询某个对象的权限就可以了:Connected as yeexun
    SQL> select * from scott.emp;select * from scott.emp
    ORA-00942: table or view does not existConnected as scott
    SQL> grant select on emp to yeexun;
    Grant succeededConnected as yeexun
    SQL> select count(*) from scott.emp;
     
      COUNT(*)
    ----------
            14
     
    SQL> insert into scott.emp
      2  values(1100,null,null,null,null,null,null,null);
     
    insert into scott.emp
    values(1100,null,null,null,null,null,null,null)
     
    ORA-01031: insufficient privileges--这里提示无效权限
     
    SQL> update scott.emp
      2  set sal=10000
      3  where empno=7788;
     
    update scott.emp
    set sal=10000
    where empno=7788
     
    ORA-01031: insufficient privileges--这里也提示无效权限
      

  5.   

    grant select  on tb to user