How to Create and Start SQL Server Trace Automatically

  • Tnx.

    Found some similar stuff myself, but your's more detailed & extended.

    Tnx again.

    Greetz,
    Hans Brouwer

  • ALZDBA (6/3/2009)


    Attached you'll find a version I use for quick and dirty CPR-trace 😉

    ALZDBA the version you posted has all the CrLf stripped out, making it difficult to test, since we have to reformat manually; can you edit it or repaste it?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (6/3/2009)


    ALZDBA (6/3/2009)


    Attached you'll find a version I use for quick and dirty CPR-trace 😉

    ALZDBA the version you posted has all the CrLf stripped out, making it difficult to test, since we have to reformat manually; can you edit it or repaste it?

    You need to change the file extention !

    (just remove the .txt and keep the .SQL)

    If you then open it with ssms, it will be formatted OK.

    (I downloaded it from this thread, removed the .txt and it appeared ok in SSMS)

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Hello,

    I want to profile and write to a table.

    But in the script generated by the profiler, in the export funcionality, the following code is written:

    -- Writing to a table is not supported through the SP's

    Do you know some way to enable the trace without using the profiler, save the data in tables, instead of in files? I really prefer to save in tables.

    Thanks in advance

    DBA Cabuloso

    ________________
    DBA Cabuloso
    Lucas Benevides

  • DBA Cabuloso (7/10/2009)Do you know some way to enable the trace without using the profiler, save the data in tables, instead of in files? I really prefer to save in tables.

    That's where the

    SELECT * INTO temp_trc

    FROM ::fn_trace_gettable('d:\trace\mytrace.trc', default)

    comes in play... reading the trace files after the fact and that way you can also insert them into a table for analysis.

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

  • Sounds easy.

    But i was unable to script it.

    I went to file menu and then opened file and went to script file.

    It is not working.

  • srilu_bannu (10/12/2011)


    Sounds easy.

    But i was unable to script it.

    I went to file menu and then opened file and went to script file.

    It is not working.

    Best to start a new thread really.

    Have you started and stopped the trace before attempting to script it?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • I am sorry I can start a new thread.

    To answer your question:

    Yes, I have started and stopped the profiler trace before scripting it.

  • Perry,

    thank you so much for this code. This is exactly what I was looking for. You mentioned that I can schedule it on the same server I am running the trace against. Is there any way to schedule to run the trace from a different server? Thank you so much!

Viewing 9 posts - 16 through 23 (of 23 total)

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