笔记4-徐 模仿灾难发生时还原adventurework数据库 示例 stopat

笔记4-徐 模仿灾难发生时还原adventurework数据库 示例 stopat

--模仿灾难发生时还原adventurework数据库 示例 stopat

BACKUP DATABASE AdventureWorks
TO DISK= 'D:\MSSQL\Databackup\AdventureWorks.bak'

BACKUP LOG AdventureWorks
TO DISK ='D:\MSSQL\Databackup\AdventureWorks.trn'
GO
--灾难发生后,试图创建一个尾日志备份
BACKUP LOG AdventureWorks
TO DISK='D:\MSSQL\Databackup\AdventureWorkstail.trn'
WITH norecovery;
GO
--------------------------------------
--用界面的话这两步一起完成
--从备份恢复一个全备份
RESTORE DATABASE AdventureWorks
FROM DISK ='D:\MSSQL\Databackup\AdventureWorks.bak'
WITH FILE=1,NORECOVERY

--从备份中恢复一个正常的日志备份
RESTORE LOG AdventureWorks
FROM DISK ='D:\MSSQL\Databackup\AdventureWorks.trn'
WITH NORECOVERY;

--------------------------------------------------------------

--用stopat 恢复尾日志备份
RESTORE LOG AdventureWorks
FROM DISK='D:\MSSQL\Databackup\AdventureWorkstail.trn'
WITH STOPAT='2012 20:59:00',
RECOVERY;
GO

 


 

 

 

 

 

 

 

 

 

 

f

posted @ 2013-07-27 15:13  桦仔  阅读(846)  评论(0编辑  收藏  举报