none
Locked extended event session file RRS feed

  • Question

  • Somehow, when I stop my extended sessions, the .xel to which I log the events stays locked and cannot be erased.

    Anybody has this issue or knows how unlock those files or at least identify the process locking them?


    • Edited by Antoine F Friday, December 4, 2015 3:13 AM
    Friday, December 4, 2015 3:11 AM

Answers

  • Found it, it is contained in the dmv sys.dm_xe_session_targets

    targetname = 'event_file'

    target_data like '%yourfile%'

    Thank you for the help.

    • Marked as answer by Antoine F Tuesday, December 15, 2015 7:18 PM
    Tuesday, December 15, 2015 7:18 PM

All replies


  • Hi Antoine F,

    There are few reasons that your file is locked, one is that  other processes in SQL Server are locking the resource, another is that the file might be opened by another user.

    For the first reason, you can use SQL Profiler in SQL Server management studio to view which process is blocking the target resource of the extended event session, then unlock the target resource by killing these process.

    For the second reason, you can check that if the file is opened by user in computer management(shown as screenshot), right-click on it to close it if the file is locked.

    Regards,
    Ice Fan 


    Ice Fan
    TechNet Community Support


    Tuesday, December 8, 2015 7:48 AM
  • Thank you Ice Fan,

    For the computer manager, my setting does not allow me to see this locked file.  The file is in a mounted path in a LUN or vice versa and unfortunately, the file does not show as locked locally.  When I attempt to delete the file, I do receive a message about he file being locked by my SQL server instance.

    Now, for the profiler, do you know how I would identify the "locked resource" to figure out the problematic process?  I am quite sure I stopped and even erased the extended event session which were writing in my file but I have a hard time figuring the meta data (catalog view) which would allow me to make sure I did not forget one.

    I seem to be repeatedly stumbling on readings about catalog views defining the possible actions, events and such but never finding the ones defining my running extended event sessions and their storage.

    Thursday, December 10, 2015 1:55 AM
  • Found it, it is contained in the dmv sys.dm_xe_session_targets

    targetname = 'event_file'

    target_data like '%yourfile%'

    Thank you for the help.

    • Marked as answer by Antoine F Tuesday, December 15, 2015 7:18 PM
    Tuesday, December 15, 2015 7:18 PM