Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@StopAt doesn't work when also specifying @OnlyLogsAfter #2898

Closed
gdoddsy opened this issue May 14, 2021 · 0 comments · Fixed by #2899
Closed

@StopAt doesn't work when also specifying @OnlyLogsAfter #2898

gdoddsy opened this issue May 14, 2021 · 0 comments · Fixed by #2899

Comments

@gdoddsy
Copy link
Contributor

gdoddsy commented May 14, 2021

Version of the script
@Version = '8.03', @VersionDate = '20210420';

What is the current behavior?
When specifying both the @StoPAt and the @OnlyLogsAfter parameters, the @StoPAt doesn't work. We want to use both as we keep 90 days of log backups and don't want to have to check each one to see if it needs to be restored.

If the current behavior is a bug, please provide the steps to reproduce.

EXEC sp_DatabaseRestore @Database = N'StackOverflow'																	-- nvarchar(128)
						,@RestoreDatabaseName = N'Redebiz_20210502'																	-- nvarchar(128)
						,@BackupPathFull = N'c:\backups\FULL\'
						,@BackupPathDiff = N'c:\backups\DIFF\'
						,@BackupPathLog = N'c:\backups\Log\'
						,@RunCheckDB = 0		
						,@RestoreDiff = 1		
						,@RunRecovery = 1	
						,@StopAt = N'20210502061500'
						,@OnlyLogsAfter = N'20210501181415'
						,@DatabaseOwner = 'sa'
						,@Execute='N'
						,@Debug=1

Note that it checks every single log file, not just those between 1st May 2021 6:15pm and 2nd May 2021 6:15am

What is the expected behavior?
That only the logs I want are checked

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
SQL 2019. It broke when #2180 was merged in and the cursor was removed

I'll have a pull request shortly to deal with this. I think I can simplify the bit of code that is breaking as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant