oracle赋予一个用户具有查询另一个用户所有表数据

一  以需要被查询的用户登录oracle(假如为A)   B为要查询A用户下的表的用户

二  执行查询语句: select 'grant select on A.'|| tname ||' to  B;' from tab;

以下为模拟结果:

  1. grant select on A.DEPT to  B; 
  2. grant select on A.EMP to  B; 
  3. grant select on A.BONUS to  B; 
  4. grant select on A.SALGRADE to  B; 
  5. grant select on A.AVGSAL to  B; 
  6. grant select on A.BOOK to  B; 
  7. grant select on A.TEST_INDEX to  B;  
  8. grant select on A.TB_EMPLOYEES to  B; 

...

三 将结果复制

四  登录system用户

五 打开sqlwindow ,粘贴,运行。

可以将select换成all就是这些表的所有权限都赋予给B

猜你喜欢

转载自www.cnblogs.com/pzx-java/p/9276204.html