Osql Restore

  • can any one help to fix this error while i my trying to restore a remote database with a backup file with a name of "xx.bak"

    C:\>osql -S <Servar1>-U sa -P -Q "Restore database xx from disk='\\Servar2\test\xx.bak'"

    Msg 3201, Level 16, State 2, Server VENIRE-15, Line 1

    Cannot open backup device '\\192.168.1.69\test\xx.bak'. Device error or device

    off-line. See the SQL Server error log for more details.

    Msg 3013, Level 16, State 1, Server VENIRE-15, Line 1

    RESTORE DATABASE is terminating abnormally.

  • It may be a permissions issue... whoever you're logged in as may not have permissions to see '\\Servar2\test\xx.bak'.  Try pasting that UNC into Windows Explorer (then hit CR, of course).  If it comes back with a not found, then your login doesn't have permission to see that folder.  Same may be true for the server... it may not have permission to see that folder.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Note the difference between sequrity environment for your account (running Windows Explorer), account started SQL Server (running Osql) and account started SQL Agent (running Osql if you call it from a job).

    _____________
    Code for TallyGenerator

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply