Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 2.08 KB

snapshot-backup-sp-delete-backup.md

File metadata and controls

47 lines (33 loc) · 2.08 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic dev_langs
sp_delete_backup (Transact-SQL)
Deletes all snapshots and the backup file that comprise a snapshot backup set from the specified database.
MashaMSFT
mathoma
randolphwest
08/21/2024
sql
system-objects
reference
TSQL

sp_delete_backup (Transact-SQL)

[!INCLUDE sqlserver2016]

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.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sys.sp_delete_backup
    [ @backup_url = ] N'backup_metadata_file_url'
    , [ [ @db_name = ] N'database_name' | NULL ]

Arguments

[ @backup_url = ] N'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 = ] N'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 to delete each snapshot. If no database name is provided, this database check isn't performed.

Permissions

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

Related content