Purpose
Queries the status of an asynchronous task.
Notice
root users can view the status of all jobs, while ordinary users can only view the status of their own jobs.
Syntax
SHOW JOB STATUS [WHERE job='job_id'];
Parameters
job_id specifies the unique ID of the asynchronous task. You can execute SHOW JOB STATUS to view the status of all tasks created by the current user, or use the where statement to specify the 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 using the
wherecondition 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)
Field description
| 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 |
The error message returned during the execution of the job. |
create_time |
The time when the job was created. |
update_time |
The time when the status of the job was last updated. |
definition |
The SQL statement executed by the job. |
