Aaron Johnson Now with 50% less caffeine!

Posted
14 May 2003 @ 9am

Tagged
Systems Administration

Restoring a .bak file to a SQL Server database

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’.


44 Comments

Posted by
Eric Herman
6 November 2003 @ 5pm

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


Posted by
Venkata Sridhar A.
13 February 2004 @ 8am

Thanks. That was useful….


Posted by
Jason Sumner
30 April 2004 @ 11pm

Good man!


Posted by
Abdul
24 September 2004 @ 10am

Cheers for writing that SQL from .bak procedure, saved me time too.


Posted by
Larry
4 November 2004 @ 4pm

This was very helpful. Saved me a lot of time.

Thanks


Posted by
Jim
15 December 2004 @ 6am

Larry is right.Site is very helpful.


Posted by
Matt McCabe
3 January 2005 @ 7pm

This helped us too! Thanks a bunch!


Posted by
Jose Martinez
18 May 2005 @ 5pm

Thanks a lot, it helped us a lot.


Posted by
Ashu
15 June 2005 @ 8am

Thanks, was very helpful.


Posted by
Tom
22 July 2005 @ 1am

Thank you - Just what I needed!


Posted by
beaudetious
26 August 2005 @ 10am

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.


Posted by
aroon
30 August 2005 @ 9pm

thanks for the help, this was quick and easy to find thanks to google =]


Posted by
Sastry
8 September 2005 @ 12pm

Thank You. It was just what I needed


Posted by
Girish
15 September 2005 @ 8am

Great tip! Made life simple.


Posted by
geneo
27 September 2005 @ 1pm

dude- this was the first google hit and was the one that did the job- THANKS!


Posted by
ronald
20 October 2005 @ 12pm

WOW — thank you.. I was about to give up, as well.


Posted by
Jon
20 October 2005 @ 5pm

Good trick.


Posted by
mayur
31 October 2005 @ 3pm

i got stuck up doing this simple procedure, thanks for putting it up on here!


Posted by
robg
4 December 2005 @ 3pm

Nice Post - Gave me the exact infp I needed. Thanks


Posted by
jason
10 December 2005 @ 5pm

This is exactly what I needed. Just need to figure out why users can’t connect to the new sql server now.


Posted by
CodeCaster
12 December 2005 @ 10am

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…


Posted by
Tina
16 December 2005 @ 4am

This was really helpful. Saved me a lot of time.

thanks a lot.


Posted by
Gail
8 February 2006 @ 7pm

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!


Posted by
Shoba
21 February 2006 @ 10am

What a simple and uncomplicated set of steps. Brevity is so underappreciated.

Many thanks


Posted by
Lee
21 February 2006 @ 3pm

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…


Posted by
nigel
21 March 2006 @ 5pm

top explanation. cheers nig


Posted by
mark
24 March 2006 @ 6pm

Excellent explanation as i forgot being so long since i restored a data base, top marks!


Posted by
healy
5 April 2006 @ 4pm

Very helpful, thanks a lot.


Posted by
Srinivasa
11 April 2006 @ 12pm

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?


Posted by
A144
8 May 2006 @ 1pm

Wow, excellent help. Saved me a lot of time because it works. Thank you!!


Posted by
Jesper
12 May 2006 @ 7am

Thx dude


Posted by
Mike
19 October 2006 @ 6pm

This small walk through saved me tonight. Thank you!


Posted by
jimmyc
2 November 2006 @ 11am

Sweeeet !!! And on 50% less caffeine… Impressive !!!


Posted by
Mike
23 November 2006 @ 2am

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.


Posted by
Vijay Bhatter
4 December 2006 @ 3am

Thanks mate for the quick help. This is what I was looking for and it worked :)

Cheers,
Vijay


Posted by
Sangeeta Sharma
11 December 2006 @ 10am

Brief and useful. Just what I was looking for..


Posted by
Amol Wankhede
3 January 2007 @ 5pm

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.


Posted by
Sutha
3 January 2007 @ 10pm

Excellent work !!!


Posted by
joshua
18 February 2007 @ 9pm

Hi
the article to restore database johnson worked lik a charm.

Cheers…


Posted by
ChUckLeS
19 March 2007 @ 12pm

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.


Posted by
Clarisa
24 April 2007 @ 9am

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!


Posted by
Thomas STratton
4 May 2007 @ 6am

A note - the name for the new mdf file has to be different than the existing mdf file for this to work.


Posted by
NN
29 August 2007 @ 1pm

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.


Posted by
jeff
24 September 2007 @ 5pm

Awesome man, thanks!!!