July 22, 2008 at 3:48 am
So I have run Profiler for a while, wrote it to a file and now wish to examine the captured trace. However, I notice the trace is chopped-up into chunks of about 5Mb each, more then 2000 in total. How do I get all these files into 1 trace? I can examine each file, but that does not help me, and manually putting all these files individually in a table or such, please let that not necessary...
Greetz,
Hans Brouwer
July 22, 2008 at 5:40 am
I'm not sure if there's a way simple way to concatenate the files. But you could automate loading them all into a table.
Use xp_dirtree to get the list of files. It's best if you place all of the .trc files in a single folder with no other files in it. Here's a small example to give you an idea of how to do this.
create table #files
(
[FileName] varchar(256),
depth tinyint,
IsFile bit
)
insert into #files exec xp_dirtree 'c:\MyTracefolder\',1,1 --change folder
declare @file_name varchar(128)
declare file_cursor cursor
for
select [FileName]
from #files
where IsFile = 1
open file_cursor
fetch next from file_cursor into @file_name
while @@fetch_status = 0
begin
declare @file_path_and_name varchar(256)
set @file_path_and_name = 'c:\MyTraceFolder\' + @file_name --change folder
--I've been lazy here but you should explicitly specify which columns you want to include in the INSERT and SELECT statements
INSERT INTO dbo.MyTraceDataTable
SELECT * FROM fn_trace_gettable(@file_name,default)
fetch next from file_cursor into @file_name
end
close file_cursor
deallocate file_cursor
drop table #files
July 22, 2008 at 5:58 am
Tnx for answering, I will give this a try.
I am still curious why the file is chopped up. Is there some setting I should check? Tried to find info on this but dunno what search statement to use.
Tnx again.
Greetz,
Hans Brouwer
July 22, 2008 at 6:58 am
FreeHansje (7/22/2008)
Tnx for answering, I will give this a try.I am still curious why the file is chopped up. Is there some setting I should check? Tried to find info on this but dunno what search statement to use.
Tnx again.
When you create a trace and you specify that you want to save it to a file, the option Enable File Rollover is enabled, and the max file size is set to 5 MB by default. You can change this value or disable the rollover option at this stage.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply