sp_delete_database_backuphistory (Transact-SQL)sp_delete_database_backuphistory (Transact-SQL)

適用於: 是SQL Server 否Azure SQL Database 否Azure SQL 資料倉儲 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

從備份及還原記錄資料表中刪除指定資料庫的相關資訊。Deletes information about the specified database from the backup and restore history tables.

主題連結圖示 Transact-SQL 語法慣例Topic link icon Transact-SQL Syntax Conventions


sp_delete_database_backuphistory [ @database_name = ] 'database_name'  


[ @database_name = ] database_name 指定備份和還原作業所涉及的資料庫的名稱。[ @database_name = ] database_name Specifies the name of the database involved in backup and restore operations. database_namesysname,沒有預設值。database_name is sysname, with no default.

傳回碼值Return Code Values

0 (成功) 或 1 (失敗)0 (success) or 1 (failure)

結果集Result Sets



sp_delete_database_backuphistory必須從執行msdb資料庫。sp_delete_database_backuphistory must be run from the msdb database.

這個預存程序會影響下列資料表:This stored procedure affects the following tables:


需要 系統管理員 (sysadmin) 固定伺服器角色中的成員資格。Requires membership in the sysadmin fixed server role.


下列範例會刪除 AdventureWorks2012AdventureWorks2012 資料庫在備份與還原記錄資料表中的所有項目。The following example deletes all entries for the AdventureWorks2012AdventureWorks2012 database in the backup-and-restore history tables.

USE msdb;  
EXEC sp_delete_database_backuphistory @database_name = 'AdventureWorks2012';  

另請參閱See Also

sp_delete_backuphistory (-SQL)) sp_delete_backuphistory (Transact-SQL)
備份記錄與標頭資訊 (SQL Server)Backup History and Header Information (SQL Server)