> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW SCHEDULES

The `SHOW SCHEDULES` [statement](https://docs.cockroachlabs.com/docs/stable/sql-statements.md) lists all of the currently active [backup schedules](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-backup.md) and [changefeed schedules](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-changefeed.md).

It also lists all of the currently active scheduled jobs for [Row-Level TTL](https://docs.cockroachlabs.com/docs/stable/row-level-ttl.md).

## Required privileges

To run `SHOW SCHEDULES`, a user must have one of the following:

* Membership in the [`admin` role](https://docs.cockroachlabs.com/docs/stable/security-reference/authorization#admin-role). By default, the `root` user belongs to the `admin` role.
* The [`VIEWJOB`](https://docs.cockroachlabs.com/docs/stable/security-reference/authorization#viewjob) system privilege, which can be granted with `GRANT SYSTEM VIEWJOB TO <user>`.
* The [`VIEWSYSTEMTABLE`](https://docs.cockroachlabs.com/docs/stable/security-reference/authorization#supported-privileges) system privilege.

## Synopsis

![show\_schedules syntax diagram](https://mintcdn.com/cockroachlabs/UZNSFbmU2EwEm6G5/images/sql-diagrams/common/show_schedules.svg?fit=max\&auto=format\&n=UZNSFbmU2EwEm6G5\&q=85\&s=50b20b40f6bb17e99818944d569d68b0)

## 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](https://docs.cockroachlabs.com/docs/stable/pause-schedules.md), [resume](https://docs.cockroachlabs.com/docs/stable/resume-schedules.md), or [drop](https://docs.cockroachlabs.com/docs/stable/drop-schedules.md) 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`](https://docs.cockroachlabs.com/docs/stable/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](https://docs.cockroachlabs.com/docs/stable/show-jobs.md) currently running for the schedule. |
| `owner` | The [user](https://docs.cockroachlabs.com/docs/stable/create-user.md) who created the schedule. Users with active schedules cannot be dropped. |
| `created` | The [`TIMESTAMP`](https://docs.cockroachlabs.com/docs/stable/timestamp) when the job was created. |
| `on_previous_running` | The status of the scheduled job if the previous backup is still running. This [option](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-backup.md#schedule-options) by default is set to `WAIT`. |
| `on_execution_failure` | The status of the scheduled job if an error occurs during the job execution. This [option](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-backup.md#schedule-options) by default is set to `RETRY_SCHED`. |
| `command` | The command that the scheduled job will run. This can be derived from the [`CREATE SCHEDULE FOR BACKUP`](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-backup) statement, [`CREATE SCHEDULE FOR CHANGEFEED`](https://docs.cockroachlabs.com/docs/stable/create-schedule-for-changefeed) statement, or generated by the system for [Row-Level TTL](https://docs.cockroachlabs.com/docs/stable/row-level-ttl.md) jobs. |
| `backup_type` | Displays whether a scheduled backup job is [`FULL`](https://docs.cockroachlabs.com/docs/stable/take-full-and-incremental-backups#full-backups) or [`INCREMENTAL`](https://docs.cockroachlabs.com/docs/stable/take-full-and-incremental-backups#incremental-backups) when running `SHOW SCHEDULES FOR BACKUP`. |

## Examples

### Show schedules

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW SCHEDULES;
```

```
          id         |        label        | schedule_status |         next_run          |                 state                  | recurrence | jobsrunning | owner |             created              | on_previous_running | on_execution_failure |                                                                                                                    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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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 | WAIT                | RETRY_SCHED          | {"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`](https://docs.cockroachlabs.com/docs/stable/show-create-schedule).

### Show running schedules

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW RUNNING SCHEDULES;
```

```
          id         |        label        | schedule_status |         next_run          |                 state                  | recurrence | jobsrunning | owner |             created              | on_previous_running | on_execution_failure |                                                                                                                    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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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 | WAIT                | RETRY_SCHED          | 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

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW PAUSED SCHEDULES;
```

```
          id         |        label        | schedule_status | next_run |                 state                  | recurrence | jobsrunning | owner |             created              | on_previous_running | on_execution_failure |                                                                                                                    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 | WAIT                | RETRY_SCHED          | {"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`:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW SCHEDULE 588796190012702721;
```

```
          id         |        label        | schedule_status |         next_run          |                 state                  | recurrence | jobsrunning | owner |             created              | on_previous_running | on_execution_failure |                                                                                                                    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 | WAIT                | RETRY_SCHED          | {"backup_statement": "BACKUP INTO 's3://test/schedule-test2?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=redacted' WITH revision_history, detached"}
(1 row)
```

## See also

* [Manage a Backup Schedule](https://docs.cockroachlabs.com/docs/stable/manage-a-backup-schedule.md)
* [`BACKUP`](https://docs.cockroachlabs.com/docs/stable/backup)
* [`RESTORE`](https://docs.cockroachlabs.com/docs/stable/restore)
* [`CREATE CHANGEFEED`](https://docs.cockroachlabs.com/docs/stable/create-changefeed)
* [`SHOW BACKUP`](https://docs.cockroachlabs.com/docs/stable/show-backup)
* [`PAUSE SCHEDULES`](https://docs.cockroachlabs.com/docs/stable/pause-schedules)
* [`RESUME SCHEDULES`](https://docs.cockroachlabs.com/docs/stable/resume-schedules)
* [`DROP SCHEDULES`](https://docs.cockroachlabs.com/docs/stable/drop-schedules)
* [`PAUSE JOB`](https://docs.cockroachlabs.com/docs/stable/pause-job)
* [`RESUME JOB`](https://docs.cockroachlabs.com/docs/stable/pause-job)
* [`CANCEL JOB`](https://docs.cockroachlabs.com/docs/stable/cancel-job)
* [Take Full and Incremental Backups](https://docs.cockroachlabs.com/docs/stable/take-full-and-incremental-backups.md)
* [Row-Level TTL](https://docs.cockroachlabs.com/docs/stable/row-level-ttl.md)
* [Use the Built-in SQL Client](https://docs.cockroachlabs.com/docs/stable/cockroach-sql.md)
* [`cockroach` Commands Overview](https://docs.cockroachlabs.com/docs/stable/cockroach-commands)
