Avatar of AJS_Developer
AJS_Developer
 asked on

SQL Server 2008 EXPRESS Error attaching database

Hi,

I recently formatted my HDD and installed Windows 7. Then I re-installed SQL Server 2008 Express. Then I went to attach a database which I had detatched before formatting my HDD. I now get an error:

Unable to open the physical file "<file location>". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)

After I got the error I tried:

Running the SQL Server service with the NETWORK SERVICE, LOCAL SERVICE and my own personal log ons, all of which I made sure had full control privileges of the file.

Logging on to SQL Server Management Studio with the SA account before attempting the attach, which definitely uses the SYSADMIN role.

None of these worked.

Ideas?

Thanks in advance!
Microsoft SQL ServerMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
Dustin_Loftis

8/22/2022 - Mon
Nick_Australia

Make sure you run SQL Server Management Studio as Administrator (Right Click - Run as Administrator)

Apart from that, a few helpful pointers here:
http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/ad2b2e0d-aecb-4f95-89a8-04dd27ac4944/

I usually avoid detach and attach and prefer to create a new DB and restore from backup. That's personal preference and some people would say otherwise.



ASKER CERTIFIED SOLUTION
Dustin_Loftis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck