Cannot delete filename. There has been a sharing violation.

  • I get the following message after a file has been locked by a long running job (which fired a DTS package) which I had to stop.

    "Cannot delete filename. There has been a sharing violation.

    The source or destination file may be in use."

    Other than reboot the server, is there any other way of deleting this file?

  • just a guess. Do you know of any process which might be using this file. Then try to terminate that process and delete the file.

  • "Do you know of any process which might be using this file"

    Yes I have worked out exactly which process caused the problem.

    There is a job running which runs a DTS Package. Within this package I use the file object to copy an excel template and then use CreateObject("Excel.Application") to open the copied Excel workbook and manipulate it.

    During this process, I reckon Excel asked for user response which as it is invisible caused the job to go into an indefinite wait. I stopped the job.

    I have identified the reason why Excel asked for user response and will eliminate the cause, however this could happen again and having to reboot the server is not a very satisfactory solution.

    By the way I connect to the Server using Terminal Services.

  • It happened again, this time I pressed CTRL SHIFT ESC to open the Task Manager and found and killed the hidden Excel process.

  • It happened again, this time I pressed CTRL SHIFT ESC to open the Task Manager and found and killed the hidden Excel process.

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • Post deleted.  It's no longer needed.

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

  • This was removed by the editor as SPAM

Viewing 11 posts - 1 through 10 (of 10 total)

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