oracle 如何查询Oracle目录的权限?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6390388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to query the permissions on an Oracle directory?
提问by Cade Roux
I have a directory in all_directories, but I need to find out what permissions are associated with it, i.e. what has been granted on it?
我在 all_directories 中有一个目录,但我需要找出与之关联的权限,即已授予的权限?
回答by DCookie
This should give you the roles, users and permissions granted on a directory:
这应该为您提供对目录授予的角色、用户和权限:
SELECT *
FROM all_tab_privs
WHERE table_name = 'your_directory'; --> needs to be upper case
And yes, it IS in the all_TAB_privs view ;-) A better name for that view would be something like "ALL_OBJECT_PRIVS", since it also includes PL/SQL objects and their execute permissions as well.
是的,它在 all_TAB_privs 视图中 ;-) 该视图的更好名称应该是“ALL_OBJECT_PRIVS”,因为它还包括 PL/SQL 对象及其执行权限。
回答by Alex Porteous
You can see all the privileges for all directories wit the following
您可以通过以下方式查看所有目录的所有权限
SELECT *
from all_tab_privs
where table_name in
(select directory_name
from dba_directories);
The following gives you the sql statements to grant the privileges should you need to backup what you've done or something
如果您需要备份您所做的事情或其他事情,以下为您提供授予权限的 sql 语句
select 'Grant '||privilege||' on directory '||table_schema||'.'||table_name||' to '||grantee
from all_tab_privs
where table_name in (select directory_name from dba_directories);
回答by Ian Carpenter
Wasn't sure if you meant which Oracle users can read\write with the directory or the correlation of the permissions between Oracle Directory Object and the underlying Operating System Directory.
不确定您的意思是哪些 Oracle 用户可以读取/写入目录或 Oracle 目录对象与底层操作系统目录之间的权限关联。
As DCookie has covered the Oracle side of the fence, the following is taken from the Oracle documentation found here.
由于 DCookie 已经涵盖了围栏的 Oracle 一侧,以下内容摘自此处找到的 Oracle 文档。
Privileges granted for the directory are created independently of the permissions defined for the operating system directory, and the two may or may not correspond exactly. For example, an error occurs if sample user hr is granted READ privilege on the directory object but the corresponding operating system directory does not have READ permission defined for Oracle Database processes.
为目录授予的权限是独立于为操作系统目录定义的权限创建的,两者可能完全对应,也可能不完全对应。例如,如果示例用户 hr 被授予对目录对象的 READ 权限,但相应的操作系统目录没有为 Oracle 数据库进程定义的 READ 权限,则会发生错误。
回答by Tezro
With Oracle 11g R2 (at least with 11.2.02) there is a view named datapump_dir_objs.
在 Oracle 11g R2(至少在 11.2.02)中有一个名为 datapump_dir_objs 的视图。
SELECT * FROM datapump_dir_objs;
The view shows the NAME
of the directory object, the PATH
as well as READ
and WRITE
permissions for the currently connected user. It does not show any directory objects which the current user has no permission to read from or write to, though.
该视图显示NAME
目录对象中,PATH
以及READ
和WRITE
权限当前连接的用户。但是,它不会显示当前用户无权读取或写入的任何目录对象。