restore from command line

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Corcoran

    restore from command line

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

    Thanks, Tom.
  • Simon Hayes

    #2
    Re: restore from command line

    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

    Comment

    • Tom Corcoran

      #3
      Re: restore from command line

      Simon Hayes wrote:[color=blue]
      > 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[/color]


      Thanks for that.

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

      Works great.

      Tom.

      Comment

      Working...