Click here to Skip to main content
Click here to Skip to main content
Go to top

Deploy Analysis Services 2000 single Cubes

, 4 Oct 2007
Rate this:
Please Sign up or sign in to vote.
This script permits to deploy single cubes from one server to another

Introduction

This script simplifies the deployment of single cubes from one server to another.

Background

To access such a rich, extensible, wide-ranging set of features in a simple, straightforward fashion, the Decision Support Objects (DSO) library supplies a hierarchical object model for use with any development environment that can support Component Object Model (COM) objects and interfaces, such as Microsoft Visual C++®, Microsoft Visual Basic®, and Microsoft Visual Basic Scripting Edition.

For more information, see Introducing Decision Support Objects.

Using the Code

This script is written in VBScript using DSO objects.

'--------------------------------------------------------------------------

' Name       : DeployAS2kCUBE.vbs

' Author     : Manuel Cavalieri

' Date       : 27 Sep 2007

' Description: 

' Notes      : 

'

'              

'

' Revision History:

' Date          Description


'----------------------------------------------------------------------------

Dim vbCrLf
Dim m_sSourceServer     
Dim m_sSourceDatabase     
Dim m_sSourceCube     
Dim m_sTargetServer     
Dim m_sTargetDatabase     
Dim m_sTargetCube     

vbCrLf = chr(13) & chr(10)
Const olapLockWrite = 8

If WScript.Arguments.Count = 6 Then
    m_sSourceServer     = WScript.arguments(0)
    m_sSourceDatabase     = WScript.arguments(1)
    m_sSourceCube         = WScript.arguments(2)
    
    m_sTargetServer     = WScript.arguments(3)
    m_sTargetDatabase     = WScript.arguments(4)
    m_sTargetCube         = WScript.arguments(5)
Else
    sMsg = WScript.ScriptName & " richiede 6 argomenti:" & vbCrLf _
           & "    - Nome/IP Address of Analysis Services Server source" & vbCrLf _
           & "    - Source Database Namee" & vbCrLf _
           & "    - Source Cube Name" & vbCrLf _
           & vbCrLf _
           & "    - Name/IP Address of Analysis Services Server Destination" & vbCrLf _
           & "    - Target Database Name" & vbCrLf _
           & "    - Target Cube Name" & vbCrLf _

           & "This script copy Cube from a source OlapDB to another and process the cube" & vbCrLf
    WScript.echo sMsg
    WScript.quit(1)
End If


Dim oSourceServer
Dim oSourceCube

Dim oTargetServer
Dim oTargetDatabase
Dim oTargetCube
Dim oCubeBkp


Set oSourceServer = CreateObject("DSO.Server")
Call oSourceServer.Connect(m_sSourceServer)
Set oSourceCube = oSourceServer.MDStores(m_sSourceDatabase).MDStores(m_sSourceCube)

Set oTargetServer = CreateObject("DSO.Server")
Call oTargetServer.Connect(m_sTargetServer)
Set oTargetDatabase = oTargetServer.MDStores(m_sTargetDatabase)

Call oTargetDatabase.LockObject(olaplockWrite, "Deploy Cubes...")

If Not oTargetDatabase.MDStores.Find(m_sTargetCube) Then
    '== Set oSourceCube = oSourceServer.MDStores(m_sSourceDatabase).MDStores(m_sSourceCube)

    Set oTargetCube = oTargetDatabase.MDStores.AddNew(m_sTargetCube)
    Call oSourceCube.Clone(oTargetCube)
    Call oTargetCube.Update()
Else
    Set oTargetCube = oSourceServer.MDStores(m_sSourceDatabase).MDStores(m_sTargetCube)
    Set oCubeBkp = oTargetDatabase.MDStores.AddNew(m_sTargetCube & "_" & Year(Now()) & _
                                     Month(Now()) & Day(Now()) & Hour(Now()) & Minute(Now()))
    Call oTargetCube.Clone(oCubeBkp)
    Call oCubeBkp.Update()
    Call oTargetDatabase.MDStores.Remove(m_sTargetCube)
    
    Set oTargetCube = oTargetDatabase.MDStores.AddNew(m_sTargetCube)
    Call oSourceCube.Clone(oTargetCube)
    
    Call oTargetCube.Update()
End If
Call oTargetDatabase.Update()
Call oTargetDatabase.UnLockObject()
Call oTargetCube.Process()
Call oTargetServer.Update()

WScript.echo "Done."

Points of Interest

This script is very useful to make the deployment of single cube without having to deploy the entire set of cubes contained in the database.

History

  • 5th October, 2007 -- First release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Manuel C

Italy Italy
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 5 Oct 2007
Article Copyright 2007 by Manuel C
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid