Class DatabasesAndFilesSchema.MasterFile
- Namespace
- LinqToDB.Tools.DataProvider.SqlServer.Schemas
- Assembly
- linq2db.Tools.dll
sys.master_files (Transact-SQL)
Applies to: √ SQL Server (all supported versions) √ Azure SQL Managed Instance √ Analytics Platform System (PDW)
Contains a row per file of a database as stored in the master database. This is a single, system-wide view.
See sys.master_files.
[Table(Schema = "sys", Name = "master_files", IsView = true)]
public class DatabasesAndFilesSchema.MasterFile
- Inheritance
-
DatabasesAndFilesSchema.MasterFile
- Extension Methods
Properties
BackupLsn
The LSN of the most recent data or differential backup of the file.
[Column("backup_lsn")]
[Nullable]
public decimal? BackupLsn { get; set; }
Property Value
CreateLsn
Log sequence number (LSN) at which the file was created.
[Column("create_lsn")]
[Nullable]
public decimal? CreateLsn { get; set; }
Property Value
CredentialID
The credential_id
from sys.credentials
used for storing the file. For example, when SQL Server is running on an Azure Virtual Machine and the database files are stored in Azure blob storage, a credential is configured with the access credentials to the storage location.
[Column("credential_id")]
[Nullable]
public int? CredentialID { get; set; }
Property Value
- int?
DataSpaceID
ID of the data space to which this file belongs. Data space is a filegroup.
0 = Log files
[Column("data_space_id")]
[NotNull]
public int DataSpaceID { get; set; }
Property Value
DatabaseID
ID of the database to which this file applies. The masterdatabase_id is always 1.
[Column("database_id")]
[NotNull]
public int DatabaseID { get; set; }
Property Value
DifferentialBaseGuid
Unique identifier of the base backup on which a differential backup will be based.
[Column("differential_base_guid")]
[Nullable]
public Guid? DifferentialBaseGuid { get; set; }
Property Value
- Guid?
DifferentialBaseLsn
Base for differential backups. Data extents changed after this LSN will be included in a differential backup.
[Column("differential_base_lsn")]
[Nullable]
public decimal? DifferentialBaseLsn { get; set; }
Property Value
DifferentialBaseTime
Time corresponding to differential_base_lsn.
[Column("differential_base_time")]
[Nullable]
public DateTime? DifferentialBaseTime { get; set; }
Property Value
DropLsn
LSN at which the file was dropped.
[Column("drop_lsn")]
[Nullable]
public decimal? DropLsn { get; set; }
Property Value
FileGuid
Unique identifier of the file.
NULL = Database was upgraded from an earlier version of SQL Server (Valid for SQL Server 2005 and earlier) .
[Column("file_guid")]
[Nullable]
public Guid? FileGuid { get; set; }
Property Value
- Guid?
FileID
ID of the file within database. The primary file_id is always 1.
[Column("file_id")]
[NotNull]
public int FileID { get; set; }
Property Value
Growth
0 = File is fixed size and will not grow.
>0 = File will grow automatically.
If is_percent_growth = 0, growth increment is in units of 8-KB pages, rounded to the nearest 64 KB
If is_percent_growth = 1, growth increment is expressed as a whole number percentage.
[Column("growth")]
[NotNull]
public int Growth { get; set; }
Property Value
IsMediaReadOnly
1 = File is on read-only media.
0 = File is on read/write media.
[Column("is_media_read_only")]
[NotNull]
public bool IsMediaReadOnly { get; set; }
Property Value
IsNameReserved
1 = Dropped file name is reusable. A log backup must be taken before the name (name or physical_name) can be reused for a new file name.
0 = File name is unavailable for reuse.
[Column("is_name_reserved")]
[NotNull]
public bool IsNameReserved { get; set; }
Property Value
IsPercentGrowth
1 = Growth of the file is a percentage.
0 = Absolute growth size in pages.
[Column("is_percent_growth")]
[NotNull]
public bool IsPercentGrowth { get; set; }
Property Value
IsReadOnly
1 = File is marked read-only.
0 = file is marked read/write.
[Column("is_read_only")]
[NotNull]
public bool IsReadOnly { get; set; }
Property Value
IsSparse
1 = File is a sparse file.
0 = File is not a sparse file.
For more information, see View the Size of the Sparse File of a Database Snapshot (Transact-SQL).
[Column("is_sparse")]
[NotNull]
public bool IsSparse { get; set; }
Property Value
MaxSize
Maximum file size, in 8-KB pages:
0 = No growth is allowed.
-1 = File will grow until the disk is full.
268435456 = Log file will grow to a maximum size of 2 TB.
Note: Databases that are upgraded with an unlimited log file size will report -1 for the maximum size of the log file.
[Column("max_size")]
[NotNull]
public int MaxSize { get; set; }
Property Value
Name
Logical name of the file in the database.
[Column("name")]
[NotNull]
public string Name { get; set; }
Property Value
PhysicalName
Operating-system file name.
[Column("physical_name")]
[NotNull]
public string PhysicalName { get; set; }
Property Value
ReadOnlyLsn
LSN at which the filegroup that contains the file changed from read/write to read-only (most recent change).
[Column("read_only_lsn")]
[Nullable]
public decimal? ReadOnlyLsn { get; set; }
Property Value
ReadWriteLsn
LSN at which the filegroup that contains the file changed from read-only to read/write (most recent change).
[Column("read_write_lsn")]
[Nullable]
public decimal? ReadWriteLsn { get; set; }
Property Value
RedoStartForkGuid
Unique identifier of the recovery fork. The first_fork_guid of the next log backup restored must match this value. This represents the current state of the container.
[Column("redo_start_fork_guid")]
[Nullable]
public Guid? RedoStartForkGuid { get; set; }
Property Value
- Guid?
RedoStartLsn
LSN at which the next roll forward must start.
Is NULL unless state = RESTORING or state = RECOVERY_PENDING.
[Column("redo_start_lsn")]
[Nullable]
public decimal? RedoStartLsn { get; set; }
Property Value
RedoTargetForkGuid
The recovery fork on which the container can be recovered. Paired with redo_target_lsn.
[Column("redo_target_fork_guid")]
[Nullable]
public Guid? RedoTargetForkGuid { get; set; }
Property Value
- Guid?
RedoTargetLsn
LSN at which the online roll forward on this file can stop.
Is NULL unless state = RESTORING or state = RECOVERY_PENDING.
[Column("redo_target_lsn")]
[Nullable]
public decimal? RedoTargetLsn { get; set; }
Property Value
Size
Current file size, in 8-KB pages. For a database snapshot, size reflects the maximum space that the snapshot can ever use for the file.
Note: This field is populated as zero for FILESTREAM containers. Query the sys.database_files catalog view for the actual size of FILESTREAM containers.
[Column("size")]
[NotNull]
public int Size { get; set; }
Property Value
State
File state:
0 = ONLINE
1 = RESTORING
2 = RECOVERING
3 = RECOVERY_PENDING
4 = SUSPECT
5 = Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.
6 = OFFLINE
7 = DEFUNCT
[Column("state")]
[Nullable]
public byte? State { get; set; }
Property Value
- byte?
StateDesc
Description of the file state:
ONLINE
RESTORING
RECOVERING
RECOVERY_PENDING
SUSPECT
OFFLINE
DEFUNCT
For more information, see File States.
[Column("state_desc")]
[Nullable]
public string? StateDesc { get; set; }
Property Value
TypeColumn
File type:
0 = Rows.
1 = Log
2 = FILESTREAM
3 = Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.
4 = Full-text (Full-text catalogs earlier than SQL Server 2008; full-text catalogs that are upgraded to or created in SQL Server 2008 or higher will report a file type 0.)
[Column("type")]
[NotNull]
public byte TypeColumn { get; set; }
Property Value
TypeDesc
Description of the file type:
ROWS
LOG
FILESTREAM
FULLTEXT (Full-text catalogs earlier than SQL Server 2008.)
[Column("type_desc")]
[Nullable]
public string? TypeDesc { get; set; }