title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sp_delete_database_backuphistory (Transact-SQL) |
Deletes information about the specified database from the backup and restore history tables. |
markingmyname |
maghan |
randolphwest |
01/23/2024 |
sql |
system-objects |
reference |
|
|
|
[!INCLUDE SQL Server]
Deletes information about the specified database from the backup and restore history tables.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_delete_database_backuphistory [ @database_name = ] N'database_name'
[ ; ]
Specifies the name of the database involved in backup and restore operations. @database_name is sysname, with no default.
0
(success) or 1
(failure).
None.
sp_delete_database_backuphistory
must be run from the msdb
database.
This stored procedure affects the following tables:
- backupfile
- backupfilegroup
- backupmediafamily
- backupmediaset
- backupset
- restorefile
- restorefilegroup
- restorehistory
[!INCLUDE msdb-execute-permissions]
The following example deletes all entries for the [!INCLUDE ssSampleDBobject] database in the backup-and-restore history tables.
USE msdb;
GO
EXEC sp_delete_database_backuphistory
@database_name = 'AdventureWorks2022';