sp_delete_backup (Transact-SQL)

APPLIES TO: YesSQL Server 2016 and later NoAzure SQL Database NoAzure Synapse Analytics (SQL DW) NoParallel Data Warehouse

Deletes all snapshots and the backup file that comprise a snapshot backup set from the specified database. This system stored procedure is the only recommended method for managing snapshot backup sets. For more information, see File-Snapshot Backups for Database Files in Azure.

Topic link icon Transact-SQL Syntax Conventions


    [ @backup_url = ] backup_metadata_file_url  
    ,[ [ @db_name = ] database_name | NULL ]  


[ @backup_url = ] backup_meta_file_url
The URL of the backup to be deleted, which deletes all snapshots comprising the specified backup set including the backup file itself.

[ @db_name = ] database_name
The name of the database containing the snapshot to be deleted. When a database name is provided, the system verifies that the backup URL provided is a backup URL for the specified database and uses sp_delete_backup_file_snapshot (Transact-SQL) to delete each snapshot. If no database name is provided, this database check is not performed.


Requires ALTER ANY DATABASE permission or ALTER permission on the specified database.

See Also

sys.fn_db_backup_file_snapshots (Transact-SQL)
sp_delete_backup_file_snapshot (Transact-SQL)