編集:ハングしていないことを示すように更新されました。AGES がかかるだけです。
dacpac を使用して既存の SQL Server データベースを更新しようとしています。
以下の (簡略化された) 例を使用して、新しい SQL サーバー データベースを 30 秒で作成できます。私が抱えている問題は、同じ dacpac を使用して手順を再実行する (つまり、新たに作成するのではなく、既存のデータベースを更新する) のに 20 分かかることです。
時差が予想される場合、このようなものですか?redgate の SqlCompare を包括的に使用してきたので、私はこの時間が許せないと感じています。
deploy メソッドの 3 番目のパラメーターは UpgradeExisting で、これを true に設定しています - これですべての作業が必要ですか、それとも何か不足していますか??
void Deploy(string TargetConnectionString, string TargetDatabaseName, string pathToSourceDACPAC)
{
DacServices dacServices = new DacServices(TargetConnectionString);
//Set up message and progress handlers
dacServices.Message += new EventHandler<DacMessageEventArgs>(dbServices_Message);
dacServices.ProgressChanged += new EventHandler<DacProgressEventArgs>(dbServices_ProgressChanged);
//Load the DACPAC
DacPackage dacpac = DacPackage.Load(pathToSourceDACPAC);
//Set Deployment Options
DacDeployOptions dacOptions = new DacDeployOptions();
dacOptions.AllowIncompatiblePlatform = true;
//Deploy the dacpac
dacServices.Deploy(dacpac, TargetDatabaseName, true, dacOptions);
}
//Event handlers...
void dbServices_Message(object sender, DacMessageEventArgs e)
{
OutputThis("DAC Message", e.Message.ToString());
}
void dbServices_ProgressChanged(object sender, DacProgressEventArgs e)
{
OutputThis(e.Status.ToString(), e.Message.ToString());
}
NB、プログラムは dacServices.Deploy 行のイーサに消えます..