Access Denied error when trying to attach AdventureWorks2012 .mdf file

  • Hi,

    I got the "Unable to open the physical file AdventureWorks2012_Data.mdf. Operating system error 5: "5(Access is denied.)" error too.

    Turned out that I was logging into SQL Express using a SQL account (sa, in fact). So I logged in using my Windows account (select "Windows Authentication" when starting up SQL Server Management Studio). This still gave the access denied error. However, when ran SQL Server Management Studio as an Administrator (right click the icon and Run As Administrator), it finally worked!

    A further point that I'm not sure whether it made a difference or not. After downloading the .MDF file, rt-clicking it and selecting Properties said that it was "Blocked" as a file downloaded from external source. I clicked the Unblock button - not sure if this did anything because I it was just part of the general messing about to try to get it to work...

  • What worked for me was: Paste your .mdf file and ldf file in this directory - C:\Program Files\Microsoft SQL Server\MSSQL11.SS2012\MSSQL\DATA

    Found the solution here: http://stackoverflow.com/questions/19060441/cannot-install-adventureworks-2012-database-operating-system-error-5-access-i

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply