I’ve been playing around with a PowerShell module called RunSyncRun that I’ve never quite got around to completing. What it aims to do is to execute the sync function between SSAS Databases. Part of the problem is that it takes a while to get a test environment set up, but I finally got the WideWorldImporters sample project up and running as a good place to start.
The crux of the whole module is to run this relatively small piece of xmla found in StartDatabaseSync -
<Synchronize xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"> <Source> <ConnectionString>Provider=MSOLAP.8;Data Source=ASGLH-WL-15336\AIUI;Integrated Security=SSPI;Initial Catalog=WideWorldImportersMultidimensionalCube</ConnectionString> <Object> <DatabaseID>WWI-SSASMD</DatabaseID> </Object> </Source> <SynchronizeSecurity>CopyAll</SynchronizeSecurity> <ApplyCompression>true</ApplyCompression> </Synchronize>
But what’s really thrown me, despite having used this Sync process for years now, is that it is not database name, but rather database id that is used to find the object to sync. And if no database with that id is found, ten it does not throw an exception, it just carries on as if nothing has ever happened. And what I’ve always done, for every SSAS database I;ve ever used, is have the name and hte id identical. Sadly as you cna see form the example sync script above, this is not the case for WideWorldImporters.
AIUI, there is no way to alter the id, even if you were to re-deploy, because naturally the id has changed and so it is treated as a different database. You cannot alter the id on a detach/attach. I’ve tried fiddling around with the folder names and identities in hte databse, but so far I can’t get it to work. You can however rename the database to match the ID, so that is something I suppose?
There might be a way to alter the id, idk, I’ve spent more time on this than I wanted to.