backupfile (Transact-SQL)backupfile (Transact-SQL)

適用於: 是SQL Server (從 2008 開始) 否Azure SQL Database 否Azure SQL 資料倉儲 否平行處理資料倉儲 APPLIES TO: yesSQL Server (starting with 2008) noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

針對資料庫的每個資料或記錄檔,各包含一個資料列。Contains one row for each data or log file of a database. 這些資料行用來描述取得備份時的檔案組態。The columns describes the file configuration at the time the backup was taken. 是否包含在備份的檔案由is_present資料行。Whether or not the file is included in the backup is determined by the is_present column. 這份資料表儲存在msdb資料庫。This table is stored in the msdb database.

資料行名稱Column name 資料類型Data type 描述Description
backup_set_idbackup_set_id intint 備份組所在檔案的唯一識別碼。Unique identification number of the file containing the backup set. 參考backupset (backup_set_id)References backupset(backup_set_id).
first_family_numberfirst_family_number tinyinttinyint 這個備份檔所在的第一個媒體的家族號碼。Family number of the first media containing this backup file. 可以是 NULL。Can be NULL.
first_media_numberfirst_media_number smallintsmallint 這個備份檔所在的第一個媒體的媒體號碼。Media number of the first media containing this backup file. 可以是 NULL。Can be NULL.
filegroup_namefilegroup_name nvarchar(128)nvarchar(128) 備份的資料庫檔所在之檔案群組的名稱。Name of the filegroup containing a backed up database file. 可以是 NULL。Can be NULL.
page_sizepage_size intint 頁面的大小 (以位元組為單位)。Size of the page, in bytes.
file_numberfile_number numeric(10,0)numeric(10,0) 在資料庫內的唯一檔案識別碼 (對應至sys.database_filesfile_id)。File identification number unique within a database (corresponds to sys.database_files.file_id).
backed_up_page_countbacked_up_page_count numeric(10,0)numeric(10,0) 備份的頁數。Number of pages backed up. 可以是 NULL。Can be NULL.
file_typefile_type char(1)char(1) 這是備份的檔案,它有下列幾種:File backed up, one of:

D = SQL ServerSQL Server 資料檔。D = SQL ServerSQL Server data file.

L = SQL ServerSQL Server 記錄檔。L = SQL ServerSQL Server log file.

F = 全文檢索目錄。F = Full text catalog.

可以是 NULL。Can be NULL.
source_file_block_sizesource_file_block_size numeric(10,0)numeric(10,0) 備份資料或記錄檔時,原始資料或記錄檔所在的裝置。Device that the original data or log file resided on when it was backed up. 可以是 NULL。Can be NULL.
file_sizefile_size numeric(20,0)numeric(20,0) 備份檔案的長度 (以位元組為單位)。Length of the file that is backed up, in bytes. 可以是 NULL。Can be NULL.
logical_namelogical_name nvarchar(128)nvarchar(128) 備份檔案的邏輯名稱。Logical name of the file that is backed up. 可以是 NULL。Can be NULL.
physical_drivephysical_drive nvarchar(260)nvarchar(260) 實體磁碟機或分割區名稱。Physical drive or partition name. 可以是 NULL。Can be NULL.
physical_namephysical_name nvarchar(260)nvarchar(260) 實體 (作業系統) 檔案名稱的其餘部份。Remainder of the physical (operating system) file name. 可以是 NULL。Can be NULL.
statestate tinyinttinyint 這是檔案的狀態,它有下列幾種:State of the file, one of:

0 = ONLINE0 = ONLINE

1 = RESTORING1 = RESTORING

2 = RECOVERING2 = RECOVERING

3 = RECOVERY PENDING3 = RECOVERY PENDING

4 = SUSPECT4 = SUSPECT

6 = OFFLINE6 = OFFLINE

7 = DEFUNCT7 = DEFUNCT

8 = 卸除8 = DROPPED

注意:因此,這些值對應至資料庫狀態的值,則會略過的值是 5。Note: The value 5 is skipped so that these values correspond to the values for database states.
state_descstate_desc nvarchar(64)nvarchar(64) 這是檔案狀態的描述,它有下列幾種:Description of the file state, one of:

