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.

image

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.

Tags: , , , , , , , , , ,

This entry was posted on Friday, May 4th, 2012 at 10:44 and is filed under Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


4 Responses to “Access Denied: Run SSMS as Administrator”

  1. Habi says:

    I had this issue and all the solutions online was kind of misleading to my issue. I have the solution here.
    http://dotnet-programming-solutions.blogspot.com/2012/10/attach-database-encountered-operating.html
    The solution was to Run SSMS as Administrator.

Leave a Reply