16,755 pts.
 How do I restore my SQL .bak file over the existing database?
How do I restore my SQL .bak file over the existing database? Do I need to delete what is there already? On a new Windows installation I need to restore our production SQL database from a .bak file. What steps do I need to take? Can I overwrite data or do I need to restore to a fresh database?

Software/Hardware used:
SQL
ASKED: July 13, 2010  5:31 PM
UPDATED: July 14, 2010  10:31 PM

Answer Wiki:
You can just restore it over the existing database. When you have the restore window open, just check the Overwrite database check box on the advanced tab.
Last Wiki Answer Submitted:  July 13, 2010  6:20 pm  by  Denny Cherry   64,505 pts.
All Answer Wiki Contributors:  Denny Cherry   64,505 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You can add the “replace” in the sql like this:

RESTORE DATABASE FROM DISK = N’D:SQLDataAdventureWorks.bak’
WITH
FILE = 4,
MOVE N’AdventureWorks_Data’
TO N’D:SQLDataDBDataAdventureWorks.mdf’,
MOVE N’AdventureWorks_Log’
TO N’D:SQLDataDBLogAdventureWorks.ldf’,
NOUNLOAD,
REPLACE,
STATS = 10
GO

 585 pts.