From 48882d3471b32b7488fae3f1acc9910d91061b2b Mon Sep 17 00:00:00 2001 From: Dimo Lenkov Date: Tue, 19 Apr 2022 15:38:13 +0300 Subject: [PATCH] SqlAgDatabase: Fixes Issue #1743 --- CHANGELOG.md | 4 ++++ source/DSCResources/DSC_SqlAGDatabase/DSC_SqlAGDatabase.psm1 | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) 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() }