managed_backup.sp_backup_config_schedule (Transact-SQL)

APPLIES TO: yesSQL Server 2016 and later noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

Configures automated or custom scheduling options for SQL Server Managed Backup to Microsoft Azure.

Topic link icon Transact-SQL Syntax Conventions


EXEC managed_backup.sp_backup_config_schedule   
    [@database_name = ] 'database_name'
    ,[@scheduling_option = ] {'Custom' | 'System'}  
    ,[@full_backup_freq_type = ] {'Daily' | 'Weekly'}  
    ,[@days_of_week = ] 'days_of_the_week'  
    ,[@backup_begin_time = ] 'begin time of the backup window'  
    ,[@backup_duration = ] 'backup window length'  
    ,[@log_backup_freq = ] 'frequency of log backup'  


The database name for enabling managed backup on a specific database. If NULL or *, then this managed backup applies to all databases on the server.

Specify 'System' for system-controlled backup scheduling. Specify 'Custom' for a custom schedule defined by the other paratmeters.

The frequency type for the managed backup operation, which can be set to 'Daily' or 'Weekly'.

The days of the week for the backups when @full_backup_freq_type is set to Weekly. Specify full string names like 'Monday'. You can also specify more than one day name, separated by Pipe. For example N'Monday | Wednesday | Friday'.

The start time of the backup window. Backups will not be started outside of the time window, which is defined by a combination of @backup_begin_time and @backup_duration.

The duration of the backup time window. Note that there is no guarantee that backups will be completed during the time window defined by @backup_begin_time and @backup_duration. Backup operations that are started in this time window but exceed the duration of the window will not be cancelled.

This determines the frequency of transaction log backups. These backups happen at regular intervals rather than on the schedule specified for the database backups. @log_backup_freq can be in minutes or hours and 0:00 is valid, which indicates no log backups. Disabling log backups would only be appropriate for databases with a simple recovery model.


If the recovery model changes from simple to full, you need to reconfigure the log_backup_freq from 0:00 to a non-zero value.

Return Code Value

0 (success) or 1 (failure)



Requires membership in db_backupoperator database role, with ALTER ANY CREDENTIAL permissions, and EXECUTE permissions on sp_delete_backuphistory stored procedure.

See Also

managed_backup.sp_backup_config_basic (Transact-SQL)
managed_backup.sp_backup_config_advanced (Transact-SQL)