刪除備份裝置 (SQL Server)Delete a Backup Device (SQL Server)

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

此主題描述如何使用 SQL Server 2019 (15.x)SQL Server 2019 (15.x)SQL Server Management StudioSQL Server Management Studio 來刪除 Transact-SQLTransact-SQL中的備份裝置。This topic describes how to delete a backup device in SQL Server 2019 (15.x)SQL Server 2019 (15.x) by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL.

本主題內容In This Topic

開始之前Before You Begin

SecuritySecurity

權限Permissions

需要 diskadmin 固定伺服器角色的成員資格。Requires membership in the diskadmin fixed server role.

使用 SQL Server Management StudioUsing SQL Server Management Studio

刪除備份裝置To delete a backup device

  1. 連接到適當的 SQL Server Database EngineSQL Server Database Engine執行個體之後,請在 [物件總管] 中按一下伺服器名稱以展開伺服器樹狀目錄。After connecting to the appropriate instance of the SQL Server Database EngineSQL Server Database Engine, in Object Explorer, click the server name to expand the server tree.

  2. 展開 [伺服器物件] ,然後展開 [備份裝置]Expand Server Objects, and then expand Backup Devices.

  3. 以滑鼠右鍵按一下所要的裝置,然後按一下 [刪除] 。Right-click the device you want, and then click Delete.

  4. [刪除物件] 對話方塊,確認 [物件名稱] 資料行中所顯示的裝置名稱是正確的。In the Delete Object dialog box, verify that the correct device name appears in the Object Name column.

  5. 按一下 [確定] 。Click OK.

使用 Transact-SQLUsing Transact-SQL

刪除備份裝置To delete a backup device

  1. 連接到 Database EngineDatabase EngineConnect to the Database EngineDatabase Engine.

  2. 在標準列中,按一下 [新增查詢]From the Standard bar, click New Query.

  3. 複製下列範例並貼入查詢中。Copy and paste the following example into the query. 此範例示範如何使用 sp_dropdevice 刪除備份裝置。This example shows how to use sp_dropdevice to delete a backup device. 執行第一個範例,建立 mybackupdisk 備份裝置和實體名稱 c:\backup\backup1.bakExecute the first example to create the mybackupdisk backup device and the physical name c:\backup\backup1.bak. 執行 sp_dropdevice 刪除 mybackupdisk 備份裝置。Execute sp_dropdevice to delete the mybackupdisk backup device. delfile 參數會刪除實體名稱。The delfile parameter deletes the physical name.

--Define a backup device and physical name.   
USE AdventureWorks2012 ;  
GO  
EXEC sp_addumpdevice 'disk', 'mybackupdisk', 'c:\backup\backup1.bak' ;  
GO  
--Delete the backup device and the physical name.  
USE AdventureWorks2012 ;  
GO  
EXEC sp_dropdevice ' mybackupdisk ', 'delfile' ;  
GO  
  

另請參閱See Also

檢視邏輯備份裝置的屬性和內容 (SQL Server) View the Properties and Contents of a Logical Backup Device (SQL Server)
sys.backup_devices (Transact-SQL) sys.backup_devices (Transact-SQL)
BACKUP (Transact-SQL) BACKUP (Transact-SQL)
備份裝置 (SQL Server) Backup Devices (SQL Server)
sp_addumpdevice (Transact-SQL)sp_addumpdevice (Transact-SQL)