| title | Delete a Backup Device (SQL Server) | |||||
|---|---|---|---|---|---|---|
| description | This article shows you how to delete a backup device in SQL Server by using SQL Server Management Studio or Transact-SQL. | |||||
| author | MashaMSFT | |||||
| ms.author | mathoma | |||||
| ms.date | 03/14/2017 | |||||
| ms.service | sql | |||||
| ms.subservice | backup-restore | |||||
| ms.topic | how-to | |||||
| helpviewer_keywords |
|
[!INCLUDE SQL Server] This topic describes how to delete a backup device in [!INCLUDEssnoversion] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].
In This Topic
-
Before you begin:
-
To delete a backup device, using:
Requires membership in the diskadmin fixed server role.
-
After connecting to the appropriate instance of the [!INCLUDEssDEnoversion], in Object Explorer, click the server name to expand the server tree.
-
Expand Server Objects, and then expand Backup Devices.
-
Right-click the device you want, and then click Delete.
-
In the Delete Object dialog box, verify that the correct device name appears in the Object Name column.
-
Click OK.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query. This example shows how to use sp_dropdevice to delete a backup device. Execute the first example to create the
mybackupdiskbackup device and the physical namec:\backup\backup1.bak. Execute sp_dropdevice to delete themybackupdiskbackup device. Thedelfileparameter deletes the physical name.
--Define a backup device and physical name.
USE AdventureWorks2022;
GO
EXEC sp_addumpdevice 'disk', 'mybackupdisk', 'c:\backup\backup1.bak' ;
GO
--Delete the backup device and the physical name.
USE AdventureWorks2022;
GO
EXEC sp_dropdevice ' mybackupdisk ', 'delfile' ;
GO
View the Properties and Contents of a Logical Backup Device (SQL Server)
sys.backup_devices (Transact-SQL)
BACKUP (Transact-SQL)
Backup Devices (SQL Server)
sp_addumpdevice (Transact-SQL)