简体   繁体   中英

SSAS Processing Cubes - Won't work in powershell but works in Visual Studio

I'm attempting to process cubes and dimensions in powershell. It has been working for awhile but all of a sudden it stops. I can process the dimensions and cubes in visual studio but processing them with a powershell script in the same order gives me a duplicate attribute key error.

Powershell Script:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")


$serverAS = New-Object Microsoft.AnalysisServices.Server

$serverAS.connect("SERVER")



$db = $serverAS.databases["ANALYSIS DB"]

$db.cubes | select name, storagemode, lastprocessed

$db.dimensions | select name, isparentchild, lastprocessed, storagemode

Foreach ($c in $db.dimensions)  {$c.process("ProcessFull")}

Foreach ($c in $db.cubes)  {$c.process("ProcessFull")}

You need to ignore the key errors like this:

## Set up the Error Configuration so that Key Errors are ignored
$errorConfig = New-Object `
    Microsoft.AnalysisServices.ErrorConfiguration("D:\ProcessLogs\")
$errorConfig.KeyNotFound = "ReportAndContinue"
$errorConfig.KeyErrorAction = "ConvertToUnknown"
$errorConfig.KeyErrorLimit = -1

and then process with this error config parameter:

## Process the current database
$c.Process("ProcessFull", $errorConfig)

Reference and Example: http://www.biadmin.com/2012/07/bi-admin-scripts-process-ssas-database.html

Thanks for the response. I was actually able to get around this by using SSDT and Integration Services to process Dimensions and Cubes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM