Database Reference
In-Depth Information
2. You could use the SYSTEMGETSUBDIRS command to get subdirectories of
a folder included in the AllowedBrowsingFolders property. For example,
the following command retrieves folders for each database found under the
SSAS data folder:
SYSTEMGETSUBDIRS 'E:\Program
Files\Microsoft SQL
Server\MSAS11.SQL2012\OLAP\Data'
There's more...
As you can tell, the commands discussed in this section are very useful but some-
what limited because they don't provide the size of each data folder or each partition.
SSMS allows obtaining the estimated size for one partition at a time (simply right-
click on the partition and choose Properties ); going through hundreds or thousands
of partitions to collect the size of each is unacceptable. Fortunately, we can obtain
the necessary information with a little effort, as shown in the following PowerShell
script:
# script to obtain partition and measure group
sizes
#load the Analysis Services assembly first so
we can instantiate Analysis Services object:
[Reflection.Assembly]::LoadFrom("E:\Program
Files\Microsoft SQL
Server\110\SDK\Assemblies\Microsoft.AnalysisServices.dll")|out-null
$instance="Julia-PC\SQL2012"
$amoServer= new-object
Microsoft.AnalysisServices.Server
#connect to the instance
$amoServer.Connect($instance)
#connect to the db and cube:
$db=$amoServer.databases.GetByName("AdventureWorks_Sample")
$cube = $db.cubes.GetByName("Adventure Works")
#loop over measure group partitions:
foreach ($mg in $cube.MeasureGroups)
{
Search WWH ::




Custom Search