Ghost in the machine?

  • Hi all,

    Bit of a weird one...

    I've got an automated script which restores a database to a SQL server 2008 R2 instance.

    Works as expected.

    However, looking at the last run and the db has restored - which I wasn't expecting. Looking into the source directory and the .bak file isn't visable. I've checked the permissions on the directory and see no reason why I shouldn't be able to list the files within.

    Also checked the parent folder for size on disk and it's zero.

    Checked in SSMS and sure enough, the .bak file is visible when navigating to the directory in the restore db GUI.

    What's going on?!

    Rich

  • Found the issue!!

    User error 🙁

    My automated script was calling SQLCmd which connects to a remote machine to perform the restore - the path it was restoring was not the one I had expected.

    Should have been more explicit in my restore command! 😉

  • I have to ask... why are you using SQLCMD for this task? A simple stored procedure is able to do these types of restores no problem (I have a scheduled proc that does it every night for me).

    --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)

  • Hi Jeff -

    The call is coming from an external application. I guess we could have created a proc and called that instead!

  • Ok and agreed. Thanks for the feedback. I appreciate it.

    --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)

Viewing 5 posts - 1 through 4 (of 4 total)

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