SHOW CREATE SCHEDULE

On this page Carat arrow pointing down
Warning:
GA releases for CockroachDB v23.1 are no longer supported. Cockroach Labs will stop providing LTS Assistance Support for v23.1 LTS releases on November 13, 2025. Prior to that date, upgrade to a more recent version to continue receiving support. For more details, refer to the Release Support Policy.

The SHOW CREATE SCHEDULE statement displays the CREATE statement for an existing scheduled job, which can be used to recreate a schedule.

Required privileges

Only members of the admin role can show a CREATE SCHEDULE statement. By default, the root user belongs to the admin role.

Synopsis

SHOW CREATE ALL SCHEDULES SCHEDULE a_expr

Parameters

Parameter Description
schedule_id Use the schedule id to show the CREATE SCHEDULE for a particular schedule.
ALL Use to show the CREATE SCHEDULE statements for all existing schedules. This includes paused schedules.

Response

Field Description
schedule_id The id of the schedule.
create_statement The CREATE statement of the schedule.

Examples

SHOW CREATE SCHEDULE will display existing schedules including schedules that have been paused.

Show the CREATE SCHEDULE statement for a schedule

Use the schedule id for a particular schedule to view its CREATE statement:

icon/buttons/copy
SHOW CREATE SCHEDULE 702856921622544385;
schedule_id        |                                                                                                                                                                create_statement
-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
702856921622544385 | CREATE SCHEDULE 'scheduled_first_run' FOR BACKUP TABLE movr.public.vehicles INTO 'gs://bucket-name/backup-test?AUTH=specified&CREDENTIALS=redacted' WITH detached RECURRING '@daily' FULL BACKUP ALWAYS WITH SCHEDULE OPTIONS first_run = '2021-10-19 00:00:00+00:00', on_execution_failure = 'RESCHEDULE', on_previous_running = 'WAIT'
(1 row)

To list all the currently active schedules, use SHOW SCHEDULES.

Show the CREATE SCHEDULE statement for all schedules

icon/buttons/copy
SHOW CREATE ALL SCHEDULES;
schedule_id        |                                                                                                                                                            create_statement
-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
698901570078113793 | SELECT crdb_internal.schedule_sql_stats_compact()
699244489678356481 | CREATE SCHEDULE 'BACKUP 1633462883' FOR BACKUP INTO 'nodelocal://0/test' WITH detached RECURRING '@hourly' FULL BACKUP ALWAYS WITH SCHEDULE OPTIONS first_run = '2021-10-05 20:00:00+00:00', on_execution_failure = 'RESCHEDULE', on_previous_running = 'WAIT'
699246220072812545 | CREATE SCHEDULE 'scheduled_first_run' FOR BACKUP TABLE movr.public.vehicles INTO 's3://bucket-name/backup-test?AWS_ACCESS_KEY_ID={AWS_ACCESS_KEY}&AWS_SECRET_ACCESS_KEY=redacted' WITH detached RECURRING '@daily' FULL BACKUP '@weekly' WITH SCHEDULE OPTIONS first_run = '2021-10-05 19:50:11.497459+00:00', on_execution_failure = 'RESCHEDULE', on_previous_running = 'WAIT'
699246220077694977 | CREATE SCHEDULE 'scheduled_first_run' FOR BACKUP TABLE movr.public.vehicles INTO 's3://bucket-name/backup-test?AWS_ACCESS_KEY_ID={AWS_ACCESS_KEY}&AWS_SECRET_ACCESS_KEY=redacted' WITH detached RECURRING '@daily' FULL BACKUP '@weekly' WITH SCHEDULE OPTIONS first_run = '2021-10-05 19:50:11.497459+00:00', on_execution_failure = 'RESCHEDULE', on_previous_running = 'WAIT'
(4 rows)

See also


Yes No
On this page

Yes No