managed_backup.sp_backup_config_schedule (Transact-SQL)

APPLIES TO: yesSQL Server (starting with 2016) noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

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

Topic link icon Transact-SQL Syntax Conventions

Syntax

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'  

Arguments

@database_name
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.

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

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

@days_of_week
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'.

@backup_begin_time
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.

@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.

@log_backup_freq
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 is valid, which indicates no log backups. Disabling log backups would only be appropriate for databases with a simple recovery model.

Note

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

Return Code Value

0 (success) or 1 (failure)

Security

Permissions

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)