oracle - 将所有用户表的读取权限授予oracle中的新用户
问题描述
oracle中如何将所有用户表的读取权限提供给新用户?
解决方案
一个接一个,没有魔法命令可以“一次”完成。
每个用户都应该运行
grant select on my_first_table to a_new_user;
声明。
没错,您可以编写代码来为您编写代码,例如
SQL> select 'grant select on ' || tname || ' to a_new_user;' as command
2 from tab
3 order by tname;
COMMAND
-------------------------------------------------------------
grant select on BONUS to a_new_user;
grant select on CHALLEN_HEADER to a_new_user;
grant select on CONFIG to a_new_user;
grant select on CUSTOMER to a_new_user;
<snip>
现在将那一堆GRANT
语句复制/粘贴到您的客户端(SQL*Plus、SQL Developer 等)并运行它们。
或者,您可以将该语句的结果假脱机到一个文件中,然后运行该文件。
或者,甚至创建一个 PL/SQL(匿名?存储?)过程,该过程将接受一个参数 - 一个新用户的名称 - 并一次性授予权限。
推荐阅读
- python-3.x - 在python中,函数调用后的数组是什么意思
- java - 当 POJO 类之一具有 hashmap(HashMap) 时如何将 JSON 读入 POJO 类
) - reactjs - 即使超时,useState 更新状态在同一处理程序中也不可用
- linux - 删除超过 10 分钟的 docker 镜像
- multithreading - 混合并行化:“仅让 'my_id ==0' 进程执行 openMP 调用”可能吗?
- java - 使用java获取word文件的文本
- javascript - 如何在不合并对象属性的情况下推送对象数组以创建新数组?
- python - 以下程序的输出如何是“2”?请有人告诉我它是怎么来的 2
- python - 提示用户输入 csv 文件中的列名(不使用 pandas 框架)
- javascript - 有没有办法缓存 Socket.IO 响应?