Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Process profiler log in C# Expand / Collapse
Author
Message
Posted Wednesday, June 22, 2011 10:34 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 14, 2014 9:52 AM
Points: 19, Visits: 97
I am in charge of migration DB from 2k5 to 2k8
One of tests to check that all functionality works same way in 2k8 as in 2k5 is “playing” trace file log on 2k5 and 2k8 in parallel and compare result for each statement as well as end result of database.
Because DB in heavy usage for period of 8 hours it generates about 140 files 50MB each. I would like to write some code which will do same what profiler does when you open trace file set some filter like DatabaseId and then using menu
File/Export/Extract SQL Server Events/Extract Transact-SQL Events
to get script file.
In my research I only found only articles how to read trace file using Microsoft.Sqlserver.Managment,Trace.TraceFile object. But in this case I have to also build logic which will figure one line out approximately four in trace file
E.g. simple call for SP creates four events
- RPC Started
-SP Started
-SP completed
-RPC completed
If any other events happened in between of those four you have process them accordingly and create separate statement in script.
SQL Profiler when extracts Transact-SQL Event does all job on it is own. I would appreciate if somebody points me how I can achieve same from code (I need process a lot of trace file) using posible kow figured method of TraceFile or something esle

Alternatively I can put tarce file into table using fn_trace_gettable but again will have to figure how query table to generate SQL script

Thanks!

Thanks!
Post #1130119
Posted Thursday, September 08, 2011 11:38 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, March 23, 2014 8:39 AM
Points: 22, Visits: 82
If your task is to replay SQL trace file, you can use the following tool.

Replay SQL Trace tool


This tool replays SQL profiler trace file against loca/remote SQL server
and give you replay result file, just like Profiler.
Since this is console mode application, you can create a batch file to run multiple SQL trace files.
Post #1172025
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse