0

I want to change a particular entry in a trace file. How can I do it?

I have received a set of trace files which were run on the prod server. From these I was trying to get a set of RML files to replay the load on a different environment. To change the .trc files to RML files I ran readtrace.exe

However, readtrace did not output RML files. Looking at the logs I see the following error

06/06/12 15:43:20.914 [0X0000060C] SPID: 118 Seq: 50736293 [Error: 110003][State: 0][Abs Char: 233][Seq: 0] SYNTAX ERROR: String is missing proper closing quote near (Char Pos: 0x139 Byte Pos: 0x272)

It then clearly shows the entry which is causing this error. While I have sent the bug to the dev team and the fix will go out in the next release, I need to use the current trace file to generate and replay the load. Thus I want to fix the particular entry in the trace file which is causing this error.

Is it possible? I tried opening the trace file in wordpad but wordpad crashed, not surprising that given the trace file is 250MB. Trying to install Vim and see if I can open and change the trace file there, but was wondering if anyone knew of an easier method to do this.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
shashi
  • 4,616
  • 9
  • 50
  • 77
  • Taking another trace will not be possible until the next release, so I need to fix this somehow. – shashi Jun 06 '12 at 11:48
  • 1
    Why on earth do you want to **manipulate** your trace files? Analyze them in SQL Profiler - yes - but **why** change them? What's the idea or motivation behind that? – marc_s Jun 06 '12 at 11:49
  • I want the rml files to be generated and that is failing because in the trace there is a query which is missing the quotes. Now ideally I would wait for the fix to go out, so that when the next trace is taken it has no such bad queries and rml files are generated as expected. However, given that might not be possible in a short time, I am looking to apply that fix directly to the trace file so that the rml files are generated and I can continue with my testing. – shashi Jun 06 '12 at 11:53
  • The idea is to test the current load on the system in a different environment (aws cloud) and to do that the best way I found out was using the rml utilities for sql server. – shashi Jun 06 '12 at 11:56

1 Answers1

1

I could not find a way to do this, so finally going the expected way of requesting for a new server side trace, which is taken after the fix has been put.

Before that I did try to load the trace files into a table, then load in profiler and then change the values which I needed and generate a new trace file, but crticial events needed for RML generation are lost when you load to profiler. I also opened a smaller trace file in wordpad and found that I could not edit the contents as there was binary content as well and it wasnt clear what text editing would achieve.

Thus in the end, the only way to get a trace which can generate RML files was to fix the bad query in the code and push the fix and then take the trace once again.

shashi
  • 4,616
  • 9
  • 50
  • 77