的日志备份,最后你可以把数据库恢复上线。
?
?
?1 -- Restore all available log backups in the correct order
?2 RESTORE LOG PageLevelRestores FROM
?3 ? ? DISK = 'C:\Backups\PageLevelRestores_LOG1.bak'
?4 ? ? WITH NORECOVERY
?5 GO
?6?
?7 -- Finally restore the tail log backup
?8 RESTORE LOG PageLevelRestores FROM
?9 ? ? DISK = 'C:\Backups\PageLevelRestores_LOG_TAIL.bak'
10 ? ? WITH NORECOVERY
11 GO
12?
13 -- Finally finish with the restore sequence
14 RESTORE DATABASE PageLevelRestores WITH RECOVERY
15 GO
?
现在当你再次查询表时,你会看到SELECT语句成功执行没有任何I/O错误,在这个表里没有丢失任何数据。还是很简单,是不是?
?
1 USE PageLevelRestores
2 GO
3?
4 -- Retrieve the selected records
5 SELECT * FROM Test
6 GO
?
小结
?
在SQL Server里如何进行页级别恢复操作是每个DBA应该知道的。它是你工具箱里最重要的工具之一——尤其当你在处理很大的
数据库时。不用恢复整个数据库,你只恢复有问题的页,整个恢复过程会非常快。