檢視備份組中的資料和記錄檔 (SQL Server)View the Data and Log Files in a Backup Set (SQL Server)

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

此主題描述如何使用 SQL ServerSQL ServerSQL Server Management StudioSQL Server Management Studio ,在 Transact-SQLTransact-SQL中檢視備份組中的資料和記錄檔。This topic describes how to view the data and log files in a backup set in SQL ServerSQL Server by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL.

本主題內容In This Topic

開始之前Before You Begin

安全性Security

如需安全性的相關資訊,請參閱 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 Database EngineSQL Server Database Engine執行個體之後,在 [物件總管] 中按一下伺服器名稱展開伺服器樹狀目錄。After connecting to the appropriate instance of the MicrosoftMicrosoft SQL Server Database EngineSQL 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 EngineDatabase EngineConnect to the Database EngineDatabase 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)