Process profiler log in C#

  • 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!

  • 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.

Viewing 2 posts - 1 through 1 (of 1 total)

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