查看备份集中的数据和日志文件 (SQL Server)View the data and log files in a backup set (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 view the data and log files in a backup set in SQL Server 2019 (15.x)SQL Server 2019 (15.x) by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL.

本主题内容In This Topic

开始之前Before You Begin

SecuritySecurity

有关安全性的信息,请参阅 RESTORE FILELISTONLY (Transact SQL)For information about security, see RESTORE FILELISTONLY (Transact-SQL)

权限Permissions

SQL Server 2008SQL Server 2008 和更高版本中,获取有关备份集或备份设备的信息要求具有 CREATE DATABASE 权限。In SQL Server 2008SQL Server 2008 and later versions, obtaining information about a backup set or backup device requires CREATE DATABASE permission. 有关详细信息,请参阅 GRANT 数据库权限 (Transact-SQL)For more information, see GRANT Database Permissions (Transact-SQL).

使用 SQL Server Management StudioUsing SQL Server Management Studio

查看备份集中的数据文件和日志文件To view the data and log files in a backup set

  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 Databases, and, depending on the database, either select a user database or expand System Databases and select a system database.

  3. 右键单击该数据库,再单击“属性” ,这将打开“数据库属性” 对话框。Right-click the database, and then click Properties, which opens the Database Properties dialog box.

  4. “选择页” 窗格中,单击 “文件”In the Select a Page pane, click Files.

  5. “数据库文件” 网格查找数据和日志文件及其属性的列表。Look in the Database files grid for a list of the data and log files and their properties.

使用 Transact-SQLUsing Transact-SQL

查看备份集中的数据文件和日志文件To view the data and log files in a backup set

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

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

  3. 使用 RESTORE FILELISTONLY 语句。Use the RESTORE FILELISTONLY statement. 此示例返回有关FILE=2备份设备上的第二个备份集 ( AdventureWorksBackups ) 的信息。This example returns information about the second backup set (FILE=2) on the AdventureWorksBackups backup device.

USE AdventureWorks2012 ;  
RESTORE FILELISTONLY FROM AdventureWorksBackups   
   WITH FILE=2;  
GO  

另请参阅See Also

backupfilegroup (Transact-SQL) backupfilegroup (Transact-SQL)
backupfile (Transact-SQL) backupfile (Transact-SQL)
backupset (Transact-SQL) backupset (Transact-SQL)
backupmediaset (Transact-SQL) backupmediaset (Transact-SQL)
backupmediafamily (Transact-SQL) backupmediafamily (Transact-SQL)
备份设备 (SQL Server)Backup Devices (SQL Server)