Wednesday, March 7, 2012

Creating offline (local) cubes using XMLA, or any other way..

Hi,

I realise this subject has been discussed a lot but there seems to be no definitive answer.

The company I work for creates many cubes (currently using many SQL statements) for the sales regions at the end of each month and we need to move to a better platform, hence analysis services projects.

Is there any "easy" way to take a cube created by an analysis services project and save it to an offline (local) cube?

Currently I am trying to use VB.NET 2005 to process the XMLA definition from AS2005, which is easy to get at.

The VB code is:

Dim myClient As New Microsoft.AnalysisServices.Xmla.XmlaClient

Dim l_result, l_XmlaCommand As String

l_result = ""

Try

REMDim l_connect As String = "Provider=MSOLAP.3;Data Source=L00086SINEY;Initial Catalog=Beta1;Integrated Security=SSPI "

Dim l_connect As String = "Provider=MSOLAP.3;Data Source=c:\inetpub\wwwroot\xmla\BetaTest.cub;Integrated Security=SSPI;UseExistingFile=False"

myClient.Connect(l_connect)

l_XmlaCommand = "<Statement>begin transaction</Statement>"

myClient.Execute(l_XmlaCommand, "", l_result, False, True)

Dim FS As New IO.StreamReader("C:\XMLA_Command.txt")

l_XmlaCommand = FS.ReadToEnd

FS.Close()

myClient.Execute(l_XmlaCommand, "", l_result, False, True)

l_XmlaCommand = "<Statement>commit transaction</Statement>"

myClient.Execute(l_XmlaCommand, "", l_result, False, True)

Catch ex As Exception

MsgBox("Error in Client connection")

Finally

myClient.Disconnect()

End Try

The XMLA_Command.txt (first few lines) is:

<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<ParentObject>

<DatabaseID>http://localhost/xmla/testcube.cub</DatabaseID>

</ParentObject>

<ObjectDefinition>

<Cube xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ID>Beta1</ID>

<Name>Beta1</Name>

<Annotations>

<Annotation>

and finally the error I get is:

Errors in the metadata manager. Either the database with the ID of 'http://localhost/xmla/testcube.cub' does not exist in the server with the ID of 'L00086SINEY\LocalCube', or the user does not have permissions to access the object.

The cube is created fine when pointed at the Analysis Server but not when a local target is used.

Apologies for the length of post but it explains where I am up to.

Obviously if there is a "create local cube" wizard that I'm missing in AS2005 then I'll be more than happy to abandon the project!

Any help, even if it's book recommendations, would be greatly appreciated.

Thanks,

John.

Follow up:

Sorted the answer myself with a little (OK lot!) of help from a book by Teo Lachev, Applied Microsoft Analysis Services 2005. it uses code so it won't be ideal for everyone but it works and is a lot simpler than trying to work out how XMLA works in AS2005 with local cubes, especially as even xmla.org now seems largely forgotten.

By using the code from the above book you can point the created program to an existing cube created using AS2005 within the BIDS package and output it to a local cube file, very simple.

A big thank you goes out to Teo as days of searching have now finished.

|||John

I'm deeply interested in any solution for creating offline cubes programmatically.

How did you solve your problem?

I managed to create them in general using "CREATE GLOBAL CUBE"-syntax but
I can not ignore processing errors like I can do when using the management console.

Any answer is appreciated

Regards
Klaus Wiesel|||The sample in Teo's book is an application that will build the "CREATE GLOBAL CUBE" command, so it probably will not help you much, there were no options for setting the error configuration. Teo maintains a website at www.prologika.com|||I have put the MDX statment "Create Cube ... " in SQL Agent , and it gives me errors, i want to schedule the creation of the cube , not do it maunally. any help?

No comments:

Post a Comment