Home > Archive > Microsoft SQL Server forum > April 2005 > restore from command line









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author restore from command line
Tom Corcoran

2005-04-22, 7:23 am

I want to restore a backup copy of a database from the command line. Can
this be done?

Thanks, Tom.
Simon Hayes

2005-04-22, 7:23 am

You can use osql.exe - something like this:

osql.exe -S MyServer -E -Q"restore database MyDB from ..."

See osql and RESTORE in Books Online.

Simon

Tom Corcoran

2005-04-26, 7:23 am

Simon Hayes wrote:
> You can use osql.exe - something like this:
>
> osql.exe -S MyServer -E -Q"restore database MyDB from ..."
>
> See osql and RESTORE in Books Online.
>
> Simon



Thanks for that.

osql.exe -S MyServer -E -Q"RESTORE DATABASE MyDB FROM disk = '\\MyServer
\my Backups\the backup'"

Works great.

Tom.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com