Friday, March 9, 2012

Microsoft.SqlServer.Management.Trace.TraceServer - Examples ?

I'm trying to find ANY examples of using the
Microsoft.SqlServer.Management.Trace namespace.

What I'm looking for is an example of being able to create and initialise a
new trace, haing this processed on the Server, and then initializes some
sort of traceReader against this.

e.g the equivalent of:
MyTraceConnection = new Something ("localhost");
MyTrace = new SqlTrace (CaptureTSQL || CaptureLogonEvent ||
CaptureLogoutEvent 0)
MyTrace.Open(MyTraceConnection)

OnTraceEvent (TraceInfo x) {
Console.Writeline ( x.ToString() ) ;
}
Any examples ? There seems to be nothing in MSDN, or SQL2005 info.

Thanks

Steven

Please refer to the SMO samples Tracer and SmoEvents as they create and read trace event logs.
The sample code, if installed in the default folderr, should be in the C:\Program Files\Microsoft SQL Server\90\Samples\Engine\Programmability\SMO\... folder.|||I installed all subcomponents from the MSDN Download: en_sql_2005_dev_all_dvd.iso

And, I don't have such a folder

Am I missing something ?|||Also, it doesn't seem to be in

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||The samples are available during the installation of SQL Server but are not automatically installed. If you re-run setup or use Add/Remove Programs you need to go to the Feature Selection and make sure the Sample databases and programs are set to install.

Also, I found the SqlServerSamples.msi on http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en about half way down the page.|||OK - Thanks .

I tried AddRemovePrograms, but didn't find it

However, I've had yet another look at the files from SqlServerSamples.msi, and finally found it...

After I removed the "SignAssembly", the project worked

Though it does seem odd that you can't create a trace against a server, without a .TDF file.

I thought this was what the Microsoft.SqlServer.Management.Smo.ServerTraceEventSet was for, to allow you to define a dynamic trace

No comments:

Post a Comment