Wednesday, January 11, 2012

SSAS - Renaming Project /Database

At my new job I am learning about SSAS and cubes. I have created a project to practice what I have learned in my SSAS training course. Since I like to practice on something that may deem to be useful I created my first cube based on the data warehouse developed by my co-worker. While I did not name my project Hello World, I named equally silly: Testcube. At first I didn't think it's silly until I realized that this is an actual project that can be put in to use in production very easily.

So I set out to the task of renaming it. Renaming the project and the database itself was easy enough since no one was using it yet. However, after a while I noticed that the directory it creates is still called testcube. Ok, so users would never see that but I didn't want some rookie DBA or server admin come after me and delete the folder thinking it can't possibly be used.

Upon some research I realized that SSAS databases have names and IDs. At initial creation the 2 are the same. However, while I was successful at changing the name in BIDS, it did not change the ID and apparently the ID is used to name the directory. (Upon my research I also found out that SSIS also uses the ID.)

In SSMS I can see what the ID is but I can't change it. So I was looking around in BIDS. No luck. I, then looked at the files BIDS created. And so the solution was born. Do these steps AFTER you renamed everything you possibly could in BIDS.

1. Close your project if it's open.
2. Rename the .database file to the name. In my case I renamed it from testcube.database.
3. Open the .database file in Notepad and change names in the ID and Name nodes. Save.
4. Open the dwproj file in Notepad and fine the section. Change the Name and Fullpath nodes to refer to the database file in step 3.
5. Delete the SSAS database in SSMS.
6. Open the project in BIDS and redeploy. Note the Name and ID of the database.

And you are done.

In my case since the database was not used yet and it was quick to redeploy, the name and ID change didn't present other barriers. In production, this may not be such as easy matter.