SELECT_CATALOG_ROLE允许对数据字典视图(例如select * from dba_users)具有SELECT权限,但不允许对用户表具有SELECT权限。必须显式指定对所需表的权限,例如grant select,update,delete on need_table for user_name; grant select,update,delete on DEPARTMENTS to test; 或者为所有表给予选择权限(不好做法)。
[oracle10@aktp ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Nov 21 14:39:55 2018
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> grant select any table to test;
Grant succeeded.
create or replace synonym youruser.all_objects for dba_objects;
create or replace synonym youruser.all_tables for dba_tables;
create or replace synonym youruser.all_tab_columns for dba_tab_columns;
create or replace synonym youruser.all_users for dba_users;
create or replace synonym youruser.all_constraints for dba_constraints;
create or replace synonym youruser.all_cons_columns for dba_cons_columns;
create user metadata_collector identified by "password";
grant connect to metadata_collector;
grant select any dictionary to metadata_collector;
create or replace synonym metadata_collector.all_objects for dba_objects;
create or replace synonym metadata_collector.all_tables for dba_tables;
create or replace synonym metadata_collector.all_tab_comments for dba_tab_comments;
create or replace synonym metadata_collector.all_tab_columns for dba_tab_columns;
create or replace synonym metadata_collector.all_col_comments for dba_col_comments;
create or replace synonym metadata_collector.all_users for dba_users;
create or replace synonym metadata_collector.all_constraints for dba_constraints;
create or replace synonym metadata_collector.all_cons_columns for dba_cons_columns;
create or replace synonym metadata_collector.all_arguments for dba_arguments;
create or replace synonym metadata_collector.all_synonyms for dba_synonyms;
create or replace synonym metadata_collector.all_col_privs for dba_col_privs;
create or replace synonym metadata_collector.all_tab_privs for dba_tab_privs;
create or replace synonym metadata_collector.all_ind_columns for dba_ind_columns;
create or replace synonym metadata_collector.all_trigger_cols for dba_trigger_cols;
create or replace synonym metadata_collector.all_indexes for dba_indexes;
create or replace synonym metadata_collector.all_types for dba_types;
4条答案
按热度按时间tzxcd3kk1#
使用DatabaseMetaData.getMetaData对基础视图all_objects、all_tab_comments和all_synonyms进行回复。这些视图考虑了授予访问权限的内容。
SELECT_CATALOG_ROLE会赠款与目录的存取权,以允许查询dba_objects。
要完成所要求的任务,可以很容易地编写一个Map到DatabaseMetaData.getMetaData().getTables(..)的JavaAPI来使用dba_xyz视图。
yqlxgs2m2#
SELECT_CATALOG_ROLE
允许对数据字典视图(例如select * from dba_users
)具有SELECT权限,但不允许对用户表具有SELECT权限。必须显式指定对所需表的权限,例如grant select,update,delete on need_table for user_name; grant select,update,delete on DEPARTMENTS to test;
或者为所有表给予选择权限(不好做法)。
。
zu0ti5jz3#
我在jdbc上也遇到过同样的问题。我的解决方案就是这么简单。
这对我很有效。
fcg9iug34#
感谢@ LotarSchin,您的解决方案如此简单,而且确实有效。在阅读了OracleJDBC驱动程序的源代码后,我有了一个更完整的同义词列表: