SQL Server – Database Backup for Data and Log Files

backupsql server

I have been told that for data files backup operate at extent level and for log file, backup operates at page level.

I know that the file type for data file is always "Rows Data" and is stored in the form of extent(Either mixed or uniform extent) whereas logs are stored in the form of Log i.e. VLF(Virtual Log Files).

Can please somebody shed some light on this concept in a bit detailed level as I am a bit puzzled on how backup distinguishes between data and log. If its full backup, it would store all the committed change written to data file, for differential – all changes since last full backup from data file. And for log backup – all changes which is committed however not written to data file.

Appreciate your valuable input on this.

Best Answer

I have been told that for data files backup operate at extent level and for log file, backup operates at page level.

I would say this statement is not completely correct. Both data file and log file backup would operate at page level. For differential backup it scans through differential bitmaps and only backs up the data file extents that are marked as changed after full backup.

I am a bit puzzled on how backup distinguishes between data and log.

It depends on backup command you give. When you give full backup command the SQL Server knows it has to backup whole database and some transaction log to make sure when backup is restored database is consistent. For log it reads portion of transaction log and backups all changes made from last log backup or full backup.