It is possible for the tabular designer to get into an error state. If you try to save the model, you can get this error message: “Unable to save the file Model.bim. Reason: The file cannot be saved because it is marked as readonly.”

image

Most of the time, you see this error if the tabular designer has lost the connection to the workspace database server at some point during the editing session. This can happen if the workspace database server is restarted or if the network connectivity is lost. We did not have time in Denali to implement any sort of retry logic here, so once the connection is lost the editing session is over.

I think the only other way to get to this state is after a bug has happened. If you see this error in other conditions, file a bug on Connect.

Don’t be too scared of this error message. There is a way to recover the work you did since the last save of the model, even though you can’t just press Ctrl+S to save the file. The workspace database holds the latest copy of all edits you have made since last save. All you have to do is create a new BIM file from the workspace database, and you’re good to go.

The safest way to recover your work is as follows:

  1. Keep your read only model open in VS.
  2. Open SSMS.
  3. Right click the workspace database you want to recover, script CREATE to a new window.
  4. Change the database name and ID (they must match), execute the script. You have now cloned the workspace database.
  5. Go back to BIDS. File->New Project. Select Import from Server (Tabular) as the project type.
  6. Select the database you created in step 4. OK

A new BIM file is created with all the changes you have made since you last changed the old BIM file. Simply discard the old BIM file/project and continue using this new project. You have now recovered your work.

To be perfectly honest, I have known about this file saving issue for well over a year and never come up with this recovery strategy until a customer call this week. I managed to recover the user’s changes on the fly and look like a hero. My next thought was crap, how come I never thought of this before! I used to tell people that their changes were irretrievably lost when they saw this error message. My sincerest apologies to those people that dropped their data based on my previous advice. Hopefully you will all read this post and save your data next time.