我正在开发适用于 Oracle 的应用程序。对于某种逻辑,我需要从具有指定模式的给定 db 用户获取表列表。就我而言,我有一个用户已授予对给定架构的访问权限。因此,当我的代码使用给定的凭据创建连接并尝试从以下查询中获取表时,它的返回表列表。
SELECT * FROM dba_objects where owner ='schema' and object_type = 'TABLE'
上面的查询与授予所有权限的用户一起使用, 但是当我尝试使用有限权限时,它会抛出错误消息。
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
对于辅助用户,我们的代码从中创建连接已通过以下查询授予权限
create user johnsmith identified by Passw0rd;;
grant connect to johnsmith ;
grant select any table to johnsmith ;
grant UPDATE any table to johnsmith ;
grant DELETE any table to johnsmith ;
grant INSERT any table to johnsmith ;
我应该授予用户哪些权限以访问以下系统表...?
- dba_objects
- 用户约束
- user_cons_columns
- USER_TABLES
- all_tab_cols 并且还允许访问 dbms_metadata.get_dependent_ddl() 方法