Click here to load reader
Upload
riteshkiit
View
119
Download
5
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
Backup And Restore
Sql Server
Why database backup?
Is it possible to recover program?
Is it possible to recover data?
Large size of data.
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
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.
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
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
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‘
Point In Time Backup (Simple Recovery Model)
Point In Time Backup(Full Recovery Model)
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.
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
Restore to Point of Failure
How to recover deleted data
Without Any Backup?
Thank You