Solved

SQL Script to restore MSSql 2005 Database

Posted on 2009-05-19
3
315 Views
Last Modified: 2012-05-07
Hi All
I'm looking for a script that will restore (and overwrite) Ms sql server 2005 database from backup file. Basically I've got two identical databases in two location (one works as backup) and I transfer backup files over night and restore them next day. It would be nice to have a script that will restore them automatically.

Please advise
0
Comment
Question by:fortres
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24423040
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24423073
<< and I transfer backup files over night and restore them next day. >>

If you would be doing the file transfer then if you specify a standard file name for the backup file, then you can

1. Save the script provided above as a *.sql file
2. Using Windows scheduler you can execute this sql file using SQLCMD scripts.

Automation is done.
0
 

Author Comment

by:fortres
ID: 24423305
Thanks for advise - I did as you said rrjegan17 but intead of windows scheduler I've used SQL server Agent and it also works fine -thanks again
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question