3

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.

2 Answers 2

4

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.

6

Don't worry about extents and pages.

A Full backup contains all the data pages. The pages are not written to the backup at a single point-in-time. So a Full also contains the log records needed to redo/undo the changes from the earliest page to latest transaction committed during the backup.

A differential backup omits all pages not changed since the last Full backup.

A log backup contains all log records since the last log backup.

1
  • 1
    ... and full backups do not include un-used pages (which is why a full backup is smaller than the combined size of the data files, even without compression). Commented Mar 12, 2019 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.