Solved

SQL Script to restore MSSql 2005 Database

Posted on 2009-05-19
3
296 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

815 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now