Creating a Backup Device

Early versions of SQL Server required you to configure backup devices before you could back up databases. With SQL Server 2005, you do not need to explicitly define backup devices. Nevertheless, backup devices do provide an easy way to ensure that you create backups that have the same file name and location time after time. By using consistent names and locations, you can more easily manage the backup and recovery process.

To create a backup device using SQL Server Management Studio, complete the following steps:

  1. Start SQL Server Management Studio. In Object Explorer view, connect to the appropriate server.

  2. Expand the server’s Server Objects folder.

  3. Right-click Backup Devices, and then choose New Backup Device to open the dialog box shown in Figure 14-1.

    The Backup Device dialog box

    Figure 14-1. The Backup Device dialog box

  4. In the Device Name box, type the name of the logical backup device. Use a short but descriptive name, such as Customer Device or Master Device.

  5. If you have installed a tape drive and want to back up to the tape drive, select the Tape option button, and then use the related drop-down list box to select the target drive.

  6. If you are backing up to a file, select the File option button, and then type the full path to the backup file you want to associate with this device, such as E:MSSQLBACKUPPERSONNEL.BAK.

  7. Click OK. SQL Server will attempt to verify the backup file location. If there is a problem, you will see a prompt notifying you of any issues.

With Transact-SQL, you create backup devices using sp_addumpdevice. Example 14-1 shows the syntax and usage for this command, which uses many different arguments, including device_type, logical_name, physical_name, controller_type, and device_status. The device_type is the type of device you are using—disk or tape. The logical_name is the name of the backup device. The physical_name is the full path to the backup file. The controller_type is 2 for a disk or 5 for a tape. The device_status is either noskip, to read ANSI tape headers, or skip, to skip ANSI tape headers.

Example 14-1. sp_addumpdevice Syntax and Usage

Syntax

sp_addumpdevice [@devtype =]'device_type',
   
   [@logicalname =] 'logical_name',
   [@physicalname =] 'physical_name'
   [, {
          [@cntrltype =] controller_type |
          [@devstatus =] 'device_status'
   }
   ]

Usage

EXEC sp_addumpdevice 'disk', 'Customer',
   'c:mssqlackupcust.bak'

EXEC sp_addumpdevice 'disk', 'Customer on Backup Server', 
   '\omegaackupscust.bak'
EXEC sp_addumpdevice 'tape', 'Customer on Tape', 
'\.	ape0'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset