February 8, 2011 at 6:52 am
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 ?
February 8, 2011 at 6:57 am
YOu can try with Bulk Insert with loop or you can try with SSIS
February 8, 2011 at 7:51 am
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)
February 8, 2011 at 7:52 am
February 8, 2011 at 7:59 am
Thank you for the feedback. I just like to know how this can be scripted and scheduled in a job ?
February 8, 2011 at 8:06 am
avinashily (2/8/2011)
one option is to take the profiler output to tables directly while creating a trace fileand 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 Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 8, 2011 at 8:06 am
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 Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 9, 2011 at 12:59 am
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 ?
February 9, 2011 at 1:02 am
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 ?
February 9, 2011 at 1:03 am
Thanks,
I tried Bulkinsert, it failed .
February 9, 2011 at 1:36 am
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