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
-
Where are the database files located? Add the filepath(s) to your question.Mark Storey-Smith– Mark Storey-Smith2012年12月11日 16:06:39 +00:00Commented Dec 11, 2012 at 16:06
-
What kind of authentication are you using?mdoyle– mdoyle2012年12月11日 16:30:52 +00:00Commented 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– James2012年12月11日 16:32:57 +00:00Commented Dec 11, 2012 at 16:32
-
2Based 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– Martin Smith2012年12月11日 17:04:56 +00:00Commented 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.Ali Razeghi - AWS– Ali Razeghi - AWS2012年12月11日 17:41:13 +00:00Commented Dec 11, 2012 at 17:41
1 Answer 1
It looks like MS has seen this already. Have you tried running SSMS through Right Click - Run As Admin?
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.
-
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– James2012年12月12日 13:04:20 +00:00Commented Dec 12, 2012 at 13:04