This is for my own benefit… when restoring a .bak file to a SQL Server database where the .bak file was not originally backed up from, right click –> All Tasks –> Restore Database –> From device –> Select Devices –> Add your .bak file. Click OK. Click the Options tab. Now on the left side you should see the Logical file name of the database from the .bak file. On the right side under the lable ‘Move to physical file name’, should be the path that the .bak file originally existed as. This field needs to be changed to the path & file name of the database you’re restoring too. After modifying those two fields, check the ‘Force restore over existing database’ and click ‘OK’.
What’s Going On Here?
My name is Aaron Johnson and I created this blog both for me (mostly) and sometimes you. I've been saving mydeliciouspinboard.in links here and blogging since 2002. During the week (and at night and some weekends and well.. most of the time), I work in engineering at Jive Software. When I'm not working, I'm hanging out with my amazing wife, ourdinosaurStar Wars loving son and four chickens in the burbs outside of Portland, Oregon.See Also
Monthly Archives
- May 2012 (1)
- April 2012 (5)
- March 2012 (5)
- February 2012 (9)
- January 2012 (9)
- December 2011 (10)
- November 2011 (6)
- October 2011 (6)
- September 2011 (5)
- August 2011 (5)
- July 2011 (8)
- June 2011 (13)
- May 2011 (3)
- April 2011 (10)
- March 2011 (6)
- February 2011 (2)
- January 2011 (4)
- December 2010 (8)
- November 2010 (12)
- October 2010 (9)
- September 2010 (6)
- August 2010 (4)
- July 2010 (8)
- June 2010 (9)
- May 2010 (4)
- April 2010 (9)
- March 2010 (6)
- February 2010 (9)
- January 2010 (10)
- December 2009 (10)
- November 2009 (10)
- October 2009 (6)
- September 2009 (10)
- August 2009 (13)
- July 2009 (12)
- June 2009 (11)
- May 2009 (8)
- April 2009 (4)
- March 2009 (7)
- February 2009 (2)
- January 2009 (3)
- December 2008 (4)
- November 2008 (7)
- October 2008 (10)
- September 2008 (6)
- August 2008 (7)
- July 2008 (9)
- June 2008 (15)
- May 2008 (9)
- April 2008 (10)
- March 2008 (8)
- February 2008 (6)
- January 2008 (15)
- December 2007 (10)
- November 2007 (9)
- October 2007 (6)
- September 2007 (9)
- August 2007 (12)
- July 2007 (9)
- June 2007 (6)
- May 2007 (8)
- April 2007 (10)
- March 2007 (14)
- February 2007 (12)
- January 2007 (17)
- December 2006 (11)
- November 2006 (11)
- October 2006 (8)
- September 2006 (11)
- August 2006 (14)
- July 2006 (11)
- June 2006 (13)
- May 2006 (11)
- April 2006 (8)
- March 2006 (5)
- February 2006 (7)
- January 2006 (8)
- December 2005 (6)
- November 2005 (6)
- October 2005 (9)
- September 2005 (3)
- August 2005 (11)
- July 2005 (12)
- June 2005 (11)
- May 2005 (4)
- April 2005 (5)
- March 2005 (8)
- February 2005 (5)
- January 2005 (3)
- December 2004 (6)
- November 2004 (7)
- October 2004 (4)
- September 2004 (9)
- August 2004 (5)
- July 2004 (10)
- June 2004 (12)
- May 2004 (4)
- April 2004 (13)
- March 2004 (10)
- February 2004 (9)
- January 2004 (13)
- December 2003 (8)
- November 2003 (9)
- October 2003 (17)
- September 2003 (28)
- August 2003 (21)
- July 2003 (24)
- June 2003 (31)
- May 2003 (43)
- April 2003 (30)
- March 2003 (48)
- February 2003 (45)
- January 2003 (43)
- December 2002 (28)
- November 2002 (30)
- October 2002 (34)
- September 2002 (41)
- August 2002 (35)
- July 2002 (20)
- June 2002 (1)
Thanks for the 2003 May 14th “Restoring a .bak file to a SQL Server database” entry … that saved me a lot of work.
I also needed to execute about a hundred
“EXEC sp_changeobjectowner ‘foo.table_x’, ‘bar’”
but I finally got there.
Cheers,
– Eric Herman
Thanks. That was useful….
Good man!
Cheers for writing that SQL from .bak procedure, saved me time too.
This was very helpful. Saved me a lot of time.
Thanks
Larry is right.Site is very helpful.
This helped us too! Thanks a bunch!
Thanks a lot, it helped us a lot.
Thanks, was very helpful.
Thank you – Just what I needed!
I was about to give up on this restore and start executing hundreds of SQL commands until I read this blog entry. Appreciate the heads up.
thanks for the help, this was quick and easy to find thanks to google =]
Thank You. It was just what I needed
Great tip! Made life simple.
dude- this was the first google hit and was the one that did the job- THANKS!
WOW — thank you.. I was about to give up, as well.
Good trick.
i got stuck up doing this simple procedure, thanks for putting it up on here!
Nice Post – Gave me the exact infp I needed. Thanks
This is exactly what I needed. Just need to figure out why users can’t connect to the new sql server now.
Jason wrote:
This is exactly what I needed. Just need to figure out why users can’t connect to the new sql server now.
I’m encountering the same issue here…
This was really helpful. Saved me a lot of time.
thanks a lot.
Hi all – i have a sql .bak file of a sql server database. It won’t open in access. Will anything open this? THanks much!
What a simple and uncomplicated set of steps. Brevity is so underappreciated.
Many thanks
Thanks for the SQL instructions for restoring a SQL.bak file….
I’m new to all this SQL stuff and finding this sort of hands-on info is nearly imposible…
Thanks again…
top explanation. cheers nig
Excellent explanation as i forgot being so long since i restored a data base, top marks!
Very helpful, thanks a lot.
I am getting the deactivation error. The backup I made is from a different machine in D:\Program Files\Microsoft SQL Server\MSSQL\data\navdbsIBS.mdf and navdbsIBS.ldf. In my machine, the database is stored in C:. I followed the steps mentioned above but I am getting the deactivation error. It says the .mdf and .ldf files are incorrect , Use WITH MOVE to identifiy a valid location for the file.
Can anyone tell give me some input?
Wow, excellent help. Saved me a lot of time because it works. Thank you!!
Thx dude
This small walk through saved me tonight. Thank you!
Sweeeet !!! And on 50% less caffeine… Impressive !!!
Thanks, i’ve been messing with these errors until I typed in Google exactly what I wanted to do…
restore database from bak file
and got your site. Thanks again. You rule.
Thanks mate for the quick help. This is what I was looking for and it worked
Cheers,
Vijay
Brief and useful. Just what I was looking for..
This is Intresting.
Well can you suggest If I dont want to create the DB First. I am asking this as You can type the DB name in the Dropdown of the “restore to” on the Restore wizard
thanks Any ways.
Excellent work !!!
Hi
the article to restore database johnson worked lik a charm.
Cheers…
Yes, just like everyone else, thank you thank you thank you. I kept encountering an error, until I did a quick google, and you saved the day.
Have a good one.
Cheers,
Charles A.
We switched servers and didn’t realize our database was still being read from the old server. I have the .bak files but there are seven , each dated. When you restore the file, would it be all of them to restore or just the latest one? Also, would you need Enterprise Manager to restore your database w/ the .bak file and how long is that process approximately? Thank You!
A note – the name for the new mdf file has to be different than the existing mdf file for this to work.
WHERE do you right-click? I don’t get that option when I click on a db in my application. I am using MS SQL Maestro and I’m stuck trying to restore some dropped tables from a .BAK file.
So sad.
THANK YOU.
Awesome man, thanks!!!