Re: Replay Trace Profiler files with T-SQL code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Pat.Rick" <PatrickAlexander.email@xxxxxxxxx> wrote in message news:2d88ace7-05c0-4592-93a0-d3797ae36a31@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jul 17, 12:34 pm, "John Bell" <jbellnewspo...@xxxxxxxxxxx> wrote:
"Pat" <PatrickAlexander.em...@xxxxxxxxx> wrote in message

news:8d35cef6-9b4d-4972-9752-05311e6b81c8@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> HI Freinds,
> SQL2008

> I have collected trace files and need to replay them on my server only
> using T-SQL
> how can it be done ?

> Thanks,
> Pat

Hi Pat

Replaying trace files is a function of the SQL Profiler application, but you
can load the trace file into a database table (if you have saved it to a
file) using fn_trace_gettable(), then cursor through each
statement/procedure called use sp_executeSQL or EXEC to execute each
statement, although if you are using parameters this may be difficult.

Another option would be to export the profile as SQL statement which is
available on the file menu of SQL profiler and run the script it creates.

John

That worked, but how much of relastic load is when you run it as
scripts ?

Even with SQL Profiler replaying the script they may not be executed in the same time scales as the original load. The execution method you have done will be serial, therefore unlikely to see as much contention as the like system. Just using T-SQL is never going to give you the means to re-create a true load; even the load testing tools available will not give you an exact replay, but will give you a means of stressing the system, and a method which is more likely to re-create the situation where problems will occur (and hence a higher confidence that whatever solutions you come up with work!)

Your method will have value in that it is extra testing and forcing some load one the same volume and distribution of data that is in a live system. This should help reduce the risk of having problems if done as part of a release schedule.

Other otpions include: SQL Load test on codeplex this project which will convert trace files into unit tests for Visual Studio Load Test http://sqlloadtest.codeplex.com/ which may be useful. There are also the RML utilities http://www.microsoft.com/downloads/details.aspx?familyid=7EDFA95A-A32F-440F-A3A8-5160C8DBE926&displaylang=en which will create XML (RML) files and replay them. This has been used by PSS to re-create issues. The files can also be modified to create your own loads although there is no utility to do so.


John

.



Relevant Pages

  • Re: Replay Trace Profiler files with T-SQL code
    ... Replaying trace files is a function of the SQL Profiler application, ... available on the file menu of SQL profiler and run the script it creates. ... but how much of relastic load is when you run it as ...
    (microsoft.public.sqlserver.programming)
  • Re: Replay Trace Profiler files with T-SQL code
    ... using T-SQL ... Replaying trace files is a function of the SQL Profiler application, but you can load the trace file into a database table using fn_trace_gettable, then cursor through each statement/procedure called use sp_executeSQL or EXEC to execute each statement, although if you are using parameters this may be difficult. ...
    (microsoft.public.sqlserver.programming)
  • Re: can I send the audit file to a table?
    ... fn_trace_gettable function to load the trace files into a table. ... Refer ... to books online for more information on fn_trace_gettable. ...
    (microsoft.public.sqlserver.security)