Recovery of mdf files from external drive

  • I replaced the spin drive in my laptop to a ssd drive. My son was helping me and had a limited amount of time, so I didn't back up my files. I just kept the spin drive intact and have it in a toaster to read.

    I was running sqlserver 2012 and have a few files that I ues. I thought while I am doing a fresh install, I just as well get the latest sqlserver. I loaded Sqlserver 2016 and went looking for the files on my spin drive. I found the files, but didn't know how to load them in sqlserver 2016. From what I read online, I can't just copy the files from the spin drive to the ssd, especially changing versions. Since this was a completely fresh install, I went back to a restore point before the sqlserver installation and am starting all over. I plan to install 2012 again. Once I install 2012, is there a way I can move the mdf files from the spin drive back to the ssd drive? Thanks

  • did you not try attaching them? (Don't forget the log files).

  • How do I attach them? Is there a resource I can see to do that? I am pretty much lost here?? Thanks

  • There is no problem attaching the SQL Server 2012 databases to the SQL Server 2016 instance, but once attached it cannot be reverted back to SQL Server 2012. Simply create the appropriate folders on the SSD, copy the data and log files to the folders and then attach to the SQL Server 2016 instance via the SSMS GUI.

    The SQL Server Service credentials must be given the appropriate permissions to the data and log folders.

    If you are reverting back to SQL Server 2012, then do the same, copy the files from the spinner to the SSD and attach via SSMS.

    😎

  • Open SSMS.

    Right-click the Databases folder in Object Explorer. One of the options is ATTACH. It should prompt you for file locations of the data and Log files

  • You can just move them from the HDD to the SSD. Make sure you move the MDF, LDF, & any NDF (if you have any filegroups or other secondary files created) to the appropriate destination.

    Once you attach the MDF, SQL Server will tell you all the files you need to attach. The hardest part is finding all the files, but if you don't have much then you should be fine.

  • Success!!! Thanks to all of you who responded to my question. First I decided to remove Sql Server 2016 which I had just installed and install 2012 to use the same version. This didn't work out too well since there were still ghosts of sql server past (2016). Also when I installed Win10, I didn't pay attention when the installation gave my computer a really bad name. I decided to re-install Windows for a fresh install since I didn't have many programs on it.

    I reinstalled Windows and gave my computer the same name that it had when I was using a spin drive. Then thanks to Sscertifiable, I reinstalled Sql Server 2016. Then I copied my .mdf and .ldf files and attached them The data is there and a VB program that I wrote reads and writes to the sql server table.

    It was easier than I thought and thanks and thanks again. This issue is resolved.

    Carroll

  • Congrats, good stuff and you are most welcome.

    😎

Viewing 8 posts - 1 through 7 (of 7 total)

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