有两个用户jytest,jytest1都拥有dba权限在jytest1用户创建了一个表test
create user jytest identified by “jytest”
default tablespace users temporary tablespace temp;
grant dba to jytest;
grant resource to jytest;
grant connect to jytest;
create user jytest1 identified by “jytest1”
default tablespace users temporary tablespace temp;
grant dba to jytest1;
grant resource to jytest1;
grant connect to jytest1;
create table jytest1.test(userid number(20));
SQL> select a.owner,a.object_name,a.object_type from dba_objects a where a.object_id=52603;
OWNER OBJECT_NAME OBJECT_TYPE
—————————— ———————————– ——————-
JYTEST1 TEST TABLE
在用户jytest下可以直接查询jytest1.test表但是在jytest下创建一个过程,在过程中引用jytest1.test表编译不通过.在过程中引用别的用户对象不能通过role权限来访问,要通过对象授权才能在过程中访问
SQL> alter session set events ‘10046 trace name context forever,level 12’;
Session altered
SQL> select * from jytest1.test;
USERID———————
SQL> alter session set events ‘10046 trace name context off’;
Session altered
它的跟踪文件中显示的记录部分信息如下:select col#, grantee#, privilege#,max(mod(nvl(option$,0),2)) from objauth$ where obj#=:1 and col# is not null group by privilege#, col#, grantee# order by col#, grantee#END OF STMTPARSE #2:c=0,e=86,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1355777810000085BINDS #2:kkscoacd Bind#0
acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0
kxsbbbfp=b7f47498 bln=22 avl=04 flg=05
value=52603上面的操作显示了用户jytest在执行select * from jytest1.test查询时会查询jytest用户对jytest1.test表是否有select权限
select con#,obj#,rcon#,enabled,nvl(defer,0) from cdef$ where robj#=:1END OF STMTPARSE #4:c=0,e=55,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1355777810001339BINDS #4:kkscoacd Bind#0
acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0
kxsbbbfp=b7ecffb8 bln=22 avl=04 flg=05
value=52603
上面的查询是查询jytest1.test表中的列的定义
,