Solved

SQL Script to restore MSSql 2005 Database

Posted on 2009-05-19
3
272 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
Comment Utility
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
Comment Utility
<< 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

11 Experts available now in Live!

Get 1:1 Help Now