MY_JOBS系统视图获取其定义信息。主要字段:作业创建者、作业执行者、作业对应的数据库名称、开始执行时间、结束时间、运行状态等。
--查看当前用户所属的定时任务详情
select job,dbname,start_date,last_date,this_date,next_date,broken,status,interval,failures,what from my_jobs;
|
名称 |
类型 |
描述 |
|
job |
bigint |
作业ID。 |
|
log_user |
name |
创建者的UserName。 |
|
priv_user |
name |
作业执行者的UserName。 |
|
dbname |
name |
作业创建数据库名称。 |
|
schema_user |
name |
定时任务的默认模式。 |
|
start_date |
timestamp without time zone |
作业的开始时间。 |
|
start_suc |
text |
作业成功执行的开始时间。 |
|
last_date |
timestamp without time zone |
上次运行开始时间。 |
|
last_suc |
text |
上次成功运行的开始时间。 |
|
last_sec |
text |
上次成功运行的开始时间,提供兼容性支持。 |
|
this_date |
timestamp without time zone |
正在运行任务的开始时间。 |
|
this_suc |
text |
正在运行任务成功的开始时间。 |
|
this_sec |
text |
正在运行任务成功的开始时间,提供兼容性支持。 |
|
next_date |
timestamp without time zone |
任务下次执行时间。 |
|
next_suc |
text |
任务下次成功执行时间。 |
|
next_sec |
text |
任务下次成功执行时间,提供兼容性支持。 |
|
total_time |
numeric |
任务最近一次的执行时长。 |
|
broken |
text |
如果任务状态为破,则为'y',否则为'n'。 |
|
status |
"char" |
执行状态,取值范围:('r', 's', 'f', 'd'),默认为'r',取值含义:r=running、s=successfully finished、f= job failed、d=aborted |
|
interval |
text |
用来计算下次运行时间的时间表达式,如果为null则表示定时任务只执行一次。 |
|
failures |
smallint |
失败计数,作业连续执行失败16次,不再继续执行。 |
|
what |
text |
可执行的作业。 |




