You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated the sp names for issue #851
Added @debug variable. Debug level 0 is the default state of the
script, which will execute the commands. Debug level 1 will print just
the commands so you can run at your leisure and Debug level 2 will print
other stuff (level 2 is handy for adding in new variables and
troubleshooting). This addresses issue #850
Fixed the Differential restore. I discovered during testing that I had
failed to check the LSNs against the differential. Fixed that portion
of the code and tested. This is in regards to issue #814
SELECT @FullLastLSN=CAST(LastLSN ASNUMERIC(25, 0)) FROM #Headers WHERE BackupType =1;
259
+
SELECT @DiffLastLSN=CAST(LastLSN ASNUMERIC(25, 0)) FROM #Headers WHERE BackupType =5;
241
260
END;
242
261
243
262
--Clear out table variables for translogs
@@ -263,19 +282,24 @@ BEGIN
263
282
IF @i =1
264
283
BEGIN
265
284
SET @sql =REPLACE(@HeadersSQL, '{Path}', @BackupPathLog + @BackupFile);
266
-
PRINT @sql;
267
-
EXECUTE (@sql);
285
+
IF @Debug =2
286
+
PRINT @sql;
287
+
EXECUTE (@sql);
268
288
269
289
SELECT @LogFirstLSN =CAST(FirstLSN ASNUMERIC(25, 0)), @LogLastLSN =CAST(LastLSN ASNUMERIC(25, 0)) FROM #Headers WHERE BackupType =2;
270
-
IF (@ContinueLogs =0AND @LogFirstLSN <= @FullLastLSN AND @FullLastLSN <= @LogLastLSN) OR (@ContinueLogs =1AND @LogFirstLSN <= @DatabaseLastLSN AND @DatabaseLastLSN < @LogLastLSN)
290
+
291
+
IF (@ContinueLogs =0AND @LogFirstLSN <= @FullLastLSN AND @FullLastLSN <= @LogLastLSN AND @RestoreDiff =0) OR (@ContinueLogs =1AND @LogFirstLSN <= @DatabaseLastLSN AND @DatabaseLastLSN < @LogLastLSN AND @RestoreDiff =0)
292
+
SET @i =2;
293
+
IF (@ContinueLogs =0AND @LogFirstLSN <= @DiffLastLSN AND @DiffLastLSN <= @LogLastLSN AND @RestoreDiff =1) OR (@ContinueLogs =1AND @LogFirstLSN <= @DatabaseLastLSN AND @DatabaseLastLSN < @LogLastLSN AND @RestoreDiff =1)
271
294
SET @i =2;
272
295
DELETEFROM #Headers WHERE BackupType =2;
273
296
END;
274
297
IF @i =2
275
298
BEGIN
276
299
SET @sql ='RESTORE LOG '+@RestoreDatabaseName+' FROM DISK = '''+@BackupPathLog + @BackupFile+''' WITH NORECOVERY'+CHAR(13);
0 commit comments