Last post Jan 04, 2017 10:53 AM by Chris Zhao
Jan 03, 2017 09:23 PMemail@example.com|LINK
Someone gave me a .bak copy of the database. I tried to attach that database to my server and it keeps giving me an error saying "Db1.bak" is not a primary database file. I tried to change the extension of the database file to .mdf and then it gave me the
same error saying C:\Databases\db1.mdf is not a primary database file(Microsoft sql server Error 5171).
I also tried to right click on the database and selected Restore database. I selected "Device" and pointed to my backup file and then I choose the Database name, but the OK button the bottom of the Restore database dialog does not get highlighted. I don't
know how to do this sql server 2012.
Any help will be greatly appreciated.
Jan 03, 2017 09:27 PM|AZMatt|LINK
During the restore, you select the file from "Device"... it usually has a checkbox beside it that you have to check before the button will get enabled.
Jan 04, 2017 08:18 AM|eralper|LINK
Please check following SQL tutorial on
Restore Database from Backup File in SQL Server 2012
I just one to note, mdf files are primary data files.
ndf files are secondary.
ldf files are log files.
Jan 04, 2017 10:53 AM|Chris Zhao|LINK
Take a look at https://msdn.microsoft.com/en-us/library/ms177429(v=sql.110).aspx. This topic explains how to restore a full database backup.