Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 ClearTrace Support Forum
 ClearTrace app error

Author  Topic 

Handyman
Starting Member

2 Posts

Posted - 2009-12-20 : 19:40:11
I created a SQL job to run trace and write the results to a file. The trace includes EventClass, TextData, HostName, ApplicationName, LoginName, SPID, Duration, EndTime, Reads, Writes, and CPU. The trace file opens in Profiler and looks okay. Get the message below in the file ClearTrace_Error_Date.txt
Thanks -- I've heard great things about the tool.


******************************************************************************
ClearTrace Error
******************************************************************************
Version: 2008.34.0
Last Exception: Item has already been added. Key in dictionary: '3' Key being added: '3'
Last Target Site: Void Add(System.Object, System.Object)
******************************************************************************

Exception Type: System.Reflection.TargetInvocationException
Exception Message: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClearTraceGui.Program.Main()

================================
Inner Exception
================================
Exception Type: System.Reflection.TargetInvocationException
Exception Message: An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at System.ComponentModel.RunWorkerCompletedEventArgs.get_Result()
at ClearTraceGui.MainForm.backgroundWorker1_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)

================================
Inner Exception
================================
Exception Type: System.ArgumentException
Exception Message: Item has already been added. Key in dictionary: '3' Key being added: '3'
at System.Collections.SortedList.Add(Object key, Object value)
at ClearData.ClearTrace.TraceDimension.GetIndex(String lookupValue, String connectionString)
at ClearData.ClearTrace.TraceDimension.GetIndex(IDataReader traceFile, String connectionString)
at ClearData.ClearTrace.SqlTrace.ProcessFiles(BackgroundWorker worker, DoWorkEventArgs eventArgs)
at ClearTraceGui.MainForm.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2009-12-23 : 08:17:33
Is the trace file small enough that you can email it to me? I'm "graz" at this domain.

=================================================
Creating tomorrow's legacy systems today. One crisis at a time.
Go to Top of Page

dbaadm
Starting Member

10 Posts

Posted - 2010-01-07 : 04:50:15
I get a simular error from both the applikation and from the command-line version.
I am also able to open my trace files in SQL Server Profile and the RML Utilitie with no problems

******************************************************************************
ClearTrace Error
******************************************************************************
Version: 2008.34.0
Last Exception: Item has already been added. Key in dictionary: '0' Key being added: '0'
Last Target Site: Void Add(System.Object, System.Object)
******************************************************************************

Exception Type: System.Reflection.TargetInvocationException
Exception Message: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClearTraceGui.Program.Main()

================================
Inner Exception
================================
Exception Type: System.Reflection.TargetInvocationException
Exception Message: An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at System.ComponentModel.RunWorkerCompletedEventArgs.get_Result()
at ClearTraceGui.MainForm.backgroundWorker1_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)

================================
Inner Exception
================================
Exception Type: System.ArgumentException
Exception Message: Item has already been added. Key in dictionary: '0' Key being added: '0'
at System.Collections.SortedList.Add(Object key, Object value)
at ClearData.ClearTrace.TraceDimension.GetIndex(String lookupValue, String connectionString)
at ClearData.ClearTrace.SqlTrace.ProcessFiles(BackgroundWorker worker, DoWorkEventArgs eventArgs)
at ClearTraceGui.MainForm.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

The files that I try to import are 150MB each and I have around 100-150 files pr trace

The trace template that I have used looks like this

-- RPC:Completed: 8:HostName, 15:EndTime, 16:Reads, 48:RowCounts, 1:TextData
exec sp_trace_setevent @TraceID, 10, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 10, 2, @on -- BinaryData
exec sp_trace_setevent @TraceID, 10, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 10, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 10, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 10, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 10, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 10, 13, @on -- Duration
exec sp_trace_setevent @TraceID, 10, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 10, 15, @on -- EndTime
exec sp_trace_setevent @TraceID, 10, 16, @on -- Reads
exec sp_trace_setevent @TraceID, 10, 17, @on -- Writes
exec sp_trace_setevent @TraceID, 10, 18, @on -- CPU
exec sp_trace_setevent @TraceID, 10, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 10, 48, @on -- RowCounts
exec sp_trace_setevent @TraceID, 10, 51, @on -- EventSequence

-- RPC:Starting
exec sp_trace_setevent @TraceID, 11, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 11, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 11, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 11, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 11, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 11, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 11, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 11, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 11, 51, @on -- EventSequence

-- SQL:BatchCompleted
exec sp_trace_setevent @TraceID, 12, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 12, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 12, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 12, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 12, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 12, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 12, 13, @on -- Duration
exec sp_trace_setevent @TraceID, 12, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 12, 15, @on -- EndTime
exec sp_trace_setevent @TraceID, 12, 16, @on -- Reads
exec sp_trace_setevent @TraceID, 12, 17, @on -- Writes
exec sp_trace_setevent @TraceID, 12, 18, @on -- CPU
exec sp_trace_setevent @TraceID, 12, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 12, 48, @on -- RowCounts
exec sp_trace_setevent @TraceID, 12, 51, @on -- EventSequence

-- SQL:BatchStarting
exec sp_trace_setevent @TraceID, 13, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 13, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 13, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 13, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 13, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 13, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 13, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 13, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 13, 51, @on -- EventSequence

-- Audit Login 14
exec sp_trace_setevent @TraceID, 14, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 14, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 14, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 14, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 14, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 14, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 14, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 14, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 14, 51, @on -- EventSequence

-- Audit Logout 15
exec sp_trace_setevent @TraceID, 15, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 15, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 15, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 15, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 15, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 15, 13, @on -- Duration
exec sp_trace_setevent @TraceID, 15, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 15, 15, @on -- EndTime
exec sp_trace_setevent @TraceID, 15, 16, @on -- Reads
exec sp_trace_setevent @TraceID, 15, 17, @on -- Writes
exec sp_trace_setevent @TraceID, 15, 18, @on -- CPU
exec sp_trace_setevent @TraceID, 15, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 15, 51, @on -- EventSequence

-- SP:Recompile
exec sp_trace_setevent @TraceID, 37, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 37, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 37, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 37, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 37, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 37, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 37, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 37, 51, @on -- EventSequence

-- SP:StmtStarting
exec sp_trace_setevent @TraceID, 44, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 44, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 44, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 44, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 44, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 44, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 44, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 44, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 44, 48, @on -- RowCounts
exec sp_trace_setevent @TraceID, 44, 51, @on -- EventSequence

-- SP:StmtCompleted
exec sp_trace_setevent @TraceID, 45, 1, @on -- TextData
exec sp_trace_setevent @TraceID, 45, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 45, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 45, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 45, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 45, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 45, 13, @on -- Duration
exec sp_trace_setevent @TraceID, 45, 15, @on -- StartTime
exec sp_trace_setevent @TraceID, 45, 15, @on -- EndTime
exec sp_trace_setevent @TraceID, 45, 16, @on -- Reads
exec sp_trace_setevent @TraceID, 45, 17, @on -- Writes
exec sp_trace_setevent @TraceID, 45, 18, @on -- CPU
exec sp_trace_setevent @TraceID, 45, 25, @on -- IntegerData
exec sp_trace_setevent @TraceID, 45, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 45, 28, @on -- ObjectType
exec sp_trace_setevent @TraceID, 45, 48, @on -- RowCounts
exec sp_trace_setevent @TraceID, 45, 51, @on -- EventSequence

-- Server Memory Change
exec sp_trace_setevent @TraceID, 81, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 81, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 81, 51, @on -- EventSequence

-- Showplan Statistics 98
exec sp_trace_setevent @TraceID, 98, 2, @on -- BinaryData
exec sp_trace_setevent @TraceID, 98, 3, @on -- DatabaseID
exec sp_trace_setevent @TraceID, 98, 8, @on -- HostName
exec sp_trace_setevent @TraceID, 98, 10, @on -- ApplicationName
exec sp_trace_setevent @TraceID, 98, 11, @on -- LoginName
exec sp_trace_setevent @TraceID, 98, 12, @on -- SPID
exec sp_trace_setevent @TraceID, 98, 13, @on -- Duration
exec sp_trace_setevent @TraceID, 98, 14, @on -- StartTime
exec sp_trace_setevent @TraceID, 98, 15, @on -- EndTime
exec sp_trace_setevent @TraceID, 98, 28, @on -- ObjectType
exec sp_trace_setevent @TraceID, 98, 35, @on -- DatabaseName
exec sp_trace_setevent @TraceID, 98, 51, @on -- EventSequence

There are no filters applied

And yes the tool normal work fantastic
Go to Top of Page

Handyman
Starting Member

2 Posts

Posted - 2010-01-07 : 16:36:40
Update on this topic.
After running a Profiler trace against the ClearTrace database while attempting to import the file having the issue, the statement below was the last one recorded before the error suggesting the error has to do with LoginName. After removing LoginName from the trace, it imported successfully.


exec sp_executesql N'IF EXISTS(SELECT * FROM CTLogin WHERE LoginName = @Value)
SELECT KeyValue = LoginID FROM CTLogin WHERE LoginName = @Value;
ELSE
BEGIN
BEGIN TRAN

DECLARE @NewID INT;
SELECT @NewID = COALESCE(MAX(LoginID), -1) + 1 FROM CTLogin;
INSERT CTLogin (LoginID, LoginName)
VALUES (@NewID, @Value);
COMMIT TRAN

SELECT KeyValue = @NewID;
END',N'@Value nvarchar(15)',@Value=N'Domain\LoginName'

Go to Top of Page

dbaadm
Starting Member

10 Posts

Posted - 2010-01-08 : 02:51:22
I have look at the Error "Key in dictionary: '0' Key being added: '0'".
It appear if you import from a trace file named "mytrace.trc" and then the next trace you import have the same name "mytrace.trc" the error appears.
One can either delete trace groups refering to this file or "TRUNCATE TABLE CTTraceFile"

The trace files are than imported without any issue.
Go to Top of Page

Guus_L
Starting Member

2 Posts

Posted - 2010-01-18 : 06:12:05
I have the same bug in version 2008.34, but now for table CTHOST and field 'HostID'.

The query is searching for a value, cannot find it.
When inserting there is an error, because the value is already there!

Changing the name of the trace-file is not the solution..
The collation for the database is Latin1_General_CI_AS, so finding a value should be case insensitive.





Go to Top of Page

Guus_L
Starting Member

2 Posts

Posted - 2010-01-18 : 07:33:35
Loading a trace-file without 'Hostname' works!
Go to Top of Page
   

- Advertisement -