How to Automate SSAS Tabular Model Processing

You are working on a BI project that involves SSAS Tabular model. As you cannot process the model manually you need to develop a solution to process the model automatically. There are two scenarios here:

  1. You have an up and running SQL Server Integration Services (SSIS) instance: In this case you can build a SSIS package to process the Tabular Model.
  2. You do not have an SSIS instance ready on the server: So you need to create a SQL Server Agent Job.

In this post I’m expressing easy ways to solve the problem based on the above scenarios.

Using SQL Server Integration Services to Process SSAS Tabular Model

Follow the steps below:

  1. Create a new SSIS project using (SQL Server Data Tools) SSDT
  2. Right click on the “Connection Managers” area and select “New Analysis Services Connection”image

  1. Click “Edit”
  2. Enter the SSAS Tabular server
  3. Leave “Location ” BLANK! You might face the following error: “A connection cannot be made. Ensure that the server is running.”image
  4. Click “Use Windows NT Integrated Security”
  5. Select your SSAS Tabular catalog from the list. In my case it is Adventure Works
  6. Click OKimage
  7. Put a “Analysis Services Processing Task” on Control Flow and double click on the task
  8. Go to Processing Settings
  9. Select the Analysis Services Connection
  10. Click “Add”
  11. Tick the database and click OKimage
  12. You should see something like the image below in the “Analysis Services Processing Task Editor” window. Note that the object type is “Database”.image
  13. Click OK

Now you can run the package by pressing F5 and your SSAS Tabular model will be processed.

image

Now you need to deploy the SSIS project to SSIS Catalog and then create a SQL Server Agent Job to run the SSIS package overnight.

Setup a SQL Server job agent to process the Tabular Model

In this case you need to use SSMS to generate the XMLA scripts for processing the Tabular model. To do so follow the below instructions:

  1. Open SSMS and connect to a Tabular Analysis Services server and expand “Databases”
  2. Right click on a desired database and select “Process Database”image
  3. In “Process Database” window select the processing mode from the dropdown list

image

  1. Click on the small rectangle of the “Script” button and select “Script Action to New Query Window”image
  2. If you do NOT need to process the database now click on “Cancel” button
  3. The needed XMLA scripts is generated in SSMSimage
  4. Copy the generated XMLA code
  5. In SSMS connect to the SQL Server instance that you want to define a new SQL Server Agent job for processing the Tabular database
  6. Create a new job by right clicking on “SQL Server Agent” and selecting “New” and then “Job” image
  7. Type a descriptive name for the new job and go to steps and click New to create a new step
  8. Type a name for the step
  9. In Type section select “SQL Server Analysis Services Command” from the dropdown list
  10. Type in the Tabular model server address in the “Server” section
  11. Now paste the XMLA script that you’ve copied before and then OK

image

All done!

Now you can run the job and your Tabular model will be processed.

NOTE: Do not forget to define a schedule for running the job frequently. As defining a new job is out of scope I didn’t explain it in detail.

 

Leave a Reply