1. Script backup
2. Recovery models
3. Backup type(Full,differential, transactional)
4. Transactional logs
5. Point in time restore
6. Transactional log shipping
7. Recovery of deleted data without any backup
2. Why database backup?
Is it possible to recover program?
Is it possible to recover data?
Large size of data.
3. Script Backup
Schema Only Backup
Good if database size is big
Data Only Backup
Good if database size is less
Schema and Data Backup
Useful in data migration
Auto schedule script backup
4. Transaction Log
Sql server keeps logs of every DML, DDL etc statements.
SELECT * FROM sys.fn_dblog(NULL,NULL)
If you do not back up the log frequently enough, the
transactional log can expand until it runs out of disk
space.
Recovery model control the transactional log backup.
5. How to create database backup
During the backup process sql server remains online.
Task which are not allowed:
Alter database with either the ADD FILE or REMOVE FILE option
Shrink database
Creation or deletion of database file.
Backup of File and File group
6. Recovery Models
Simple
Database Backup:Yes
Transactional Log Backup: No
Point InTime Restore: No
Full
Data Backup:Yes
Transactional Log Backup:Yes
Point InTime Restore:Yes
Bulk Logged
Data Backup:Yes
Transactional Log Backup:Yes
Point InTime Restore: No
7. Schedule database backup
Transaction Log Shipping
Create copy only backup
Maintenance Plan
By Sql Scrip And Agent Job
BACKUP DATABASE AdventureWorks2008
TO DISK = 'Z:SQLServerBackupsAdventureWorks2008.Bak‘
10. Backup Types
Full Backup
Backs up the whole database.
As a database increases in size full it take more time to finish.
Differential Backup
First backup must be a full backup.
It captures only the data that has changed since that full backup.
Transactional Log Backup
Not possible in simple recovery model.
11. Restore Database
Restore database backup
Backup of recent version will not be restored in earlier version.
Backup of older version can be restored in recent version.
The whole database is offline for the duration of the restore
Recovery Mode:
WITH RECOVERY
WITH NORECOVERY
WITH STANDBY
Restore data file