Wednesday, October 22, 2014

dbmdl could not be created, Internal Error: Ese could not be initialized

Lately I've been getting the error "DBMDL file could not be created, it might be locked by another application ... DBMDL file could not be created, it might be locked by another application" when opening database projects in Visual Studio 2013.


I started getting the following error whenever I'd open a database project in Visual Studio 2013 and Visual Studio 2012.  It didn't matter if it was a new project or an old, existing project.  The error always looked something like this:


The message indicated that the:

"DBMDL file could not be created, it might be locked by another application".  

It went on to say

"Internal Error: Ese could not be initialized. ; No such database"

I found a bunch of articles involving this error message, but none of the fixes worked.  A few extra details pertaining to my particular circumstances:
  • I'd previously opened the database projects successfully on my computer.
  • I'd switched profiles on my Windows 7 computer recently.
  • I was running SQL Server 2008 R2 Express Edition
I went back and used a different profile on the same computer.  With the old profile I could successfully open database projects.  This led me to believe it wasn't the current installations of VS or SQL Server on my PC.  It also led me to believe that the problem was related to my current profile.

Solution:
I checked the Temp directory first.  I changed my local TEMP and TMP user environmental variables to point to D:\Temp rather than the default location of %USERPROFILE%\Local Settings\Temp. This fixed my problem, but I don't know why.

I have to assume it's something related to permissions, but I see that my current account has full read/write permissions on my profile's Temp folder.  My account is also a local administrator.  I've fiddled with the permissions on my profile's temp folder, but I still get the error when I point my TEMP and TMP variables back to that location.

So, for now, I've left my TEMP and TMP variables pointed to a new location.  I'm still not sure why this fixes the problem.  However, this error has started popping up for several colleagues recently and the Temp directory update has resolved the issue for them too.

1 comment:

  1. The problem with the following directory is that it's a Protected folder:
    %USERPROFILE%\Local Settings\Temp

    You can change the Temp directory to something that's not protected, it will fix the issue. This path is the same folder, but it's not protected.
    %USERPROFILE%\AppData\Local\Temp

    ReplyDelete