Skip to main content
The ALTER BACKUP SCHEDULE statement modifies an existing . You can use ALTER BACKUP SCHEDULE to do the following:
  • Set a different name for a backup schedule.
  • Change a scheduled backup’s storage location.
  • Apply additional backup options or schedule options to backups and schedules.
  • Adjust the cadence and type of scheduled backups.

Required privileges

To alter a backup schedule, you must be the owner of the backup schedule, i.e., the user that .

Synopsis

alter_backup_schedule syntax diagram SQL syntax diagram

Parameters

Backup options

You can use the backup options in this table to control the behavior of your backups. See Apply different options to scheduled backups for an example.

Schedule options

You can use the schedule options in this table to control the behavior of your backup schedule. See Apply different options to scheduled backups for an example.

Examples

The examples in this section start with the following created backup schedule. Each section follows on from the previous example’s schedule state. First, create a schedule that will take daily full backups of the cluster:
This statement specifies:
  • 'external://s3_storage': Use the storage location represented by this URI.
  • first_run = 'now': Take the first full backup immediately rather than wait for its next RECURRING time.
  • ignore_existing_backups: Ignore any existing backups already present in the storage location.
The command returns the following output. Note that the detached option is implicitly added, because this backup has been configured to run on a schedule:

Change the storage location for scheduled backups

You can change the storage location to which your backup schedule is taking backups with the SET INTO command. Use the schedule ID to specify the schedule to modify and the new storage location URI. This statement also changes the schedule’s label to match the change in backup location:
require a full backup in the storage location. Therefore, when you change the storage location for a backup schedule, CockroachDB will pause any scheduled incremental backups until the next full backup runs on its regular schedule cadence. Consider that if you change the storage location and then adjust the frequency of your scheduled backups before the next full backup, any newly added incremental backups will not be part of the pause after a storage location change. This could result in a reported error state for the incremental backups, which will not resolve until the next scheduled full backup.

Adjust frequency of scheduled backups

To adjust the frequency of your scheduled backups, use SET with FULL BACKUP and RECURRING for full and incremental backups. You can either define the frequency as a STRING or in crontab format. See the Parameters table for more detail. The following command adds incremental backups to the schedule occurring hourly:
The output shows the two scheduled jobs:
You can use the SHOW SCHEDULE statement with one of the schedule IDs to show details for each of the jobs. For the full backup job:
This shows that the full backup has a dependent schedule, which lists the incremental backup’s schedule ID:
For the incremental backup:
The following includes the backup_type as 1. This signifies that this schedule is for an incremental backup:
Full backups are implicitly of backup_type 0, and so does not display in the schedule details.

Apply different options to scheduled backups

Removed in v26.2: The incremental_location option has been removed in v26.2, following its prior . Existing backups taken with this option cannot be restored in v26.2 or later. If you have backups that use incremental_location, you can only restore them using a cluster running v26.1 or earlier.
You can modify the behavior of your backup schedule and the backup jobs with SET SCHEDULE OPTION and SET WITH. See the Schedule options table and the Backup options table for a list of the available options. This statement changes the default wait value for the on_previous_running schedule option to start. If a previous backup started by the schedule is still running, the scheduled job will now start the new backup anyway, rather than waiting. The backup option modifies the storage location for incremental backups:
The incremental backup schedule’s BACKUP statement shows that it will read files in the full backup location 'external://gcs_storage' and ultimately store the incremental backup in 'external://gcs_incremental_storage' on an hourly basis:

Execute a schedule immediately

You can alter an active schedule to run an incremental schedule immediately with EXECUTE IMMEDIATELY:
To run the full backup schedule instead, specify FULL:
The schedule must be active to use EXECUTE [FULL] IMMEDIATELY. You need to a paused schedule before it will execute. Use following the schedule run to pause the schedule once again.

See also