3

Had three databases connected to SQL server 2012, unfortunately, now I can't see any of them under the Databases part of the tree in SQL Server Management Studio. The files (.mdf) are still on the disk, but when I try to reconnect them, I get this error once I click on the mdf file,

Failed to retreive data for this request (Microsoft.SqlServer.Management.Sdk.Sfc) Additional information An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) The server principal "IESVE\user" is not able to access the database "model" under the current security context (Microsoft SQL Server, Error: 916)

I thought this might be a problem with the management studio, but when I try to connect via ADO, I get this error, [DBNETLIB][ConnectionOpen(Invalid Instance())] Invalid Connection

All of this worked before and the only thing I can think of is a recent windows update.

If anyone's got any ideas on how to fix/diagnose this, I would be very grateful, Thanks James

Edit; Running as administrator gets me a bit closer to reattaching the databases, but now I have this error SQL error message . I'm wondering if my SQL server version has been downgraded, judging by that error message.

Thanks, James

5
  • Where are the database files located? Add the filepath(s) to your question. Commented Dec 11, 2012 at 16:06
  • What kind of authentication are you using?
    – mdoyle
    Commented Dec 11, 2012 at 16:30
  • The files are all located locally on my machine, and I'm just using Windows Authenication. Thanks for taking the time to read this,
    – James
    Commented Dec 11, 2012 at 16:32
  • 2
    Based on the error message it looks as though you are connecting to the wrong instance of SQL Server (2005 not the 2012 instance). Commented Dec 11, 2012 at 17:04
  • Updated my answer with new info for you to check out after you updated your findings by running as admin. Commented Dec 11, 2012 at 17:41

1 Answer 1

1

It looks like MS has seen this already. Have you tried running SSMS through Right Click - Run As Admin?

http://connect.microsoft.com/SQLServer/feedback/details/198005/not-able-to-access-the-database-model-under-the-current-security-context-microsoft-sql-server-error-916

Also are you logging in as a sysadmin to SQL Server? Do you have create DB rights?

Edit: Just saw your original post updated. It looks like you are restoring to the wrong version for sure. Consider yourself lucky if that is the issue!!

Do a SELECT @@SERVERNAME. What does it return? Is that the right instance? Probably not (hopefully). Try your restore script only after SELECT @@SERVERNAME returns the right info. Also you might want to use OSQL where you have to state the server name and creds before connecting, that way you know you're at the right one instance.

1
  • Ah, there were two instances of SQL server running on my machine, one was a 2005 and the other 2012. Stopped the 2005 SQLExpress version, restarted the 2012 MSSQLSERVER version and everything's back. Thanks for all the help.
    – James
    Commented Dec 12, 2012 at 13:04

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.