SHOW JOB STATUS
Description
Queries the status of an asynchronous task.
tip
The root user can view the status of all jobs, while a normal user can view only the status of their own jobs.
Syntax
SHOW JOB STATUS [WHERE job='job_id'];
Parameters
job_id: 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 job_id to view the status of a single task.
Examples
-
View the status of all tasks created by the current user.
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.012 sec) -
You can also use the
whereclause to specify the job ID and view the status of a single task.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.006 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 when the job runs. |
create_time | the time when the job was created. |
update_time | the time when the job status was last updated. |
definition | the SQL statement executed by the job. |