如何查找分析服务器数据库的大小、名称等详细信息?

Pus*_*kar 1 sql-server ssas

如何查找 Analysis Services 数据库的大小、名称和其他详细信息?

我有一台 Analysis Services 服务器,我可以在其中看到一个数据库。

我想知道这个数据库的大小和其他基本细节。

Tom*_*m V 6

您可以使用 powershell 连接到数据库并列出许多属性。

使用此脚本找出可以从数据库中获取的属性:

$loadInfo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect("localhost")
$Server.Databases | Get-Member
Run Code Online (Sandbox Code Playgroud)

哪些输出:

   TypeName: Microsoft.AnalysisServices.Database

Name                        MemberType Definition                                                                                                                        
----                        ---------- ----------                                                                                                                        
Disposed                    Event      System.EventHandler Disposed(System.Object, System.EventArgs)                                                                     
Backup                      Method     void Backup(string file), void Backup(string file, bool allowOverwrite), void Backup(string file, bool allowOverwrite, bool bac...
CanProcess                  Method     bool CanProcess(Microsoft.AnalysisServices.ProcessType processType), bool IProcessable.CanProcess(Microsoft.AnalysisServices.Pr...
Clone                       Method     Microsoft.AnalysisServices.Database Clone(), System.Object ICloneable.Clone()                                                     
CopyTo                      Method     Microsoft.AnalysisServices.Database CopyTo(Microsoft.AnalysisServices.Database obj)                                               
CreateBody                  Method     void IMajorObject.CreateBody()                                                                                                    
CreateObjRef                Method     System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)                                                                   
DependsOn                   Method     bool IMajorObject.DependsOn(Microsoft.AnalysisServices.IMajorObject obj)                                                          
Detach                      Method     void Detach(), void Detach(string password)                                                                                       
Dispose                     Method     void Dispose(), void IDisposable.Dispose()                                                                                        
Drop                        Method     void Drop(), void Drop(Microsoft.AnalysisServices.DropOptions options), void Drop(Microsoft.AnalysisServices.DropOptions option...
Equals                      Method     bool Equals(System.Object obj)                                                                                                    
GetDependents               Method     hashtable GetDependents(hashtable dependents), hashtable IMajorObject.GetDependents(hashtable dependents)                         
GetHashCode                 Method     int GetHashCode()                                                                                                                 
GetLifetimeService          Method     System.Object GetLifetimeService()                                                                                                
GetReferences               Method     hashtable GetReferences(hashtable references, bool forMajorChildrenAlso)                                                          
GetType                     Method     type GetType()                                                                                                                    
GetUpdateOverwrites         Method     hashtable GetUpdateOverwrites(bool fullExpansion)                                                                                 
InitializeLifetimeService   Method     System.Object InitializeLifetimeService()                                                                                         
LinkDimension               Method     Microsoft.AnalysisServices.Dimension LinkDimension(Microsoft.AnalysisServices.Dimension source, string dataSourceId), Microsoft...
OnDeserialization           Method     void IDeserializationCallback.OnDeserialization(System.Object sender)                                                             
OnDeserializationBegin      Method     void IDeserializationStartCallback.OnDeserializationBegin(System.Object sender)                                                   
Process                     Method     void Process(), void Process(Microsoft.AnalysisServices.ProcessType processType), void Process(Microsoft.AnalysisServices.Proce...
Refresh                     Method     void Refresh(), void Refresh(bool full), void Refresh(bool full, Microsoft.AnalysisServices.RefreshType type), void IMajorObjec...
Submit                      Method     void Submit(bool submitPermanently), void Submit()                                                                                
ToString                    Method     string ToString(), string IFormattable.ToString(string format, System.IFormatProvider formatProvider)                             
Update                      Method     void Update(), void Update(Microsoft.AnalysisServices.UpdateOptions options), void Update(Microsoft.AnalysisServices.UpdateOpti...
Validate                    Method     bool Validate(Microsoft.AnalysisServices.ValidationErrorCollection errors, bool includeDetailedErrors, Microsoft.AnalysisServic...
WriteRef                    Method     void IMajorObject.WriteRef(System.Xml.XmlWriter writer)                                                                           
Accounts                    Property   Microsoft.AnalysisServices.AccountCollection Accounts {get;}                                                                      
AggregationPrefix           Property   string AggregationPrefix {get;set;}                                                                                               
Annotations                 Property   Microsoft.AnalysisServices.AnnotationCollection Annotations {get;}                                                                
Assemblies                  Property   Microsoft.AnalysisServices.AssemblyCollection Assemblies {get;}                                                                   
BaseType                    Property   type BaseType {get;}                                                                                                              
Collation                   Property   string Collation {get;set;}                                                                                                       
CompatibilityLevel          Property   int CompatibilityLevel {get;set;}                                                                                                 
Container                   Property   System.ComponentModel.IContainer Container {get;}                                                                                 
CreatedTimestamp            Property   datetime CreatedTimestamp {get;set;}                                                                                              
Cubes                       Property   Microsoft.AnalysisServices.CubeCollection Cubes {get;}                                                                            
DatabasePermissions         Property   Microsoft.AnalysisServices.DatabasePermissionCollection DatabasePermissions {get;}                                                
DataSourceImpersonationInfo Property   Microsoft.AnalysisServices.ImpersonationInfo DataSourceImpersonationInfo {get;set;}                                               
DataSources                 Property   Microsoft.AnalysisServices.DataSourceCollection DataSources {get;}                                                                
DataSourceViews             Property   Microsoft.AnalysisServices.DataSourceViewCollection DataSourceViews {get;}                                                        
DbStorageLocation           Property   string DbStorageLocation {get;set;}                                                                                               
Description                 Property   string Description {get;set;}                                                                                                     
Dimensions                  Property   Microsoft.AnalysisServices.DimensionCollection Dimensions {get;}                                                                  
DirectQueryMode             Property   Microsoft.AnalysisServices.DirectQueryMode DirectQueryMode {get;set;}                                                             
DismissedValidationResults  Property   Microsoft.AnalysisServices.DismissedValidationResultCollection DismissedValidationResults {get;}                                  
DismissedValidationRules    Property   Microsoft.AnalysisServices.DismissedValidationRuleCollection DismissedValidationRules {get;}                                      
EstimatedSize               Property   long EstimatedSize {get;set;}                                                                                                     
FriendlyPath                Property   string FriendlyPath {get;}                                                                                                        
Host                        Property   System.IServiceProvider Host {get;set;}                                                                                           
ID                          Property   string ID {get;set;}                                                                                                              
ImagePath                   Property   string ImagePath {get;set;}                                                                                                       
ImageUniqueID               Property   string ImageUniqueID {get;set;}                                                                                                   
ImageUrl                    Property   string ImageUrl {get;set;}                                                                                                        
ImageVersion                Property   string ImageVersion {get;set;}                                                                                                    
IsLoaded                    Property   bool IsLoaded {get;}                                                                                                              
Language                    Property   int Language {get;set;}                                                                                                           
LastProcessed               Property   datetime LastProcessed {get;set;}                                                                                                 
LastSchemaUpdate            Property   datetime LastSchemaUpdate {get;set;}                                                                                              
LastUpdate                  Property   datetime LastUpdate {get;set;}                                                                                                    
MasterDataSourceID          Property   string MasterDataSourceID {get;set;}                                                                                              
MiningStructures            Property   Microsoft.AnalysisServices.MiningStructureCollection MiningStructures {get;}                                                      
ModelType                   Property   Microsoft.AnalysisServices.ModelType ModelType {get;set;}                                                                         
Name                        Property   string Name {get;set;}                                                                                                            
ObjectReference             Property   Microsoft.AnalysisServices.ObjectReference ObjectReference {get;}                                                                 
OwningCollection            Property   Microsoft.AnalysisServices.ModelComponentCollection OwningCollection {get;set;}                                                   
Parent                      Property   Microsoft.AnalysisServices.Server Parent {get;}                                                                                   
ParentDatabase              Property   Microsoft.AnalysisServices.Database ParentDatabase {get;}                                                                         
ParentServer                Property   Microsoft.AnalysisServices.Server ParentServer {get;}                                                                             
Path                        Property   string Path {get;}                                                                                                                
ProcessingPriority          Property   int ProcessingPriority {get;set;}                                                                                                 
ReadWriteMode               Property   Microsoft.AnalysisServices.ReadWriteMode ReadWriteMode {get;set;}                                                                 
ReturnPassword              Property   bool ReturnPassword {get;set;}                                                                                                    
Roles                       Property   Microsoft.AnalysisServices.RoleCollection Roles {get;}                                                                            
Site                        Property   System.ComponentModel.ISite Site {get;set;}                                                                                       
SiteID                      Property   string SiteID {get;set;}                                                                                                          
State                       Property   Microsoft.AnalysisServices.AnalysisState State {get;set;}                                                                         
StorageEngineUsed           Property   Microsoft.AnalysisServices.StorageEngineUsed StorageEngineUsed {get;set;}                                                         
Translations                Property   Microsoft.AnalysisServices.TranslationCollection Translations {get;}                                                              
Visible                     Property   bool Visible {get;set;}                                                                                                           
Run Code Online (Sandbox Code Playgroud)

您可以根据需要组合或循环这些属性,例如,此脚本应为您提供已知数据库的大小:

$loadInfo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect("localhost")
$database = $server.Databases.FindByName("AdventureWorksDW2012Multidimensional-EE")
Write-Output("database size Size : {0}MB" -f ($database.EstimatedSize/1024/1024).ToString("#,##0"))
Run Code Online (Sandbox Code Playgroud)

输出:

database size Size : 24MB
Run Code Online (Sandbox Code Playgroud)

如果您想要服务器上所有数据库的大小,您也可以遍历它们:

$loadInfo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect("localhost")
foreach ($database in $server.Databases)
{
Write-Output("{0} size Size : {1}MB" -f $Database.Name, ($database.EstimatedSize/1024/1024).ToString("#,##0"))
}
Run Code Online (Sandbox Code Playgroud)

输出:

AdventureWorksDW2012Multidimensional-EE size Size : 24MB
MultidimensionalProject1 size Size : 0MB
Run Code Online (Sandbox Code Playgroud)

根据您的喜好混合和匹配以获取有关所有数据库、单个数据库、数据库内的多维数据集、多维数据集内的维度等的信息。