Skip to content

Commit c92affb

Browse files
Backup-DbaDatabase - Skip backup for inaccessible databases (#10065)
1 parent ed12f76 commit c92affb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

public/Backup-DbaDatabase.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ function Backup-DbaDatabase {
534534
Stop-Function -Message "Backing up tempdb not supported" -Continue
535535
}
536536

537+
if (-not $db.IsAccessible) {
538+
Write-Progress -Id $topProgressId -Activity 'Backup' -Completed
539+
Stop-Function -Message "Database $dbName is not accessible. Cannot perform backup." -Continue -Target $db
540+
}
541+
537542
if ('Normal' -notin ($db.Status -split ',')) {
538543
Write-Progress -Id $topProgressId -Activity 'Backup' -Completed
539544
Stop-Function -Message "Database status not Normal. $dbName skipped." -Continue

0 commit comments

Comments
 (0)