Purpose
This API is used to query the status of an asynchronous task.
Notice
The root user can view jobs created by all users, while regular users can only view their own jobs.
Syntax
SHOW JOB STATUS [WHERE job='job_id'];
Parameters
job_id is the unique ID of an asynchronous task. You can execute SHOW JOB STATUS to view the status of all tasks created by the current user, or use the WHERE clause to specify a job_id to view the status of a single task.
Examples
View the status of all tasks created by the current user.
obclient> show job status; +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ | job_id | schema_name | status | fail_msg | create_time | update_time | definition | +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ | 2010011125899906847397 | oceanbase | FINISH | SUCCESS | 2024-08-02 17:56:19.441303 | 2024-08-02 17:56:30.529692 | select sleep(1); | | 2010011125899906847786 | oceanbase | SUBMITTED | NULL | 2024-08-02 17:58:11.814612 | 2024-08-02 17:58:11.815297 | select sleep(2); | | 2010011125899906847800 | oceanbase | SUBMITTED | NULL | 2024-08-02 17:58:14.885659 | 2024-08-02 17:58:14.886382 | select sleep(3); | +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ 3 rows in set (0.00 sec)You can also specify the job ID in the
WHEREclause to view the status of a single task.OceanBase(root@oceanbase)>show job status where job='2010011125899906847397'; +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ | job_id | schema_name | status | fail_msg | create_time | update_time | definition | +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ | 2010011125899906847397 | oceanbase | FINISH | SUCCESS | 2024-08-02 17:56:19.441303 | 2024-08-02 17:56:30.529692 | select sleep(1); | +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+ 1 rows in set (0.00 sec)
Columns
field |
Description |
|---|---|
job_id |
The unique ID of the job. |
schema_name |
The name of the database. |
status |
The running status of the job.
|
fail_msg |
Error message when the job is running. |
create_time |
The time when the job was created. |
update_time |
The time when the job's status was last updated. |
definition |
The SQL statement executed by the job. |