Backup and Restore pt 3

 

use master

-- Do a backup of the tail of the log

backup log ReportBuilderTraining 
	TO DISK='c:\backups\ReportBuilderTraining_tail.dif'
	WITH NORECOVERY

go


-- restore last full backup, avoid recovery

restore database ReportBuilderTraining 
	FROM DISK='c:\backups\ReportBuilderTraining.dat'
	WITH NORECOVERY

go


-- restore last partial backup, avoid recovery

restore database ReportBuilderTraining 
	FROM DISK='c:\backups\ReportBuilderTraining.dif'
	WITH NORECOVERY

go


-- restore log files in order, avoid recovery

restore log ReportBuilderTraining 
	FROM DISK='c:\backups\ReportBuilderTraining.trn'
	WITH NORECOVERY

go


-- restore tail

restore log ReportBuilderTraining 
	FROM DISK='c:\backups\ReportBuilderTraining_tail.trn'
	WITH NORECOVERY

go


-- recover

restore database ReportBuilderTraining 
	WITH RECOVERY

go