On this page
Warning:
As of June 5, 2024, CockroachDB v22.2 is no longer supported. For more details, refer to the Release Support Policy.
The SHOW SCHEDULES
statement lists all of the currently active backup schedules.
It also lists all of the currently active scheduled jobs for Row-Level TTL.
Required privileges
The following users can show a schedule:
- Members of the
admin
role. By default, theroot
user belongs to theadmin
role. - New in v22.2: Owners of a backup schedule, i.e., the user that created the backup schedule.
Synopsis
SHOW [RUNNING | PAUSED] SCHEDULES [FOR BACKUP];
SHOW SCHEDULE <schedule_id>;
Parameters
Parameter | Description |
---|---|
schedule_id |
The ID of the schedule you want to view. |
Response
The output of SHOW SCHEDULES
is sorted by creation time. The following fields are returned for each schedule:
Field | Description |
---|---|
id |
A unique ID to identify each schedule. This value is used if you want to control schedules (i.e., pause, resume, or drop it). |
label |
The name used to identify the schedule, given at the time of schedule creation. |
schedule_status |
The schedule's current status. |
next_run |
The TIMESTAMP at which the next scheduled job is slated to run. |
state |
Displays last-known errors or messages about the schedule. Cleared on retry of a scheduled job. |
recurrence |
How often the scheduled job is run, which is set at the time of schedule creation. |
jobsrunning |
The number of jobs currently running for the schedule. |
owner |
The user who created the schedule. Users with active schedules cannot be dropped. |
created |
The TIMESTAMP when the job was created. |
command |
The command that the scheduled job will run. This can be derived from the CREATE SCHEDULE FOR BACKUP statement used, or generated by the system for Row-Level TTL jobs. |
Examples
Show schedules
> SHOW SCHEDULES;
id | label | schedule_status | next_run | state | recurrence | jobsrunning | owner | created | command
---------------------+---------------------+-----------------+---------------------------+----------------------------------------+------------+-------------+-------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
588796190000218113 | schedule_name | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-10 16:52:16.846944+00:00 | {"backup_statement": "BACKUP INTO LATEST IN 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "backup_type": 1}
588819866656997377 | schedule_database | ACTIVE | 2020-09-15 00:01:00+00:00 | NULL | 1 0 * * * | 0 | root | 2020-09-10 18:52:42.339026+00:00 | {"backup_statement": "BACKUP DATABASE movr INTO LATEST IN 's3://test/schedule-database?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "backup_type": 1}
588820615348027393 | schedule_database | ACTIVE | 2020-09-14 22:00:00+00:00 | NULL | @hourly | 0 | root | 2020-09-10 18:56:30.919388+00:00 | {"backup_statement": "BACKUP TABLE movr.vehicles INTO LATEST IN 's3://test/schedule-table?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "backup_type": 1}
589963390457741313 | scheduled_first_run | PAUSED | NULL | Waiting for initial backup to complete | @hourly | 0 | root | 2020-09-14 19:48:58.042612+00:00 | {"backup_statement": "BACKUP TABLE movr.vehicles INTO LATEST IN 's3://test/scheduled-first-run?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "backup_type": 1}
588796190012702721 | schedule_name | ACTIVE | 2020-09-20 00:00:00+00:00 | NULL | @weekly | 0 | root | 2020-09-10 16:52:16.846944+00:00 | {"backup_statement": "BACKUP INTO 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached"}
588819866674233345 | schedule_database | ACTIVE | 2020-09-20 00:00:00+00:00 | NULL | @weekly | 0 | root | 2020-09-10 18:52:42.339026+00:00 | {"backup_statement": "BACKUP DATABASE movr INTO 's3://test/schedule-database?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached"}
588820615382302721 | schedule_database | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-10 18:56:30.919388+00:00 | {"backup_statement": "BACKUP TABLE movr.vehicles INTO 's3://test/schedule-table?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached"}
589963390487363585 | scheduled_first_run | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-14 19:48:58.042612+00:00 | {"backup_statement": "BACKUP TABLE movr.vehicles INTO 's3://test/scheduled-first-run?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "unpause_on_success": 589963390457741313}
(8 rows)
To view the CREATE SCHEDULE
statements for scheduled jobs, use SHOW CREATE SCHEDULE
.
Show running schedules
> SHOW RUNNING SCHEDULES;
id | label | schedule_status | next_run | state | recurrence | jobsrunning | owner | created | command
---------------------+---------------------+-----------------+---------------------------+----------+------------+-------------+-------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------
588796190000218113 | schedule_name | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-10 16:52:16.846944+00:00 | BACKUP INTO LATEST IN 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
588819866656997377 | schedule_database | ACTIVE | 2020-09-15 00:01:00+00:00 | NULL | 1 0 * * * | 0 | root | 2020-09-10 18:52:42.339026+00:00 | BACKUP DATABASE movr INTO LATEST IN 's3://test/schedule-database?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
588820615348027393 | schedule_database | ACTIVE | 2020-09-14 22:00:00+00:00 | NULL | @hourly | 0 | root | 2020-09-10 18:56:30.919388+00:00 | BACKUP TABLE movr.vehicles INTO LATEST IN 's3://test/schedule-table?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
588796190012702721 | schedule_name | ACTIVE | 2020-09-20 00:00:00+00:00 | NULL | @weekly | 0 | root | 2020-09-10 16:52:16.846944+00:00 | BACKUP INTO 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
588819866674233345 | schedule_database | ACTIVE | 2020-09-20 00:00:00+00:00 | NULL | @weekly | 0 | root | 2020-09-10 18:52:42.339026+00:00 | BACKUP DATABASE movr INTO 's3://test/schedule-database?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
588820615382302721 | schedule_database | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-10 18:56:30.919388+00:00 | BACKUP TABLE movr.vehicles INTO 's3://test/schedule-table?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
589963390487363585 | scheduled_first_run | ACTIVE | 2020-09-15 00:00:00+00:00 | NULL | @daily | 0 | root | 2020-09-14 19:48:58.042612+00:00 | BACKUP TABLE movr.vehicles INTO 's3://test/scheduled-first-run?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached
(7 rows)
Show paused schedules
> SHOW PAUSED SCHEDULES;
id | label | schedule_status | next_run | state | recurrence | jobsrunning | owner | created | command
---------------------+---------------------+-----------------+----------+----------------------------------------+------------+-------------+-------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
589963390457741313 | scheduled_first_run | PAUSED | NULL | Waiting for initial backup to complete | @hourly | 0 | root | 2020-09-14 19:48:58.042612+00:00 | {"backup_statement": "BACKUP TABLE movr.vehicles INTO LATEST IN 's3://test/scheduled-first-run?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached", "backup_type": 1}
(1 row)
Show a specific schedule
To view a specific schedule, use the schedule's id
:
> SHOW SCHEDULE 588796190012702721;
id | label | schedule_status | next_run | state | recurrence | jobsrunning | owner | created | command
---------------------+---------------+-----------------+---------------------------+---------+------------+-------------+-------+----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------
588796190012702721 | schedule_name | ACTIVE | 2020-09-20 00:00:00+00:00 | NULL | @weekly | 0 | root | 2020-09-10 16:52:16.846944+00:00 | {"backup_statement": "BACKUP INTO 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached"}
(1 row)