Skip to content

Commit

Permalink
Restore-DbaDatabase - improve warning output for standby mode databas…
Browse files Browse the repository at this point in the history
…es (#9230)

Co-authored-by: Shawn Melton <[email protected]>
  • Loading branch information
0x7FFFFFFFFFFFFFFF and wsmelton authored Mar 7, 2024
1 parent d50b812 commit da391a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions public/Restore-DbaDatabase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,9 @@ function Restore-DbaDatabase {
Write-Message -Message "$Database does not exist on $RestoreInstance" -level Warning
continue
}
if ($RestoreInstance.Databases[$Database].Status -ne "Restoring") {
Write-Message -Message "$Database on $RestoreInstance is not in a Restoring State" -Level Warning

if (@("Restoring", "Normal, Standby") -notcontains $RestoreInstance.Databases[$Database].Status) {
Write-Message -Message "$Database on $RestoreInstance state [$($RestoreInstance.Databases[$Database].Status)] is not a valid state. Valid state is Restoring or Standby" -Level Warning
continue
}
$RestoreComplete = $true
Expand Down Expand Up @@ -807,7 +808,6 @@ function Restore-DbaDatabase {
} catch {
Stop-Function -Message "Failure" -ErrorRecord $_ -Continue -Target $RestoreInstance
}

if ($PSCmdlet.ParameterSetName -eq "RestorePage") {
if ($RestoreInstance.Edition -like '*Enterprise*') {
Write-Message -Message "Taking Tail log backup for page restore for Enterprise" -Level Verbose
Expand Down

0 comments on commit da391a9

Please sign in to comment.