Skip to content

Remove-DbaDbLogShipping - Fix handling of incomplete log shipping configurations#10123

Merged
potatoqualitee merged 1 commit intodevelopmentfrom
claude/issue-10122-20260128-2117
Jan 30, 2026
Merged

Remove-DbaDbLogShipping - Fix handling of incomplete log shipping configurations#10123
potatoqualitee merged 1 commit intodevelopmentfrom
claude/issue-10122-20260128-2117

Conversation

@potatoqualitee
Copy link
Member

Summary

Fixes #10122

This PR fixes Remove-DbaDbLogShipping to properly handle incomplete log shipping configurations where the secondary database setup is missing. This can occur when log shipping setup fails partway through (e.g., Azure Managed Instance which doesn't support log shipping).

Changes

  • Changed INNER JOIN to LEFT JOIN in log shipping info query
  • Added logic to detect and handle primary-only configurations
  • Wrapped secondary-related operations in conditional blocks
  • Added test coverage for incomplete configuration scenario

Test Plan

Added integration test that:

  1. Simulates incomplete setup by inserting only primary records
  2. Verifies successful removal without errors
  3. Confirms complete cleanup

(do Remove-DbaDbLogShipping)

🤖 Generated with Claude Code

…figurations

Fixes #10122

Changes:
- Changed INNER JOIN to LEFT JOIN in log shipping info query to detect incomplete configurations
- Added logic to handle primary-only configurations (no secondary setup)
- Wrapped all secondary-related operations in conditional blocks based on $hasSecondary variable
- Added verbose message when only primary configuration exists
- Added test coverage for incomplete log shipping scenario

This resolves the issue where Remove-DbaDbLogShipping failed with "Could not retrieve log shipping information" when the secondary configuration was missing (e.g., Azure Managed Instance partial setup).

(do Remove-DbaDbLogShipping)

Co-authored-by: Chrissy LeMaire <[email protected]>
@potatoqualitee potatoqualitee merged commit 6260f82 into development Jan 30, 2026
15 checks passed
@potatoqualitee potatoqualitee deleted the claude/issue-10122-20260128-2117 branch January 30, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove-DbaDbLogShipping can't handle a teardown of a missing/wrong secondary

1 participant