-- Create a backup device
Use [Master]
Go
Exec master. DBO. sp_addumpdevice @ devtype = n 'disk', @ logicalname = n 'beifen', @ physicalname = n'd: \ beifen. Bak'
Go
-- Complete backup to the backup device
Backup database [Student] to [beifen] With noformat, noinit, name = n' student-full database backup ', Skip, norewind, nounload, stats = 10
Go
-- Restore full backup
Restore database [Student] from [beifen] with file = 1, nounload, replace, stats = 10
Go
-- Differential backup
Backup database [Student] to [beifen] with differential, noformat, noinit, name = n' student-differential Database Backup ', Skip, norewind, nounload, stats = 10
Go
-- Transaction log backup
Backup log [Student] to [beifen] With noformat, noinit, name = n' student-transaction log backup ', Skip, norewind, nounload, stats = 10
Go
-- Restore to the latest status
Restore database [Student] from [beifen] with file = 1, norecovery, nounload, stats = 10
Go
Restore database [Student] from [beifen] with file = 2, norecovery, nounload, stats = 10
Go
Restore log [Student] from [beifen] with file = 3, nounload, stats = 10
Go
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/qq49121294/archive/2009/03/24/4019637.aspx