SQL Server backups in brief
----- Full Backup ----
Full Backup can be taken in all the recovery modes simple,bulk logged, full. .
Full Backup will not truncate the log.
Full Back up is essential for all restorations.
Full Backup is not enough for point-in-restoration.
Log backup is required.
For database restore, if there are differential/log backups , restore of fullbackup should be done with NORECOVERY.
---------Differential Backup --------
Differential Backup can be taken in all the recovery modes simple,bulk logged, full. . Differential Backup will have data after the last full backup and are cumulative.
ie If a full back up is taken at 2 AM.
differnetial back up taken at 3 AM -- This will have changed data between 2 AM to 3AM. differnetial back up taken at 4 AM -- This will have changed between 2 AM to 4 AM. . Differential Backup will not truncate the log.
For database restore, if there are log backups ,
restore of differential backup should be done with NORECOVERY.
--------Log Backup -----------
Log Backup can be taken if the database recovery modes are bulk logged or full. .
Log backup will truncate the log after backup log command . (See exceptions in BOL) . Log backup will not truncate when no_truncate, copy_only.
When replication is enabled on the database,it will truncate the log after inactive portion is replicated.
Truncating the log means providing the avialable space for reuse.
This will not reduce the size of log file. .
To reduce the log size DBCC SHRINKFILE should be used
Avoid shrinking log file which may create performance problems and fragmentation. .
Log backups are essential for point-in-time recovery .
In case of database corruption, try to take the current log backup to recover.
If this is possible , this log file will become the last log file for recovery.
For restore of database , restore full backup, subsequent differential backup and all the logs WITH NORECOVERY except the last log backup .
Last log back up should be restored WITH RECOVERY
-------Other Information --------------
It may be necessary to issue CHECKPOINT before any of the backups taken. CHECKPOINT is esential for log truncation .
set recovery interval option with sp_configure indirectly sets CHECKPOINT interval .
If log backup sequence of files are used for restoration with last full backup ,
log backup can be taken just before fullbackup and this can be discarded .
This will truncate the logfile. . shrinking file will not invalidate log sequence restoration. . Keep higher log and data file size and avoid autogrow as much as possible.
Check dbcc opentran . Long running transactions will fill the log file.
Fullbackup with differential backup can be used in simple recovery mode.
But this is not point-in-time recovery.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment