SQL 如何列出在我的数据库中运行的计划作业?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7736705/
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 can I list the scheduled jobs running in my database?
提问by 988875
I am new to oracle. I need to get the scheduled jobs in my database.
我是 oracle 的新手。我需要在我的数据库中获取预定的作业。
I queried
我问过
DBA_SCHEDULER_JOBS,
DBA_SCHEDULER_SCHEDULES, DBA_SCHEDULER_PROGRAMS,
DBA_SCHEDULER_JOB_CLASSES, DBA_JOBS.
But Oracle issues the error
但是 Oracle 发出错误
"ORA-00942: table or view does not exist".
When I queried ALL_JOBS and USER_JOBS no rows are retrieved. Please suggest me which table should I see.
当我查询 ALL_JOBS 和 USER_JOBS 时,没有检索到任何行。请建议我应该看哪张桌子。
采纳答案by APC
The DBA views are restricted. So you won't be able to query them unless you're connected as a DBA or similarly privileged user.
DBA 视图受到限制。因此,除非您以 DBA 或类似特权用户的身份连接,否则您将无法查询它们。
The ALL views show you the information you're allowed to see. Normally that would be jobs you've submitted, unless you have additional privileges.
ALL 视图显示您可以查看的信息。通常,这将是您提交的作业,除非您具有其他权限。
The privileges you need are defined in the Admin Guide. Find out more.
您需要的权限在管理指南中定义。 了解更多。
So, either you need a DBA account or you need to chat with your DBA team about getting access to the information you need.
因此,要么您需要一个 DBA 帐户,要么您需要与您的 DBA 团队讨论如何访问您需要的信息。
回答by Kevin Burton
I think you need the SCHEDULER_ADMIN role to see the dba_scheduler tables (however this may grant you too may rights)
我认为您需要 SCHEDULER_ADMIN 角色才能查看 dba_scheduler 表(但这也可能授予您权限)
see: http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/schedadmin001.htm
见:http: //download.oracle.com/docs/cd/B28359_01/server.111/b28310/schedadmin001.htm
回答by tramper
Because the SCHEDULER_ADMINrole is a powerful role allowing a grantee to execute code as any user, you should consider granting individual Scheduler system privileges instead. Object and system privileges are granted using regular SQL grant syntax. An example is if the database administrator issues the following statement:
因为SCHEDULER_ADMIN角色是一个强大的角色,允许被授权者以任何用户的身份执行代码,所以您应该考虑授予单个调度程序系统权限。使用常规 SQL 授予语法授予对象和系统权限。例如,如果数据库管理员发出以下语句:
GRANT CREATE JOB TO scott;
授予创建工作给斯科特;
After this statement is executed, scott can create jobs, schedules, or programs in his schema.
执行此语句后,scott 可以在他的模式中创建作业、调度或程序。
copied from http://docs.oracle.com/cd/B19306_01/server.102/b14231/schedadmin.htm#i1006239
复制自http://docs.oracle.com/cd/B19306_01/server.102/b14231/schedadmin.htm#i1006239