Pages

2011-03-31

SQL Server: DB Backup - Part 2

  • Creating a Backup Device
EXEC sp_adddumpdevice @devtype='disk',
@logicalname='AWBackup',
@physicalname='D:\backup\AWBackup1.bak'

EXEC sp_adddumpdevice @devtype='tape',
@logicalname='AWTapeBackup',
@physicalname='\\.\tape0'
  • Removing a Backup Device
Sp_dropdevice @logicalname='AWBackup'  
This command only removes the backup device definition—it doesn’t automatically delete the files contained therein. Use this command to remove all the files in addition tothe device definition: 
Sp_dropdevice @logicalname='AWBackup', @devfile='DELFILE'
  • Managing Backup Devices
BACKUP DATABASE AdventureWorks
TO AWBackup
WITH EXPIREDATE = '12/05/2007'
or
BACKUP DATABASE AdventureWorks
TO AWBackup
WITH RETAINDAYS=7
The first option causes that specific backup to be removed after December 5, 2007at midnight. The second option forces that particular backup to be
removed after seven days have passed.

No comments:

Post a Comment