--1usemasterbackupdatabaselogTesttodisk='D:ProgramFilesMicrosoftSQLServerMSSQL10.MSSQLSERVERMSSQLBackuplogTest
--1
use master
backup database logTest
to disk='D:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLBackuplogTest.bak'
with format
--2
use logTest
create table table_1(Id int, test varchar(max))
insert table_1(Id,test) values (1,'3333');
insert table_1(Id,test) values (2,'4333');
insert table_1(Id,test) values (3,'5333');
use master
--2.1
WAITFOR DELAY '00:00:05'
GO
use logTest
truncate table table_1
select GETDATE()
use master
--3
use master
backup log logTest
to disk='D:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLBackuplogTest_log.bak'
with format
--4
--DECLARE @dt datetime
--SELECT @dt=DATEADD(ms,-1800,GETDATE())
--select @dt
restore database logtest
from disk = 'D:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLBackuplogTest.bak'
WITH REPLACE
RESTORE LOG logTest
FROM DISK='D:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLBackuplogTest_log.bak'
with STOPAT= '2009-10-26 12:38:57.133'
GO
标签: sqlserver 日志 恢复 方法 搞定 drop truncate
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!