SQL Server 2012 Analysis Services (SSAS) DMVs

By:   |   Updated: 2013-07-26   |   Comments (6)   |   Related: > Analysis Services Administration


What are the SQL Server Analysis Services (SSAS) 2012 DMV's and how can they be used?


In my previous tip on XMLA both the Execute and Discover methods were discussed in context of running XMLA queries. The discover method exposes metadata about a SSAS database; however the data is returned in XML form. As an alternative to the discover method, SSAS provides a group of dynamic management views (DMV's for short) which can be queried to return the same data as the discover method. However, by using these DMV's, the data is returned in a tabular format which is generally easier to read and use as a basis for reports. The queries are DMX, but they have the look and feel of SQL with some caveats. The DMV's can be broken up into two main categories:

  1. the DBSCHEMA/MDSCHEMA DMV's which retrieve metadata about the SSAS database,  such as cube structure and dimension structure and
  2. the Discover DMV's which retrieve monitoring data such a current connections and locks.


The SSAS DMV's act in many ways like regular SQL DMV's and return data in a table format, at least in most cases. The information that can  be queried covers everything from the connections that are currently active to the amount of memory being used to what dimensions are part of the cube.  Furthermore, you can even query a dimension to get its members. Even though the queries are SQL-like, you can not use the following:

  • Joins
  • Group By
  • Like
  • Cast / Convert
  • Multiple Order By

Last, and probably equally important, in order to run queries against the SSAS database, system administrator permissions are required. 

The best way to show what the views can do is to review several number of examples which will in turn convey the limitations that come into play with several of the DMV's. Probably the best place to start is with a query to get a list of the DMV's available to query.  The below MDX queries will display the list of "views" which can be queried. Note that the word "views" is used very loosely as these DMV's are SQL-like but not pure SQL. 

-- returns only system DMV's


-- returns all tables that can be queried including dimension and fact tables -- (will discuss more about these items later)

In order to run these queries, open SSMS and connect to your SSAS database as displayed below. For our examples we will be using the AdventureWorks 2012 DataWarehouse sample database available on CodePlex, http://msftdbprodsamples.codeplex.com/releases/view/55330. Be sure to select the AdventureWorksDW2012 database and verify the query type is set to MDX. If MDX is not selected, you can set the query type by clicking on the MDX button in the tool bar.

New Query

The query results are partially displayed in the below screen print. This table list is roughly equivalent to the DMV's that are available to query against the SSAS database. For details on each of these row sets, MSDN has a DMV reference sheet available at: http://msdn.microsoft.com/en-us/library/hh230820.aspx#bkmk_ref.

Table List

Next, we can run the following query to get a list of cubes in a particular database.

[CUBE_NAME] AS Cube_or_Perspective_Name,
[CUBE_CAPTION] AS Cube_or_Perspective_Caption,
[CUBE_TYPE] AS Cube_Type,

Of course there are a few caveats with the query results shown below.

DMV Cube

First you will notice that only two cubes are displayed in the objective explorer (left side of above screen print), while the query results show seven rows.  The reason for this discrepancy is that the results include Perspectives in addition to the regular cubes. 

DMV Cube Perspectives

Thus, a simple way to return just the cubes and not the perspectives is to adjust our query as shown in the next illustration. In this case, the criteria in the where clause is a bit of cheat in that it looks for a blank value for the Base_Cube_Name by using the less than operator.

[CUBE_NAME] AS Cube_or_Perspective_Name,
[CUBE_CAPTION] AS Cube_or_Perspective_Caption,
[CUBE_TYPE] AS Cube_Type,

Cube Only Results

Next we can get a list of dimensions using the MDSCHEMA_DIMENSIONS DMV.

[CUBE_NAME] AS Cube_or_Perspective_Name,
[DIMENSION_NAME] AS Dimension_Name,
[DIMENSION_CAPTION] AS Dimension_Caption,

Of course a few caveats exists with the query results shown below. The dimensions are listed multiple times; for instance, the Account dimension is listed seven times. One dimension exists for each cube / measure group; additionally, one dimension, the one whose cube name begins with the $ is the cube level dimension. Furthermore, the dimension caption displays the name that the end users see. 

Dimension Results

Drilling into the dimension, we can next use the MDSCHEMA_MEASUREGROUP_DIMENSIONS DMV, as displayed below. This DMV breaks out the dimensions at the measure group granularity level. Notice that I have included two items in the Order By clause. 

[CUBE_NAME] AS Cube_or_Perspective_Name,
[DIMENSION_IS_VISIBLE] AS Dimension_Visible,
[DIMENSION_GRANULARITY] AS Dimension_Granularity

Unfortunately, including more than one item in the order clause is not supported and produces the following error.

order by error

Using just one order by field and adding the cube name to the where clause produces better results which are illustrated below. Again, notice we have duplicates as we did before with the MDSCHEMA_DIMENSIONS DMV.

diemension measure group

Before moving on to some of the monitoring DMV's, let's review the measure MDSCHEMA_MEASURES DMV.

[CUBE_NAME] AS Cube_or_Perspective_Name,
[MEASURE_NAME] AS Measure_Name,
[MEASURE_Caption] AS Measure_Caption,
[MEASURE_IS_VISIBLE] AS Dimension_Visible,
[MEASURE_AGGREGATOR] AS Measure_Aggregator,
[EXPRESSION] AS Calculated_Measure_Expression

As illustrated below, in addition to the normal name and visibility information available from the dimension DMV's, the MDSCHEMA_MEASURES DMV conveys the format used for the measure and the aggregation method, which tells how to aggregate the measure such as Sum, Average, or Custom (see http://msdn.microsoft.com/en-us/library/ms126250.aspx ). The DMV also displays the formula used in a calculated measure in the Expression field which is helpful when checking multiple calculated values at one time; non calculated measure have no data in the expression field.


SSAS Discover DMV's

The SSAS Discover DMV's retrieve data used to monitor a SSAS database.  Some data points that can be retrieved include the query execution times, current locks, CPU and memory usage, and current connections. We will start with the DISCOVER_CONNECTIONS DMV.


This DMV provides us with a wealth of details about the current sessions including the Last Command to be run, how long the command took to run, how much memory the session used, and how many reads and writes were used. 

session query details

This DISCOVER_COMMANDS DMV provides us with similar information at the command level. You will also notice that you can do a Select * to retrieve all columns from the DMV; however, just as with other select statements, I would recommend only retrieving the columns needed.


command query

Some of the Discover DMV's require the use of SYSTEMRESTRICTSCHEMA and also require passing in additional parameters. In essence, this means that instead of writing a select directly against the DMV, we query the SYSTEMRESTRICTSCHEMA and then specify the DMV and any other parameters required when writing the query.  For example, the below query integrates the DISCOVER_INSTANCES DMV.  In this case, only one parameter is required, INSTANCE_NAME. Notice how the "from" uses the SYSTEMRESTRICTSCHMEA. 


The DISCOVER_INSTANCES DMV returns the following data about the instance. 

Instance Query

The instance status can be looked up at: http://msdn.microsoft.com/en-us/library/ms126228.aspx.

Using the $SYSTEM.DBSCHEMA_TABLES DMV, you can explore many of the other Discover SSAS DMV's.


Using the SSAS DMV's can return a plethora of information about a SSAS cube's metadata and a cube's current state, from a monitoring standpoint. These DMV's are easier to use than XMLA related queries as the data is returned in tabular format and the queries are written, in most cases, in a SQL-like manner. The results, depending on the DMV, can provide much of the information needed for a SSAS administrator to profile and monitor the SSAS cubes.

Next Steps

Last Updated: 2013-07-26

get scripts

next tip button

About the author
MSSQLTips author Scott Murray Scott Murray has a passion for crafting BI Solutions with SharePoint, SSAS, OLAP and SSRS.

View all my tips

More SQL Server Solutions

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

Email me updates

Signup for our newsletter

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.

Monday, January 11, 2016 - 6:58:55 AM - Santosh Back To Top

Hello Scott,

Is there a way to fetch the metadata for the perspective of a cube. DMV's help us in getting the metadata for a Cube but I am unable to get the metadata for Perspectives of the cube. Any ideas or suggestions would be of very great help.

Thanks in advance.




Sunday, December 28, 2014 - 8:23:11 PM - Neha Back To Top


Very helpful..thanks

Monday, July 28, 2014 - 9:37:54 AM - Scott Back To Top

Take a look at:





Monday, July 28, 2014 - 4:14:31 AM - yoni Back To Top

Hi Scott,

First - Very nice and informative article! thank you!

do you know a way to query SSAS to get the DB description (under DB properties > General > description)?




Thursday, April 17, 2014 - 10:00:18 AM - scott murray Back To Top

Sorry this information is not available in DMV.

Thursday, April 17, 2014 - 12:39:23 AM - rohit Back To Top

Hi Scott


Thats a very nice article. I have a query, I want to find the ID through which CUBE was created or the current owner of the CUBE.

Is there any DMV through which we can find this information.






get free sql tips

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.

Learn more about SQL Server tools