1 --模仿灾难发生时还原adventurework数据库 示例 stopat 2 3 BACKUP DATABASE AdventureWorks 4 TO DISK= ‘D:\MSSQL\Databackup\AdventureWorks.bak‘ 5 6 BACKUP LOG AdventureWorks 7 TO DISK =‘D:\MSSQL\Databackup\AdventureWorks.trn‘ 8 GO 9 --灾难发生后,试图创建一个尾日志备份 10 BACKUP LOG AdventureWorks 11 TO DISK=‘D:\MSSQL\Databackup\AdventureWorkstail.trn‘ 12 WITH norecovery; 13 GO 14 -------------------------------------- 15 --用界面的话这两步一起完成 16 --从备份恢复一个全备份 17 RESTORE DATABASE AdventureWorks 18 FROM DISK =‘D:\MSSQL\Databackup\AdventureWorks.bak‘ 19 WITH FILE=1,NORECOVERY 20 21 --从备份中恢复一个正常的日志备份 22 RESTORE LOG AdventureWorks 23 FROM DISK =‘D:\MSSQL\Databackup\AdventureWorks.trn‘ 24 WITH NORECOVERY; 25 26 -------------------------------------------------------------- 27 28 --用stopat 恢复尾日志备份 29 RESTORE LOG AdventureWorks 30 FROM DISK=‘D:\MSSQL\Databackup\AdventureWorkstail.trn‘ 31 WITH STOPAT=‘2012 20:59:00‘, 32 RECOVERY; 33 GO
时间: 2024-11-09 00:44:26