diff --git a/CHANGELOG.md b/CHANGELOG.md index a9dfddb72..08d66665c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Changes to SqlAGDatabase + - Added StatementTimeout parameter with value 0 (no timeout) to Connect-SQL invocation in Set-TargetResource function to fix Issue#1743 + This prevents timeout during backup operation on secondary. + ### Removed - The deprecated DSC resource SqlDatabaseOwner have been removed _(and replaced_ diff --git a/source/DSCResources/DSC_SqlAGDatabase/DSC_SqlAGDatabase.psm1 b/source/DSCResources/DSC_SqlAGDatabase/DSC_SqlAGDatabase.psm1 index eb14fbd16..89c43d919 100644 --- a/source/DSCResources/DSC_SqlAGDatabase/DSC_SqlAGDatabase.psm1 +++ b/source/DSCResources/DSC_SqlAGDatabase/DSC_SqlAGDatabase.psm1 @@ -204,7 +204,7 @@ function Set-TargetResource Import-SQLPSModule # Connect to the defined instance - $serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName + $serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName -StatementTimeout 0 # Get the Availability Group $availabilityGroup = $serverObject.AvailabilityGroups[$AvailabilityGroupName] @@ -576,7 +576,6 @@ function Set-TargetResource $restoreLogQueryStringBuilder.AppendLine() | Out-Null $restoreLogQueryStringBuilder.Append('REVERT') | Out-Null } - $restoreLogQueryString = $restoreLogQueryStringBuilder.ToString() }