问题:

在数据库用有一用户 A(方案A),A有数据表 t_1,t_2, 视图 v_1,v2, 我想再建一用户B,用户B只有对方案A中的视图v_1,v_2只有浏览的权限,
我的办法是这样的:重新建了一个用户,赋给UNDER ANY VIEW 这个权限,但无法访问A中的视图与数据表。
请教各位达人,如何去创建用户B,及设置他的权限!
也就是新增用户只能访问方案A中的视图,其它资源都不能访问

 

实验:

SQL> conn gkl/gkl@orcl

Connected.
SQL> create view testrol as select * from dept;

View created.

SQL> select * from testrol;

    DEPTNO DNAME                        LOC
---------- ---------------------------- --------------------------
        11 Sales                        Texas
        22 Accounting                   Washington
        33 Finance                      Maine

SQL> create user testrow identified by testrow default tablespace user
create user testrow identified by testrow default tablespace user
                                                             *
ERROR at line 1:
ORA-02155: invalid DEFAULT tablespace identifier


SQL> create user testrow identified by testrow default tablespace user

User created.

SQL> conn testrow/testrow@orcl
ERROR:
ORA-01045: user TESTROW lacks CREATE SESSION privilege; logon denied


Warning: You are no longer connected to ORACLE.
SQL> conn gkl/gkl@orcl
Connected.
SQL> grant select on testrol to testrow;

Grant succeeded.

SQL> conn testrow/testrow@orcl
ERROR:
ORA-01045: user TESTROW lacks CREATE SESSION privilege; logon denied


Warning: You are no longer connected to ORACLE.
SQL> conn gkl/gkl@orcl
Connected.
SQL> grant resource to testrow;

Grant succeeded.

SQL> conn testrow/testrow@orcl
ERROR:
ORA-01045: user TESTROW lacks CREATE SESSION privilege; logon denied


Warning: You are no longer connected to ORACLE.
SQL> conn gkl/gkl@orcl
Connected.
SQL> GRANT create session to testrow;

Grant succeeded.

SQL> conn testrow/testrow@orcl
Connected.
SQL> select * from gkl.testrol;

    DEPTNO DNAME                        LOC
---------- ---------------------------- --------------------------
        11 Sales                        Texas
        22 Accounting                   Washington
        33 Finance                      Maine

SQL> select * from gkl.dept;
select * from gkl.dept
                  *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL>
posted on 2009-02-10 23:05  Oracle  阅读(4488)  评论(0编辑  收藏  举报