Purpose
You can use this statement to query the status of an asynchronous job.
Notice
The root user can query the status of jobs created by all users, whereas a regular user can query the status of jobs created only by itself.
Syntax
SHOW JOB STATUS [WHERE job='job_id'];
Parameters
job_id specifies the unique ID of the asynchronous job. You can execute the SHOW JOB STATUS statement to query the status of all jobs created by the current user, or query the status of a single job by specifying the job ID in the WHERE clause.
Examples
Query the status of all jobs 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)Query the status of a single job by specifying the job ID in the
WHEREclause.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)
Parameters
| Parameter | Description |
|---|---|
job_id |
The unique ID of the job. |
schema_name |
The name of the database. |
status |
The status of the job. Valid values:
|
fail_msg |
The error message returned during job execution. |
create_time |
The time when the job was created. |
update_time |
The time when the job was last modified. |
definition |
The SQL statement executed by the job. |