說明 所有的示例均假定已執行了完整數據庫備份
A
說明 MyNwind 數據庫僅供舉例說明
下例顯示還原完整數據庫備份
RESTORE DATABASE MyNwind
FROM MyNwind_
B
下例還原完整數據庫備份後還原差異備份
RESTORE DATABASE MyNwind
FROM MyNwind_
WITH NORECOVERY
RESTORE DATABASE MyNwind
FROM MyNwind_
WITH FILE =
C
下例使用 RESTART 選項重新啟動因服務器電源故障而中斷的 RESTORE 操作
RESTORE DATABASE MyNwind
FROM MyNwind_
RESTORE DATABASE MyNwind
FROM MyNwind_
D
下例還原完整數據庫和事務日志
RESTORE DATABASE MyNwind
FROM MyNwind_
WITH NORECOVERY
MOVE
MOVE
RESTORE LOG MyNwind
FROM MyNwindLog
WITH RECOVERY
E
下例顯示使用 BACKUP 和 RESTORE 語句創建 Northwind 數據庫的復本
BACKUP DATABASE Northwind
TO DISK =
RESTORE FILELISTONLY
FROM DISK =
RESTORE DATABASE TestDB
FROM DISK =
WITH MOVE
MOVE
GO
F
下例將數據庫還原到其在
RESTORE DATABASE MyNwind
FROM MyNwind_
WITH NORECOVERY
RESTORE LOG MyNwind
FROM MyNwindLog
WITH NORECOVERY
RESTORE LOG MyNwind
FROM MyNwindLog
WITH RECOVERY
G
下例顯示從 TAPE 備份設備還原完整數據庫備份
RESTORE DATABASE MyNwind
FROM TAPE =
H
下例還原一個包含兩個文件
RESTORE DATABASE MyNwind
FILE =
FILE =
FILEGROUP =
FROM MyNwind_
WITH NORECOVERY
RESTORE LOG MyNwind
FROM MyNwindLog
I
下例顯示將事務日志還原到名為
BEGIN TRANSACTION RoyaltyUpdate
WITH MARK
GO
USE pubs
GO
UPDATE roysched
SET royalty = royalty *
WHERE title_id LIKE
GO
COMMIT TRANSACTION RoyaltyUpdate
GO
USE master
GO
RESTORE DATABASE pubs
FROM Pubs
WITH FILE =
GO
RESTORE LOG pubs
FROM Pubs
WITH FILE =
STOPATMARK =
From:http://tw.wingwit.com/Article/os/xtgl/201311/8885.html