我想使用C# AMO对象刷新多维数据集分区,同步刷新分区的方式正在发生。但是我想并行地刷新分区。为此,我尝试调用refresh方法
Parelle.ForEach()。
templatePartition.RequestRefresh(Microsoft.AnalysisServices.Tabular.RefreshType.Full);
database.Model.SaveChanges();但这是错误的:
未能保存对服务器的修改。返回错误:“由于死锁,锁操作未成功结束。
因此,希望检查使用AMO异步调用进行分区刷新的任何人。
发布于 2019-05-06 20:11:13
正如Jeroen所提到的,正确的方法是允许SSAS处理并行化,这样您就不会遇到死锁或其他来自错误顺序处理分区的问题。
您可以使用CaptureLog属性,以便在AMO中使用实现这一点。捕获日志收集要运行的语句,然后收集ExecuteCaptureLog来运行所有语句。ExecuteCaptureLog上的第二个参数表示进程是否将并行运行。
static public XmlaResultCollection RunWithCaptureLog(Server server, string dbName)
{
if ((svr != null) && (svr.Connected))
{
svr.CaptureXml = true;
#region Actions to be captured to an XMLA file
foreach (Table table in server.Databases.GetByName(dbName).Model.Tables)
{
foreach (Partition partition in table.Partitions){
partition.RequestRefresh(Microsoft.AnalysisServices.Tabular.RefreshType.Full);
}
}
#endregion
svr.CaptureXml = false;
//public Microsoft.AnalysisServices.XmlaResultCollection ExecuteCaptureLog (bool transactional, bool parallel, bool processAffected)
return svr.ExecuteCaptureLog(true, true, true);
}
}https://stackoverflow.com/questions/55968434
复制相似问题