Delete Extended Events file

  • Is there any way to delete the xel file once I no longer need it without having to use something other than SSMS?
    I won't have access to the server other than sql, and I don't want to keep creating new files every time that would last for the eternity.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares - Friday, August 25, 2017 8:24 AM

    Is there any way to delete the xel file once I no longer need it without having to use something other than SSMS?
    I won't have access to the server other than sql, and I don't want to keep creating new files every time that would last for the eternity.

    It depends. Do you have access to xp_cmdshell?

    If so, just run that with a DEL filename through SSMS.

    EXEC MASTER..XP_CMDSHELL 'del \\serverOrNas\path\filename'.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin - Friday, August 25, 2017 10:50 AM

    It depends. Do you have access to xp_cmdshell?

    I don't, they claim is a security measure. πŸ™

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Can you use Agent? You could run a PowerShell script to remove it that way.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Actually, through SQL Server Agent, you can run a operating system command job step to delete the file using cmd window language (again Del filename).

    Here's a link to an article I found.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Luis Cazares - Friday, August 25, 2017 11:03 AM

    Brandie Tarvin - Friday, August 25, 2017 10:50 AM

    It depends. Do you have access to xp_cmdshell?

    I don't, they claim is a security measure. πŸ™

    We have the same issue with our lock downs, but we also have code that enables it, does its thing, then disables it.  It is the about the only way to do what needs to be done without creating an Agent Job to run a cmdshel job step and then drop the job.

  • There's always (in many environments) an "exceptions process" where one can request an exception for a specific use and then either do as Lynn suggests or leave it on but only let the DBAs know about it.

    That requires a certain amount of monitoring and red tape, though.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • So I'm trying to be evil here and see if there's a way to get around the xp_cmdshell thing using a SQLCMD query window in SSMS. Haven't found anything specific yet, but figured if anyone had done it, maybe they'll post the solution to your thread, Luiz.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Thank you for the good ideas. Sure, exceptions can be made and this will be used by DBAs (or selected developers), the problem is that we're development DBAs and the system DBAs won't give them that easily (and I don't blame them).

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares - Friday, August 25, 2017 11:56 AM

    Thank you for the good ideas. Sure, exceptions can be made and this will be used by DBAs (or selected developers), the problem is that we're development DBAs and the system DBAs won't give them that easily (and I don't blame them).

    It's the classial overspecialisation problem that leads to distrust of generlists and of specialists in a different area..   The area A experts think the area B experts re incompetent inArea A so they won't give them access.  For the same reason, they won't do what the area B experts tell them is needed, because they don't believe it, because they "know" that area B people can never spot area A problems that the area A specialists haven't noticed.  So they "know" it's not their problem.  Of course if the area B people are equally overspecialised they can't spot errors in are A unless they've had a lot of experience of discovering how blid are the area specialists to things that are blatantly obvious to area B people, so the conflict never arises (and of course the problem never gets solved until a generalist takes a look at it).

    You don't blame them.  Well, I do.  I've seen the consequences of the combination of overspecialisation with distrust between people whose topic of specialisation isn't the same and it's always bad news and often a disaster.  And treating development DBAs and production DBAs as specialists in different areas is either bloody stupid pandering to those who are too damned lazy to learn what's needed for both those rôles or accepting idiot definitions of competence areas from ignorant managers who haven't a clue.

    Tom

  • Have any of you ever solved the problem of something in EE being used to easily identify andΒ  delete old files by session without having to jump through a flaming hoop because even dropping the event won't delete the .xel files?

     

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

  • To my knowledge, discipline is your only friend here. Keep the files in a defined place. Use naming standards that help you clarify what a thing is for, then clean stuff out occasionally. Sorry. Probably not the best answer.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • That's exactly the conclusion that I came to but had to ask.Β  Thanks, Grant.

    As a bit of a sidebar, long live xp_CmdShell! πŸ˜€

    --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 13 posts - 1 through 12 (of 12 total)

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