ONLINE RESTORINGONLINE RESTORING

RECOVERINGRECOVERING

RECOVERY_PENDINGRECOVERY_PENDING

SUSPECT OFFLINE DEFUNCTSUSPECT OFFLINE DEFUNCT
create_lsncreate_lsn numeric(25,0)numeric(25,0) 建立檔案的記錄序號。Log sequence number at which the file was created.
drop_lsndrop_lsn numeric(25,0)numeric(25,0) 卸除檔案的記錄序號。Log sequence number at which the file was dropped. 可以是 NULL。Can be NULL.

如果檔案尚未卸除,這個值就是 NULL。If the file has not been dropped, this value is NULL.
file_guidfile_guid uniqueidentifieruniqueidentifier 檔案的唯一識別碼。Unique identifier of the file.
read_only_lsnread_only_lsn numeric(25,0)numeric(25,0) 包含從讀寫改成唯讀 (最近的變更) 的檔案之檔案群組所在的記錄序號。Log sequence number at which the filegroup containing the file changed from read-write to read-only (the most recent change). 可以是 NULL。Can be NULL.
read_write_lsnread_write_lsn numeric(25,0)numeric(25,0) 包含從唯讀改成讀寫 (最近的變更) 的檔案之檔案群組所在的記錄序號。Log sequence number at which the filegroup containing the file changed from read-only to read-write (the most recent change). 可以是 NULL。Can be NULL.
differential_base_lsndifferential_base_lsn numeric(25,0)numeric(25,0) 差異備份的基底 LSN。Base LSN for differential backups. 差異備份包含僅記錄序號的資料範圍的數字等於或大於differential_base_lsnA differential backup includes only data extents having a log sequence number equal to or greater than differential_base_lsn.

如果是其他備份類型,這個值就是 NULL。For other backup types, the value is NULL.
differential_base_guiddifferential_base_guid uniqueidentifieruniqueidentifier 如果是差異備份,便是形成檔案差異基底之最近資料備份的唯一識別碼;如果是 NULL 值,就表示檔案已併入差異備份中,但它是在建立基底之後才加入。For a differential backup, the unique identifier of the most recent data backup that forms the differential base of the file; if the value is NULL, the file was included in the differential backup, but was added after the base was created.

如果是其他備份類型,這個值就是 NULL。For other backup types, the value is NULL.
backup_sizebackup_size numeric(20,0)numeric(20,0) 這個檔案的備份大小 (以位元組為單位)。Size of the backup for this file in bytes.
filegroup_guidfilegroup_guid uniqueidentifieruniqueidentifier 檔案群組的識別碼。ID of the filegroup. 若要在 backupfilegroup 資料表中尋找的檔案群組資訊,請使用filegroup_guid具有backup_set_idTo locate filegroup information in the backupfilegroup table, use filegroup_guid with backup_set_id.
is_readonlyis_readonly bitbit 1 = 檔案唯讀。1 = File is read-only.
is_presentis_present bitbit 1 = 檔案包含在備份組中。1 = File is contained in the backup set.

備註Remarks

RESTORE VERIFYONLY FROM backup_device WITH LOADHISTORY 會的資料行backupmediaset媒體集標頭的適當值的資料表。RESTORE VERIFYONLY FROM backup_device WITH LOADHISTORY populates the columns of the backupmediaset table with the appropriate values from the media-set header.

若要減少此資料表和其他備份和記錄資料表中的資料列數目,請執行sp_delete_backuphistory預存程序。To reduce the number of rows in this table and in other backup and history tables, execute the sp_delete_backuphistory stored procedure.

另請參閱See Also

備份與還原資料表(Transact SQL) Backup and Restore Tables (Transact-SQL)
backupfilegroup (Transact-SQL) backupfilegroup (Transact-SQL)
backupmediafamily (Transact-SQL) backupmediafamily (Transact-SQL)
backupmediaset (Transact-SQL) backupmediaset (Transact-SQL)
backupset (Transact-SQL) backupset (Transact-SQL)
系統資料表 (Transact-SQL)System Tables (Transact-SQL)