Fix DAC connection issues in linked server operations#10106
Fix DAC connection issues in linked server operations#10106potatoqualitee merged 2 commits intodevelopmentfrom
Conversation
- Fix Issue 3 (root cause): Use 127.0.0.1 instead of hostname in Get-DecryptedObject to prevent SQL Client from attempting parallel connections to multiple IPs, which causes 'maximum number of 1 dedicated administrator connections' error - Fix Issue 2: Make Copy-DbaLinkedServer conditionally open DAC only when -ExcludePassword is not specified, avoiding unnecessary DAC usage - Fix Issue 1: Add DAC connection establishment to Export-DbaLinkedServer when passwords are being retrieved (do *LinkedServer*) Fixes #10040 Co-authored-by: Chrissy LeMaire <[email protected]>
andreasjordan
left a comment
There was a problem hiding this comment.
Code looks good to me. I can try to test this, but it might take some days until I find the time.
public/Export-DbaLinkedServer.ps1
Outdated
| } | ||
|
|
||
| # Disconnect DAC connection if it was opened | ||
| if (-not $ExcludePassword -and $server) { |
There was a problem hiding this comment.
We don't need -and $server here because we only reach this line of code if we made a connection.
There was a problem hiding this comment.
(no idea if it works here, lets see)
There was a problem hiding this comment.
Claude finished @potatoqualitee's task in 1m 7s —— View job
Tasks
- Read Export-DbaLinkedServer.ps1 to understand the context
- Remove redundant
-and $servercondition from line 209 - Commit and push the fix
Summary
Fixed the redundant condition on line 209. The -and $server check was unnecessary because the code only reaches that point when a DAC connection was successfully established in line 127. The cleanup code now simply checks if (-not $ExcludePassword) which is sufficient.
Co-authored-by: Chrissy LeMaire <[email protected]>
|
Will try to test that today... |
andreasjordan
left a comment
There was a problem hiding this comment.
I have tested this in my lab and it works as expected.
|
awesome! thank you 🤩 |
Summary
This PR fixes three related issues with DAC (Dedicated Admin Connection) usage in linked server operations that were causing "maximum number of 1 dedicated administrator connections already exists" errors.
Issue #3 - Root Cause (CRITICAL)
Get-DecryptedObject.ps1to use127.0.0.1instead of hostname for local DAC connectionsIssue #2 - Conditional DAC Usage
Copy-DbaLinkedServer.ps1to only open DAC when passwords are being retrieved-ExcludePasswordis specified, uses regular connection insteadIssue #1 - Missing DAC Connection
Export-DbaLinkedServer.ps1when passwords are exportedCopy-DbaLinkedServerTest Plan
Export-DbaLinkedServerwith and without-ExcludePasswordCopy-DbaLinkedServerwith and without-ExcludePasswordFixes #10040
🤖 Generated with Claude Code