ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 赋同义词权限

赋同义词权限

原创 Linux操作系统 作者:psufnxk2000 时间:2013-09-05 23:41:15 0 删除 编辑
一 当把同义词的权限给别的用户时, 实际上给的是同义词所基于的表的权限。

二 赋视图的权限时,只是视图的,没有基表的。

一  同义词
conn song/song
  create  synonym syn_t for song.t_table;
  conn user1/user1
  SQL> select * from syn_t;
select * from syn_t
              *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL>   select * from dba_tab_privs where grantee='USER1';

no rows selected
SQL> conn song/song
Connected.
SQL> grant select on syn_t to user1;

Grant succeeded.
SQL> set line 200
SQL>   select grantee ,owner,table_name from dba_tab_privs where grantee='USER1';

GRANTEE                        OWNER                          TABLE_NAME
------------------------------ ------------------------------ ------------------------------
USER1                          SONG                           T_TABLE


二 视图

SQL> conn song/song
Connected.
SQL> 
SQL> set line 200
SQL> select view_name,text from user_views;

VIEW_NAME                      TEXT
------------------------------ --------------------------------------------------------------------------------
VIEW_T                         select "OWNER","OBJECT_NAME","SUBOBJECT_NAME","OBJECT_ID","DATA_OBJECT_ID","OBJE
V_TT_TABLE                     select "ID" from tt_table


grant select on v_tt_table to user1;


SQL> conn user1/user1
Connected.
SQL> select count(*) from song.v_tt_table;

  COUNT(*)
----------
         0

SQL> select count(*) from song.tt_table;
select count(*) from song.tt_table
                          *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> conn song/song
Connected.
SQL>   select grantee ,owner,table_name from dba_tab_privs where grantee='USER1';

GRANTEE                        OWNER                          TABLE_NAME
------------------------------ ------------------------------ ------------------------------
USER1                          SONG                           T_TABLE
USER1                          SONG                           V_TT_TABLE

by song

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25099483/viewspace-772249/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-05-31

  • 博文量
    215
  • 访问量
    616313