dba_jobs_running:尝试从过程中访问时,表或视图不存在 [英] dba_jobs_running: table or view does not exist when trying to access from procedure
问题描述
使用
select * from dba_jobs_running;
在我的sqldevelopers SQL控制台中执行时工作正常.
works fine when executed in my sqldevelopers SQL console.
但是,在过程中具有完全相同的语句时,它将不起作用. 编译失败并显示
However, it does not work, when having exactly the same statement within a procedure. Compilation fails with
PL/SQL: ORA-00942: table or view does not exist
有什么想法吗?有没有类似范围的东西可以考虑?
Any ideas? Is there something like a scope to be considered?
任何建议都将受到高度赞赏,在此先感谢:)
Any suggestions are highly appreciated, thanks in advance :)
推荐答案
您可能需要对拥有该过程的用户进行DBA_JOBS_RUNNING的直接授予.通过角色进行GRANT无效....授予必须明确.
You probably need to do a direct GRANT of DBA_JOBS_RUNNING to the user that owns the procedure. Doing a GRANT via a role won't work.... the grant needs to be explicit.
从过程内部执行SELECT要求从过程外部执行SELECT的权限稍有不同(例如,在SQL-Developer中).拥有过程的用户必须已被明确授予表或视图的权限...如果不是从视图外部运行查询,则不是这种情况(例如,您可以通过角色被授予权限)
Doing a SELECT from within a procedure requires subtly different permissions to doing a SELECT from outside a procedure (e.g. in SQL-Developer). The user that owns a procedure must have been explicitly granted rights to the table or view... if running a query from outside a view this is not the case (you can be granted the permission through a role for example)
您需要以SYS身份连接并进入:
You need to connect as SYS and go:
GRANT SELECT ON SYS.DBA_JOBS_RUNNING TO <user-that-owns-proc>;
这篇关于dba_jobs_running:尝试从过程中访问时,表或视图不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!