Oracle:访问其他用户下的对象

每个用户都有自己的空间

Oracle:访问其他用户下的对象

--scott或hr叫用户名/空间名,以下是用户名/密码
scott/tiger
hr/lion

--查询当前用户是谁
show user;

--查询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;
在默认情况下,每个用户只能查询自已空间下的对象的权限,不能查询其它用户空间下的对象

--以sysdba身份角色,授予scott用户查询所有用户空间下的对象权限
grant select any table to scott;

--以sysdba身份,撤销scott用户查询所有用户空间下的对象权限
revoke select any table from scott;

--当scott查询hr表空间下的所有表时,必须得加用户名
select * from hr.jobs;

--scott自已查看自己所拥有的权限
select * from user_sys_privs;
--导航到sysdba用户空间
sqlplus / as sysdba;

--从sysdba用户空间导航到scott用户空间
conn scott/tiger;

--从scott用户空间导航到hr用户空间
conn hr/lion;