467,915 Members | 1,237 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

How to restore a database through command prompt


I have a MS SQL database backup file kept at location "c:\backup_20Aug08.bak". I want to restore the database through command prompt. I am going to create batch file out of these dos commands. So that the restore process will be automated. I am using SQL express edition. Can anybody help me to guide on this?

Thanks in advance,
Oct 29 '08 #1
  • viewed: 3221
1 Reply
Expert 2GB
Am not sure if that would be possible, I mean if DOS batch file alone.

You could use OSQL to connect to SQL server and RESTORE from your backup. Setup a schedule on your OS to run this in specific time or frequency.

Or you can do it the other way, create a stored proc that will restore these backup and schedule it as daily running job. You can also set notification emails for success or failed restore.

Happy Coding!

-- CK
Oct 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Tim Morrison | last post: by
9 posts views Thread by GL | last post: by
11 posts views Thread by Chris | last post: by
4 posts views Thread by africantract | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.