-- 1
Use master
Backup database logTest
To disk = 'd: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Backup \ logTest. bak'
With format
-- 2
Use logTest
Create table table_1 (Id int, test varchar (max ))
Insert table_1 (Id, test) values (1, '20140901 ');
Insert table_1 (Id, test) values (2, '201312 ');
Insert table_1 (Id, test) values (3, '201312 ');
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 Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Backup \ logTest_log.bak'
With format
-- 4
-- DECLARE @ dt datetime
-- SELECT @ dt = DATEADD (MS,-1800, GETDATE ())
-- Select @ dt
Restore database logtest
From disk = 'd: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Backup \ logTest. bak'
WITH REPLACE
Restore log logTest
From disk = 'd: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Backup \ logTest_log.bak'
With STOPAT = '2017-10-26 12:38:57. 123'
GO