The operation could not be performed because OLE DB provider ... for linked server ... was unable to begin a distributed transaction

Description

This error occurs because of the Transaction Isolation Level.

By default DLM Automation uses the Serializable Transaction Isolation Level, however this deployment requires a Transaction Isolation Level of Read Committed.

Workarounds

There are two alternate solutions to this issue:

1 - Use the -TransactionIsolationLevel parameter on the cmdlet (or equivalent option on the add-on) and set it to ReadCommitted

For example:

Powershell

Invoke-DatabaseBuild -InputObject "C:\MyScriptsFolder" -TransactionIsolationLevel ReadCommitted

Azure Devops YAML:

steps:
- task: redgatesoftware.redgateDlmAutomationBuild.DlmAutomationBuildTask.RedgateSqlChangeAutomationBuild@4
displayName: 'Build WidgetShop1'
inputs:
operation: Build
subFolderPath: '$/Widgetshop/DBScripts'
packageName: WidgetShop
buildAdvanced: true
compareOptionsBuild: NoTransactions

 


2 - Use the NoTransactions SQL Compare option
https://documentation.red-gate.com/sc13/using-the-command-line/options-used-in-the-command-line#Optionsusedinthecommandline-NoTransactions

Please note that when using NoTransactions the deployment will not be rolled back in case of error, so if you use this option it's advisable to backup first

 

For example:

Invoke-DatabaseBuild -InputObject "C:\MyScriptsFolder" -SQLCompareOptions "NoTransactions"

 

Azure DevOps YAML:

steps:
- task: redgatesoftware.redgateDlmAutomationBuild.DlmAutomationBuildTask.RedgateSqlChangeAutomationBuild@4
displayName: 'Build WidgetShop1'
inputs:
operation: Build
subFolderPath: '$/Widgetshop/DBScripts'
packageName: WidgetShop
buildAdvanced: true
transactionIsolationLevelBuild: readCommitted

 

Azure DevOps GUI (the example shows both options, you only need to use one of those):

Screenshot_2.png

Was this article helpful?

1 out of 3 found this helpful
Have more questions? Submit a request