Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question
    
Where are the database files located? Add the filepath(s) to your question. –  Mark Storey-Smith Dec 11 '12 at 16:06
    
What kind of authentication are you using? –  mdoyle Dec 11 '12 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 Dec 11 '12 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). –  Martin Smith Dec 11 '12 at 17:04
    
Updated my answer with new info for you to check out after you updated your findings by running as admin. –  Ali Razeghi Dec 11 '12 at 17:41
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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 Dec 12 '12 at 13:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.