Scroll Bar


you can participate with latest Interview Questions here. Use this mail ID (bhanudba15@gmail.com) to send Your Questions.

SQL Server FULL backup internal workflow?

SQL Server FULL backup internal workflow?

The internal workflow of a full backup in SQL Server involves several steps that ensure a consistent and reliable backup of the database. Here's an overview of the internal workflow of a full backup in SQL Server:

1.    Initialization:

·   When you initiate a full backup operation (either manually or through a scheduled backup plan), SQL Server initializes the backup process.

·  The backup process begins by acquiring necessary locks to ensure data consistency during the backup operation. It uses various locking mechanisms to prevent data modifications that could affect the backup's integrity.

2.    Checkpoint:

·  Before the backup starts, SQL Server performs a checkpoint. A checkpoint ensures that all modified (dirty) pages in the buffer cache are flushed to disk, and the transaction log is updated with the latest checkpoint information.

·     This step ensures that the backup captures a consistent snapshot of the database.

3.    Backup Buffer Creation:

·  SQL Server allocates memory buffers known as backup buffers to hold data pages during the backup process.

·   These backup buffers are used to read data from database files (data and log files) and write it to the backup media (disk, tape, etc.).

4.    Reading Data Pages:

·   The backup process reads data pages from the database files (MDF and NDF files for data, LDF files for logs) into the backup buffers.

· It uses read-ahead mechanisms and I/O operations to efficiently read data pages from disk into memory.

5.    Writing Backup Sets:

·   As data pages are read into backup buffers, SQL Server writes them to the backup media in the form of backup sets.

·   Backup sets are logical units of data that contain the database's contents at the point in time when the backup operation started.

6.    Backup Compression (Optional):

·    If backup compression is enabled, SQL Server compresses the backup data before writing it to the backup media.

·    Backup compression reduces the size of the backup file, resulting in reduced storage requirements and faster backup and restore operations.

7.    Transaction Log Handling:

·    In a full backup, SQL Server includes a copy of the transaction log records up to the point in time when the backup operation started.

·   This ensures that the backup is consistent and can be used for point-in-time recovery or to restore the database to a specific moment.

8.    Backup Completion and Verification:

·    Once all data pages and transaction log records are backed up, SQL Server completes the backup operation.

·     It performs verification checks to ensure the backup file's integrity, including checksum validation and metadata verification.

9.    Backup File Creation:

·   SQL Server creates a backup file on the specified backup media (disk, tape, network share, etc.) containing the backup sets and associated metadata.

·   The backup file is stored in a format compatible with SQL Server's restore operations, allowing it to be used for database recovery.

10.Backup Logging and Monitoring:

    ·    Throughout the backup process, SQL Server logs information about the backup operation in system tables, backup history, and the SQL Server error log.

·    Backup logs contain details such as backup start and end time, backup size, backup type (full), and any errors encountered during the backup.

11.Logging and Error Handling:

·    Throughout the backup process, SQL Server logs detailed information about the backup operation, including progress, errors, warnings, and completion status.

·   Error handling mechanisms ensure that any issues encountered during the backup process are logged and reported for troubleshooting and resolution.

12.Cleanup and Release:

·  After the backup is successfully completed and verified, SQL Server releases memory buffers, locks, and resources used during the backup operation.

·  It updates backup history and metadata in system tables to reflect the backup's completion and status.

Overall, the internal workflow of a full backup in SQL Server involves initializing the backup process, reading data pages into backup buffers, writing backup sets to the backup media, handling transaction logs, performing verification checks, creating backup files, logging progress and errors, and releasing resources after completion. This workflow ensures a consistent and reliable backup of the database for recovery purposes.

 


No comments:

Post a Comment

DisableRC