Recovery Models-SQL
Recovery Models-SQL
Recovery Models-SQL
Recovery model determines what level we will be able to recover our database and recently
entered data in case of system failure.
In order to create the correct backups, we need to set the proper recovery model for each
database.
Basically designed to control the transaction log maintenance.
Transaction Logging - It is the internal mechanism of SQL Server that keeps logging all
transactions and Database modifications that are made by each transaction as a string of log
records in a serial sequence as they are created. This is important to bring the database back to
a consistent state if there is a system failure.
What log files do?
SQL Server Database has atleast a mdf data file and a ldf log file.
Mdf file has all database objects and data such as tables, stored procedures and user
information.
Ldf file has all logs in database.
Note: we never only count on log files to recover our database . For.eg., to recover
database to some time-point through ldf log file and the previous full backup.
Each database can have only one Recovery model but each of our database can have different
Recovery models. The only exception is that TempDB database has to use Simple Recovery
Model.
Types: Full, Simple, Bulk-Logged.
Similar to Full RM except that it handles Bulk Operations(BULK INSERT, INDEX CREATION, SELECT
INTO).
Bulk logged model records these operations in transaction log using a technical known as
Minimal Logging.
ADVANTAGES: permits high-performance bulk copy operations, minimal log space is used by
bulk operations.
DISADVANTAGES : If the log is damaged, Bulk operations occurred since the most recent log
backup must be redone.
TYPES OF BACKUP:
FULL BACKUP :
DIFFERENTIAL BACKUP:
Backups any extent that has changed since last full backup.