SQL Server Profielr

  • Good day .

    I need to import multiple SQL Server Trace files into an SQL Server database . Is there a way to do it ? Any ideas ?

  • YOu can try with Bulk Insert with loop or you can try with SSIS

  • one option is to take the profiler output to tables directly while creating a trace file

    and if suppose you have taken the trace output to a .trc file you can do this by running the following query.

    USE database_name

    GO

    SELECT * INTO table_name FROM ::fn_trace_gettable('c:\filename.trc', default)

  • Or in profiler

    File -> Save as -> Trace Table



    Clear Sky SQL
    My Blog[/url]

  • Thank you for the feedback. I just like to know how this can be scripted and scheduled in a job ?

  • avinashily (2/8/2011)


    one option is to take the profiler output to tables directly while creating a trace file

    and if suppose you have taken the trace output to a .trc file you can do this by running the following query.

    USE database_name

    GO

    SELECT * INTO table_name FROM ::fn_trace_gettable('c:\filename.trc', default)

    I would not recommend outputing directly to a table from a trace. It's much safer on production systems to go to file.

    But, I agree, using ::fn_trace_gettable is the way to automate this.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • lianv 90648 (2/8/2011)


    Thank you for the feedback. I just like to know how this can be scripted and scheduled in a job ?

    Yes, use the script supplied by avinashily above.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • Good Day. Thank you for the feedback. But I want import the data into the same table everyday and don't want to recreate a new table everytime I want to upload a trace file . Our production server is SQL Server 2005 and the Audit server is SQL Server 2008 and we were unable to upload from SL Server 2005 to SQL Server 2008 . Any ideas ?

  • Thank you for the feedback. I need to schedule the trace as a job . I looked in the script and could not find any reference to a database or a table . How could this be scheduled then ?

  • Thanks,

    I tried Bulkinsert, it failed .

  • hi lianv,

    you can use this query to load the data into same table again and again instead of creating a new table.

    insert INTO table_name FROM ::fn_trace_gettable('c:\filename.trc', default)

    but the thing is that the trace files used to load into the table must be taken from the same trace template.

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

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