Otcopus部署-SQL-部署DACPAC“无法连接到数据库服务器。”

问题描述 投票:0回答:1

第一次尝试使用章鱼。尝试将dacpac部署到计算机上,并且它不断失败。我继续收到以下错误:

Exception calling "Extract" with "4" argument(s): "Could not connect to database server." 
At C:\Octopus\Work\20191023152506-102-81\Script.ps1:394 char:13 
+             $dacServices.Extract($dbDacPacFilepath, $TargetDatabase,  ... 
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException 
    + FullyQualifiedErrorId : DacServicesException 

The remote script failed with exit code 1 

The action SQL - Deploy DACPAC on Staging failed

我当前正在使用SQL Server 2017,并为SQL Server 2016安装了dacframework。对于我尝试使用localhost的连接字符串以及sql management studio中提供的服务器名称。我没有传递任何凭据,我正在使用集成安全性。我也传递了数据库名称。我也跟随this youtube视频,只是不使用项目变量。

sql-server powershell-2.0 octopus-deploy dacpac
1个回答
0
投票

[根据我以前的经验,我只是使用SqlPackage.exe来部署dacpac。帮助手动测试和完善权限或其他问题。

例如:

#example usage:Generate-DBUpdate-Script -server $dbServer -db $dbName -user $dbUser -psw $dbPassword -dacpacFilePath $dacpacFile -publishProfilePath ".\Publish\$dbPublishProfile" -outputFile $SqlUpgradeArtifactName
function Generate-DBUpdate-Script($server, $db, $user, $psw, $dacpacFilePath, $publishProfilePath, $outputFile)
{        
    #generate an update script
    & 'C:\Program Files (x86)\Microsoft SQL Server\110WorkingDAC\DAC\bin\SqlPackage.exe' /Action:Script /OutputPath:$outputFile /SourceFile:$dacpacFilePath /Profile:$publishProfilePath /TargetServerName:$server /TargetDatabaseName:$db /TargetUser:$user /TargetPassword:$psw

    #save generated script as deployment artifact
    New-OctopusArtifact $outputFile
}

可以将操作更改为publish,以避免生成脚本,而直接立即部署。

希望有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.