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
Restore-DbaDatabase - Add -StopAtLsn parameter for LSN-based restore
Add -StopAtLsn parameter to Restore-DbaDatabase and Invoke-DbaAdvancedRestore
to support restoring to a specific Log Sequence Number using SQL Server's
STOPATMARK = 'lsn:<value>' syntax. Works with -StopBefore to stop just
before the specified LSN.
(do Restore-DbaDatabase)
Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
Copy file name to clipboardExpand all lines: public/Restore-DbaDatabase.ps1
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -235,11 +235,16 @@ function Restore-DbaDatabase {
235
235
Marked point in the transaction log to stop the restore at (Mark is created via BEGIN TRANSACTION (https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15)).
236
236
237
237
.PARAMETERStopBefore
238
-
Switch to indicate the restore should stop before StopMark occurs, default is to stop when mark is created.
238
+
Switch to indicate the restore should stop before StopMark or StopAtLsn occurs, default is to stop when mark/LSN is reached.
239
239
240
240
.PARAMETERStopAfterDate
241
241
By default the restore will stop at the first occurence of StopMark found in the chain, passing a datetime where will cause it to stop the first StopMark atfer that datetime.
242
242
243
+
.PARAMETERStopAtLsn
244
+
Log Sequence Number (LSN) in the transaction log at which to stop the restore operation.
245
+
Use this for precise point-in-time recovery to an exact LSN, which provides more granular control than timestamp-based recovery.
246
+
The LSN value can be obtained from sys.fn_dblog, backup headers, or error logs. Combine with -StopBefore to stop just before the specified LSN.
247
+
243
248
.PARAMETERChecksum
244
249
Enables backup checksum verification during restore operations. Forces the restore to verify backup checksums and fail if checksums are not present.
245
250
Use this to ensure backup files contain checksums and validate them during restore, following backup best practices.
@@ -430,6 +435,16 @@ function Restore-DbaDatabase {
430
435
431
436
Restores the backups from \\ServerName\ShareName\File as database, stops before the first 'OvernightStart' mark that occurs after '21:00 10/05/2020'.
0 commit comments