删除备份设备 (SQL Server)Delete a Backup Device (SQL Server)

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

本主题介绍了如何使用 SQL ServerSQL ServerSQL Server Management StudioSQL Server Management StudioTransact-SQLTransact-SQL中删除备份设备。This topic describes how to delete a backup device in SQL ServerSQL Server 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 数据库引擎SQL Server Database Engine实例之后,在对象资源管理器中,单击服务器名称以展开服务器树。After connecting to the appropriate instance of the SQL Server 数据库引擎SQL 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 EngineConnect to the 数据库引擎Database 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)