温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle系列:(21)访问其他用户下的对象[授权]

发布时间:2020-06-29 23:01:43 来源:网络 阅读:767 作者:lsieun 栏目:关系型数据库



声明:scott或hr叫用户名/方案名/空间名

      scott--tiger

      hr-----lion

      

查询当前用户是谁

show user;

Oracle系列:(21)访问其他用户下的对象[授权]


查询scott自己表空间下的所有对象时,可加,或不加用户名select * from emp;

select * from emp;

select * from scott.emp;


以sysdba身份解锁hr普通帐户

alter user hr account unlock;


以sysdba身份设置hr普通帐户的密码

alter user hr identified by lion;

Oracle系列:(21)访问其他用户下的对象[授权]


当scott查询hr表空间下的所有表时,必须得加用户名

select * from hr.jobs;

Oracle系列:(21)访问其他用户下的对象[授权]


在默认情况下,每个用户只能查询自已空间下的对象的权限,不能查询其它用户空间下的对象

Oracle系列:(21)访问其他用户下的对象[授权]


以sysdba身份角色,授予scott用户查询所有用户空间下的对象权限

grant select any table to scott;


以sysdba身份,撤销scott用户查询所有用户空间下的对象权限

revoke select any table from scott;


scott自已查看自己所拥有的权限

select * from user_sys_privs;

Oracle系列:(21)访问其他用户下的对象[授权]


从scott用户空间导航到sysdba用户空间

conn / as sysdba;


从sysdba用户空间导航到scott用户空间

conn scott/tiger;


从scott用户空间导航到hr用户空间

conn hr/lion;


查询hr用户空间中的所有对象

select * from tab;


从hr用户空间导航到scott用户空间

conn scott/tiger;


在scott用户空间下,查询hr用户空间下的jobs表,必须加上hr用户空间名

select * from hr.jobs;









向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI