1

I am using SSAS on SQL Server 2008r2. I have a backup file "test.abf" and use the following code (from the Microsoft.AnalysisServices.Server namespace) to restore the database backup.

using (var server = new Server())
{
    server.Connect(connectionString);
    server.Restore(new RestoreInfo
        {
            File = backupLocation,
            AllowOverwrite = true,
            DatabaseName = dbName,
            Security = RestoreSecurity.IgnoreSecurity,
         });
}

Where backupLocation is a network share that points to test.abf, and dbName is "test". The SSAS user has Full Control to both the share and NTFS.

I get the following exception:

Processing \localhost\junk\test.abf failed'. Exception message 'Backup and restore errors: The database with name '', ID '' cannot be restored since it already exists on the server and is read-only.

Using SQL Server Management Studio to restore the db over the same share location works fine. There is no database with the name or ID ''. I have checked so it seems evident that the error message is at best misleading, so I'm kind of stuck as to what to try next.

Any suggestions?

Edit

backupLocation == "\\localhost\junk\test.abf"
dbName == "test"
File.Exists(backupLocation) == true

Command Begin:

<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
      <File>\\localhost\junk\test.abf</File>
      <DatabaseName>test</DatabaseName>
      <AllowOverwrite>true</AllowOverwrite>
      <Security>IgnoreSecurity</Security>
    </Restore>

<PropertyList xmlns="urn:schemas-microsoft-com:xml-analysis">
      <LocaleIdentifier>1030</LocaleIdentifier>
    </PropertyList>

Audit Backup/Restore Event:

<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
      <File>\\localhost\junk\test.abf</File>
      <DatabaseName>test</DatabaseName>
      <AllowOverwrite>true</AllowOverwrite>
      <Security>IgnoreSecurity</Security>
    </Restore>

Command End:

<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
      <File>\\localhost\junk\test.abf</File>
      <DatabaseName>test</DatabaseName>
      <AllowOverwrite>true</AllowOverwrite>
      <Security>IgnoreSecurity</Security>
    </Restore>

Also the user running the Restore request has admin priviledges.

Additional Info

For reference (and further frustration), here is the Command Begin from the manual restore (which works):

<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
      <File>\\localhost\junk\test.abf</File>
      <DatabaseName>test</DatabaseName>
      <AllowOverwrite>true</AllowOverwrite>
      <Security>IgnoreSecurity</Security>
    </Restore>

<PropertyList xmlns="urn:schemas-microsoft-com:xml-analysis">
      <Timeout>0</Timeout>
      <SspropInitAppName>Microsoft SQL Server Management Studio</SspropInitAppName>
      <LocaleIdentifier>1030</LocaleIdentifier>
      <ClientProcessID>3124</ClientProcessID>
    </PropertyList>
2
  • Please include the full path of backupLocation and dbName it displays during run-time as a edit to your question. Jan 20, 2014 at 16:20
  • 1
    I would use SQL Server Profiler to track down what happens. You can find it in the Start Menu at All Programs/Microsoft SQL Server 2008 R2/Performance Tools. Create a new trace accessing your Analysis Services Server. You can leave the default settings. After you have started the profiler trace, re-try the restore action, and halt the tracing after the error occurred. You will see among other entries a Command Begin and a Command End event containing the XMLA that starts the restore. Hopefully you will also find some more details for the error between these two.
    – FrankPl
    Jan 20, 2014 at 16:55

1 Answer 1

0

Ok. So it turns out the User running the Restore command did not have Admin rights on SSAS after all, only on SQL Server (which apparently isn't even necessary). So if anyone else gets this strange message in the future, just read it like "You do not have the proper permissions to do this", rather than that other one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.