14

Click here to load reader

Backup and restore

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Backup and restore

Backup And Restore

Sql Server

Page 2: Backup and restore

Why database backup?

Is it possible to recover program?

Is it possible to recover data?

Large size of data.

Page 3: Backup and restore

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

Page 4: Backup and restore

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.

Page 5: Backup and restore

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

Page 6: Backup and restore

Recovery Models Simple

Database Backup: Yes Transactional Log Backup: No Point In Time Restore: No

Full Data Backup: Yes Transactional Log Backup: Yes Point In Time Restore: Yes

Bulk Logged Data Backup: Yes Transactional Log Backup: Yes Point In Time Restore: No

Page 7: Backup and restore

Schedule database backup Transaction Log Shipping

Create copy only backup

Maintenance Plan

By Sql Scrip And Agent Job

BACKUP DATABASE AdventureWorks2008

TO DISK = 'Z:\SQLServerBackups\AdventureWorks2008.Bak‘

Page 8: Backup and restore

Point In Time Backup (Simple Recovery Model)

Page 9: Backup and restore

Point In Time Backup(Full Recovery Model)

Page 10: Backup and restore

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.

Page 11: Backup and restore

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

Page 12: Backup and restore

Restore to Point of Failure

Page 13: Backup and restore

How to recover deleted data

Without Any Backup?

Page 14: Backup and restore

Thank You