About SQL Server database relay storage device Analysis

Source: Internet
Author: User
Tags join backup

Add the dump device to the location where SQL Server backs up the database. In the SEM the storage equipment is visible, and the information on the device is stored in the Sysdevice table of the primary database. SysAdmin and Diskadmin server members are allowed to join and undo this device.

The following script shows how to join this device. The Sysdvices table gets the information on the device and then undoes the dump device.

  EXEC sp_addumpdevice 'DISK', 'pubs_dump', 'c:pubs_dump.bak'
  GO
  BACKUP DATABASE pubs TO pubs_dump WITH NOINIT, STATS = 10
  GO
  SELECT name logical_name, phyname physical_name, *
  FROM master..sysdevices WHERE name = 'pubs_dump'
  GO
  EXEC sp_dropdevice pubs_dump, DELFILE
  GO

You can seniority the database directly without passing the dump device. The following command completes this step:

  BACKUP DATABASE pubs TO DISK='c:pubs_filedump.bak'
  WITH NOINIT, STATS = 10
  GO

SEM is not visible in the backup of the database, it is directly to the disk. Therefore, you can add a dump device to point to this file. When the dump device is added, you can use SEM to provide visibility files to the dump device. Adding a dump device does not see the contents of the stored file, but it can be seen in SEM.

  SELECT name logical_name, phyname physical_name, *
  FROM master..sysdevices WHERE name like '%pubs%'
  GO
  EXEC sp_addumpdevice 'DISK', 'pubs_diskdump', 'c:pubs_filedump.bak'
  GO
  SELECT name logical_name, phyname physical_name, *
  FROM master..sysdevices WHERE name like '%pubs%'
  GO

If you want to undo this device and file, you can use the Sp_dropdevice command for the logical device name. If you want to delete the file that the dump device points to, you can add the delfiled statement. The following script will undo the previously created device:

  EXEC sp_dropdevice pubs_diskdump, DELFILE
  GO
  SELECT name logical_name, phyname physical_name, *
  FROM master..sysdevices WHERE name like '%pubs%'
  GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.