Archive for May 4th, 2012

Access Denied: Run SSMS as Administrator May 4th, 2012

Vinod Kumar

I recently upgraded my machine to Windows 8 and there are so many changes that are worth mentioning as part of security enhancements for SQL Server 2012 and Windows 8 combinations. We will discuss in various blogs in the future, but here is one of the question I got from one of my ASP.NET developer that after he upgraded he started getting this below error for attaching an existing database.


Textually the error is something like:

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server ‘xxxxxx’.  (Microsoft.SqlServer.Smo)


Unable to open the physical file "C:\SQLSamples\AdventureWorks2008R2_Data.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)


Worst was, the link for help from SSMS was also not getting him anywhere. Here are the sequence of things that I asked:

  1. Which OS are you running Windows 7 or Windows 8? Ans: Windows 8
  2. Has UAC been turned off or on? Ans: Off (asked why … but that is a different discussion)
  3. Great, did you start SSMS in Administrator mode and try? Ans: Well, UAC is off right? Then why should I.
  4. Me: Trust me :)
  5. Ans: Woala, it is now working.

The solution is not specific to Windows 8 but can be on Windows 7 too, tough it will be interesting to see how we have made “Security by default” more restrictive on Windows 8. Simple solutions for simple tasks :)

Do tell me if you have encountered this. Hope this helps.

Continue reading...