在 Oracle 中检查目录权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5618941/
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
Check rights on directory in Oracle
提问by SouravM
How can I know if I have rights on directory using query in Oracle??
我如何知道我是否拥有在 Oracle 中使用查询的目录权限?
回答by Justin Cave
If you are talking about an Oracle directory object (CREATE DIRECTORY ...),
如果您在谈论 Oracle 目录对象 ( CREATE DIRECTORY ...),
SELECT grantee, table_name directory_name, privilege
FROM dba_tab_privs
WHERE table_name = <<directory name>>
Note that if you don't have access to the DBA_*tables, you can use ALL_TAB_PRIVSor USER_TAB_PRIVSinstead.
请注意,如果您无权访问这些DBA_*表,则可以使用ALL_TAB_PRIVS或USER_TAB_PRIVS代替。
If you are talking about an operating system directory, you'd need to create an Oracle directory object that corresponds to the operating system directory. You could then use the UTL_FILE package's FOPENmethod to try to open a file in the directory. If it succeeds, you have permission to the directory. Otherwise, you'll catch an exception.
如果您谈论的是操作系统目录,则需要创建一个对应于操作系统目录的 Oracle 目录对象。然后,您可以使用 UTL_FILE 包的FOPEN方法尝试打开目录中的文件。如果成功,您就拥有该目录的权限。否则,您将捕获异常。
回答by Connor
select * from dba_tab_privs where table_name = 'your_directory'
select * from dba_tab_privs where table_name = 'your_directory'

