Share via


Delete a Backup Device (SQL Server)

This topic describes how to delete a backup device in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.

In This Topic

  • Before you begin:

    Security

  • To delete a backup device, using:

    SQL Server Management Studio

    Transact-SQL

Before You Begin

Security

Permissions

Requires membership in the diskadmin fixed server role.

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Studio

To delete a backup device

  1. After connecting to the appropriate instance of the 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.

Arrow icon used with Back to Top link [Top]

Using Transact-SQL

To delete a backup device

  1. Connect to the Database Engine.

  2. From the Standard bar, click New Query.

  3. 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 mybackupdisk backup device and the physical name c:\backup\backup1.bak. Execute sp_dropdevice to delete the mybackupdisk backup device. 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

Arrow icon used with Back to Top link [Top]

See Also

Reference

sys.backup_devices (Transact-SQL)

BACKUP (Transact-SQL)

sp_addumpdevice (Transact-SQL)

Concepts

View the Properties and Contents of a Logical Backup Device (SQL Server)

Backup Devices (SQL Server)