How do I reattach my databases?

  • Yesterday I went through the process of replacing an old, failing hard drive, out of my Windows 10 Pro machine. I replaced it with an SSD. It gives my old desktop another couple years of use, I hope. 🙂

    I had SQL Server Developer Edition on a second hard drive. Naturally the .MDF and .LDF files are still in my D:\Databases folder. I've downloaded SQL Server 2019 Developer Edition and SSMS  18.5. I just tried to attach the .MDF, but that didn't work. Here's the error:

    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:\Databases\JobSearch.MDF'. (Microsoft SQL Server, Error: 5123)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=15.00.2000&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476

    I've gone to the link but, well, it wasn't much help. So, how do I resolve this?

    Rod

  • I would swear I've seen this before. I think I solved it by running SSMS as local administrator, and it will work. Right-click SSMS, click 'Run as administrator' and then try it.

  • Boom, you nailed it, thank you!

    Rod

Viewing 3 posts - 1 through 2 (of 2 total)

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