How to deploy an Analysis Services database using a script
2009-05-04 16:46
866 查看
February 15
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 should find the source code for ascmd.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 should 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 should set the user account the 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 should 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 above 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 would 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
function CommentControl_Add()
{
var postFunction = null;
if(typeof(Live_CommentControl) != 'undefined') { Live_CommentControl.AddComment("CommentControl", postFunction) };
}function CommentControl_Delete(index)
{
var postFunction = null;
var promptStr = 'Click OK to delete the comment.';
if(typeof(Live_CommentControl) != 'undefined'){ Live_CommentControl.DeleteComment(index, "CommentControl", postFunction, promptStr) };
}
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 permission
Your 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
None
How 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 automated installation script. Fortunately enough Microsoft provides the command line utility ascmd.exe which is much like sqlcmd.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 should find the source code for ascmd.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 should 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 should set the user account the 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 should 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 above 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 would 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
function CommentControl_Add()
{
var postFunction = null;
if(typeof(Live_CommentControl) != 'undefined') { Live_CommentControl.AddComment("CommentControl", postFunction) };
}function CommentControl_Delete(index)
{
var postFunction = null;
var promptStr = 'Click OK to delete the comment.';
if(typeof(Live_CommentControl) != 'undefined'){ Live_CommentControl.DeleteComment(index, "CommentControl", postFunction, promptStr) };
}
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 permission
Your 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.trak Weblogs that reference this entryNone
相关文章推荐
- [转贴]How to work with stored procedures by using script in an Office InfoPath 2003 form
- How To Configure Client Failover For Dataguard Connections Using Database Services (Doc ID 1429223.1
- How to pass an argument to a PowerShell script?
- How to send an email from oracle workflow process using an AdHocRole?
- How to sort an arbitrarily large set of data using Hadoop?
- <<How to setup an iSCSI target using tgtadm>>
- 苹果脚本-How to send a message using iChat and AppleScript
- How to Convert 10g Single-Instance database to 10g RAC using Manual Conversion procedure (文档 ID 7474
- Save an XML File to Database and Send an Email using XSLT
- How to sign an IIS SSL certificate request using OpenSSL
- How to call an Oracle Stored Procedure that returns one or more REF CURSORS, using ADO from C++ How
- ActionScript: How to generate UUID using Actionscript
- How To Generate An XML File As A Target Datastore Using ODI In An Integration Interface ? [ID 454268
- How to Configure an SSIS Package to Access a Web Service using WCF
- An example of how to streaming audio over network using Qt
- How to generate an RSS feed for your web site using ASP.NET
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server. (文档 ID 885522.1)
- How to determine who is logged on to a database by using Microsoft Jet UserRoster in Access 2000
- How to Restore the Database Using AMDU after Diskgroup Corruption (Doc ID 1597581.1)
- How to connect to another database using sqlplus?