----------Full Backup----------
--Full backup--
Backup Database Studb
To disk= ' E:\stu.bak '
--Log backup--
Backup LOG Studb
To disk= ' E:\stu_log.bak '
Use master
Go
--Restore the full backup first--
Restore Database Studb
From disk= ' E:\stu.bak '
With Replace,norecovery
--Re-restore log backup--
Restore Log Studb
From disk= ' E:\stu_log.bak '
With replace
---------Differential Backup----------
--Full backup--
Backup Database Studb
To disk= ' E:\stu.bak '
--Differential backup--
Backup Database Studb
To disk= ' E:\stu_diff.bak '
With differential
Use master
Go
--Restore the full backup first--
Restore Database Studb
From disk= ' E:\stu.bak '
With Replace,norecovery
--Re-restore differential backup--
Restore Database Studb
From disk= ' E:\stu_diff.bak '
With replace
Note:
--replace Overwrite existing database
--recovery database is in a healthy state after restoring the database
--norecovery the database is in an unhealthy state after restoring the database, wait for the next restore
Backup and restore of SQL Server logs