February 15how to deploy an analysis services database using a script
Deploying an OLAP application using deployment scripts is a common scenario in larger development environments. of course we can use xmla scripts to do the deployment but running the script from SQL Server Management Studio might not be an option in a fully automatic installation script. fortunately enough Microsoft provides the command line utility ascmd.exe which is much like sql0000.exe for the relational SQL Server. ascmd.exe gives a simple method to execute xmla scripts against a SQL Server Analysis Services server (SSAs ).
If you don't have the ascmd.exe as a precompiled version yet you can easily build it from the source code provided in the server samples for the analysis services which can be downloaded from the SQL Server Samples page at codeplex.com.
After installing the samples you shoshould find the source code for asw..exe in the folder
C: \ Program Files \ Microsoft SQL Server \ 90 \ samples \ Analysis Services \ Administrator \ ascmd
There is also a ReadMe provided on how to compile this application (you will need to create a keypair first ).
For an example let's create a deployment script for the adventure works Bi database. first, load the adventure works Bi solution into you development environment and build the project. after doing so you shocould find the subdirectory "bin" in your adventure works project directory. in this directory you will find a larger XML file named "Adventure works DW. asdatabase ". this script starts with a <database>-tag and contains all the cubes and dimensions for the OLAP project.
An easy way to convert this file to a deployment script is to use the deployment wizard (start/SQL Server 2005/Analysis Services/deployment wizard ). here start with selecting the asdatabase-File Created by the build above. you can also add other parameters like how to deal with existing partitions and roles.
Another way to create the script is to grab it from SSMs and paste the asdatabase-file in there manually. this processed is described here in the blog: Simply connect to you SSAs server and open the dialog to create a new database. the name of the database doesn' t matter but you shoshould set the user account the service account. then click the "script"-button and copy the script to the clipboard.
Copy the script to a text editor. in the script you will note a region starting with <database... and ending with </database>. for our purpose we are not interested in that so we can simply delete it (including the database-tags ).
After that we can paste the database script "Adventure works DW. asdatabase "that we create in the first step, to the position where we 've just removed the old database-tag. the file shoshould look like this now (I removed most of the actual code for better readability ):
This is the script we can now execute using the ascmd.exe utility.
C: \> ascmd-s localhost-I aw. xmla
Microsoft (r) Analysis Services 2005 command line tool
Version 9.0.86.1 msil
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
<Return xmlns = "urn: Schemas-Microsoft-com: XML-analysis"> <root xmlns = "urn: Schemas-Microsoft-com: XML-analysis: empty "> </root> </return>
After that, the database is fully created on the SSAS server but not yet processed. in order to process the database we also need a process xmla-script. like abve we simply create this script by grabbing it from SSMs. the script looks like this:
Let's assume we saved the processing script as process. xmla, we can simply execute it using ascmd.exe like this:
C: \> ascmd-s localhost-I process. xmla
Microsoft (r) Analysis Services 2005 command line tool
Version 9.0.86.1 msil
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
<Return xmlns = "urn: Schemas-Microsoft-com: XML-analysis"> <root xmlns = "urn: Schemas-Microsoft-com: XML-analysis: empty "> </root> </return>
Any errors wocould be returned in the xmla response (check the return-tag). An empty message means success so our database is now fully processed and ready to be used.
11: 22 AM | Blog it
Comments Please wait... sorry, the comment you entered is too long. please shorten it. you didn't enter anything. please try again. sorry, we can't add your comment right now. please try again later. to add a comment, you need permission from your parent. ask for permissionyour parent has turned off comments. sorry, we can't delete your comment right now. please try again later. you 've exceeded the maximum number of comments that can be left in one day. please try again in 24 hours. your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. if you believe that your account has been disabled in error please contact Windows Live support. complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.
To add a comment, sign in with your Windows Live ID (if you use Hotmail, messenger, or Xbox Live, you have a Windows Live ID). Sign in
Don't have a Windows Live ID? Sign up
Trackbacks
The trackback URL for this entry is: http://oraylis-olap.spaces.live.com/blog/cns! 61f98448a5e17d57! 302. trakweblogs that reference this entry