/* start the trace we just created.
by default the trace is stopped at creation
*/
EXEC sp_trace_setstatus @trace_id, 1
/* return the trace identifier*/
SELECT ''''trace ID is: '''' + CAST(@trace_id AS VARCHAR(4))
--Result:
-------------------------
trace ID is: 2
现在我们可以用fn_trace_getinfo 来获得相应跟踪的信息
SELECT * FROM :: fn_trace_getinfo(2)
查询的结果在表 3.
表3. fn_trace_getinfo查询的结果.
traceID
Property
Value
2
1
e:\trace_file.trc
3
5
4
NULL
这个输出告诉我们,有一个正在运行的跟踪,自动增长到5MB后会自动产生另外一个文件.没有指定跟踪停止时间( property = 4 ) ,因此该跟踪会运行直到SQL SERVER服务停止或通过系统存储过程sp_trace_setstatus停止跟踪.
上一页 [1] [2] [3] [4] [5] [6]
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18