我们如何使用 Powershell 创建 SSAS 2008 多维数据集分区?
问问题
1847 次
3 回答
6
这会向 Adventure Works DW 2008R2 多维数据集(特别是 Adventure Works 多维数据集中的 Internet 客户度量值组)添加一个分区:
$server_name = "localhost"
$catalog = "Adventure Works DW 2008R2"
$cube = "Adventure Works"
$measure_group = "Fact Internet Sales"
$old_partition = "Customers_2004"
$new_partition = "Customers_2009"
$old_text = "'2008"
$new_text = "'2009"
[Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.AnalysisServices.DLL")
$srv = new-object Microsoft.AnalysisServices.Server
$srv.Connect("Data Source=" + $server_name)
$new_part = $srv.Databases[$catalog].Cubes[$cube].MeasureGroups[$measure_group].Partitions[$old_partition].Clone()
$new_part.ID = $new_partition
$new_part.Name = $new_partition
$new_part.Source.QueryDefinition = $new_part.Source.QueryDefinition.Replace($old_text, $new_text)
$srv.Databases[$catalog].Cubes[$cube].MeasureGroups[$measure_group].Partitions.Add($new_part)
$srv.Databases[$catalog].Cubes[$cube].MeasureGroups[$measure_group].Partitions[$new_partition].Update()
$srv.Databases[$catalog].Update()
$srv.Disconnect()
您必须在顶部更改变量以及对Microsoft.AnalysisServices.dll
程序集的引用,但除此之外,这将非常有效。
诀窍是调用Update()
已更改的对象,然后调用整个数据库本身。
如果您还想处理新分区,您可以在之前使用以下行来执行此操作$srv.Disconnect
:
$srv.Databases[$catalog].Cubes[$cube].MeasureGroups[$measure_group].Partitions[$new_partition].Process()
您可以在此处了解有关分析管理对象 (AMO)的更多信息。
于 2012-01-04T16:21:46.477 回答
1
看看这个: PowerSSAS
它没有明确的添加分区支持,因此您可能必须制作一个 XMLA 片段来执行添加分区,然后使用 PowerSSAS 将其推送到 SSAS 服务器。
于 2011-12-22T22:48:59.607 回答
-2
您可以使用 :
Microsoft.AnalysisServices.Deployment [ASdatabasefile]
{[/s[:logfile]] | [/a] | [[/o[:output_script_file]] [/d]]}
使用 powershell 部署您的多维数据集 AS。
于 2012-12-12T21:43:48.557 回答