为磁盘文件定义逻辑备份设备 (SQL Server)Define a Logical Backup Device for a Disk File (SQL Server)

适用于: 是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: YesSQL Server NoAzure SQL Database NoAzure Synapse Analytics (SQL DW) NoParallel Data Warehouse

本主题说明如何使用 SQL Server 2019 (15.x)SQL Server 2019 (15.x)SQL Server Management StudioSQL Server Management StudioTransact-SQLTransact-SQL中为磁盘文件定义逻辑备份设备。This topic describes how to define a logical backup device for a disk file in SQL Server 2019 (15.x)SQL Server 2019 (15.x) by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL. 逻辑设备是指向特定物理备份设备(磁盘文件或磁带机)的用户定义名称。A logical device is a user-defined name that points to a specific physical backup device (a disk file or tape drive). 将备份写入备份设备后,便会初始化物理设备。The initialization of the physical device occurs later, when a backup is written to the backup device.

本主题内容In This Topic

开始之前Before You Begin

限制和局限Limitations and Restrictions

  • 逻辑设备名称在服务器实例上的所有逻辑备份设备中必须是唯一的。The logical device name must be unique among all the logical backup devices on the server instance. 若要查看现有逻辑设备名称,请查询 sys.backup_devices 目录视图。To view the existing logical device names, query the sys.backup_devices catalog view.

建议Recommendations

  • 我们建议备份磁盘应不同于数据库数据和日志的磁盘。We recommend that a backup disk be a different disk than the database data and log disks. 这是数据或日志磁盘出现故障时访问备份数据必不可少的。This is necessary to make sure that you can access the backups if the data or log disk fails.

SecuritySecurity

权限Permissions

要求具有 diskadmin 固定服务器角色中的成员身份。Requires membership in the diskadmin fixed server role.

要求拥有写入磁盘的权限。Requires permission to write to the disk.

使用 SQL Server Management StudioUsing SQL Server Management Studio

为磁盘文件定义逻辑备份设备To define a logical backup device for a disk file

  1. 连接到相应的 MicrosoftMicrosoft SQL Server 数据库引擎SQL Server Database Engine 实例之后,在“对象资源管理器”中,单击服务器名称以展开服务器树。After connecting to the appropriate instance of the MicrosoftMicrosoft SQL Server 数据库引擎SQL Server Database Engine, in Object Explorer, click the server name to expand the server tree.

  2. 展开“服务器对象” ,然后右键单击“备份设备” 。Expand Server Objects, and right-click Backup Devices.

  3. 单击 “新建备份设备”Click New Backup Device. 将打开 “备份设备” 对话框。The Backup Device dialog box opens.

  4. 输入设备名称。Enter a device name.

  5. 若要确定目标位置,请单击 “文件” 并指定该文件的完整路径。For the destination, click File and specify the full path of the file.

  6. 若要定义新设备,请单击 “确定”To define the new device, click OK.

若要备份至此新设备,请将该设备添加到“备份数据库” (“常规” )对话框中的“备份到:” 字段。To back up to this new device, add it to the Back up to: field in the Back up Database (General) dialog box. 有关详细信息,请参阅 创建完整数据库备份 (SQL Server)中创建差异数据库备份。For more information, see Create a Full Database Backup (SQL Server).

使用 Transact-SQLUsing Transact-SQL

为磁盘文件定义逻辑备份To define a logical backup for a disk file

  1. 连接到 数据库引擎Database EngineConnect to the 数据库引擎Database Engine.

  2. 在标准菜单栏上,单击 “新建查询”From the Standard bar, click New Query.

  3. 将以下示例复制并粘贴到查询窗口中,然后单击“执行” 。Copy and paste the following example into the query window and click Execute. 此示例说明如何使用 sp_addumpdevice 为磁盘文件定义逻辑备份设备。This example shows how to use sp_addumpdevice to define a logical backup device for a disk file. 下面的示例以物理名称 mydiskdump添加名为 c:\dump\dump1.bak的磁盘备份设备。The example adds the disk backup device named mydiskdump, with the physical name c:\dump\dump1.bak.

USE AdventureWorks2012 ;  
GO  
EXEC sp_addumpdevice 'disk', 'mydiskdump', 'c:\dump\dump1.bak' ;  
GO  

另请参阅See Also

BACKUP (Transact-SQL) BACKUP (Transact-SQL)
备份设备 (SQL Server) Backup Devices (SQL Server)
sys.backup_devices (Transact-SQL) sys.backup_devices (Transact-SQL)
sp_addumpdevice (Transact-SQL) sp_addumpdevice (Transact-SQL)
sp_dropdevice (Transact-SQL) sp_dropdevice (Transact-SQL)
为磁带驱动器定义逻辑备份设备 (SQL Server) Define a Logical Backup Device for a Tape Drive (SQL Server)
查看逻辑备份设备的属性和内容 (SQL Server)View the Properties and Contents of a Logical Backup Device (SQL Server)