• Indianrock (7/24/2013)


    I'd like to hear some feedback on how to handle it when you trace your production box, say main database is called Production, then try to replay those trace files on a development box where a copy of the database is called Test and has a different databaseID.

    Some brief research makes it look like you can load the trace files into a table, from Profiler, then update either the database id and/or database name in the trace table, before trying replay.

    That is correct - open the server-side trace file(s) in Profiler and save to a table so that you can modify trace data prior to replay. Alternatively, create and load a table with the same schema Profiler expects for the replay. Example code below. Note that you may have database names embedded in the TextData so make sure you change those too.

    SELECT

    IDENTITY(int, 0, 1) AS RowNumber

    ,EventClass

    ,BinaryData

    ,DatabaseID

    ,NTUserName

    ,NTDomainName

    ,HostName

    ,ClientProcessID

    ,ApplicationName

    ,LoginName

    ,SPID

    ,StartTime

    ,EndTime

    ,Error

    ,DatabaseName

    ,RowCounts

    ,RequestID

    ,EventSequence

    ,IsSystem

    ,ServerName

    ,TextData

    ,EventSubClass

    ,Handle

    INTO dbo.replay_trace

    FROM fn_trace_gettable(N'C:\Traces\ReplayTrace.trc', default);