首页 > 数据库

Scheduling a SQL Server Profiler Trace

时间:2009-04-23 12:54:34  作者:武树伟  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
Scheduling a SQL Server Profiler TraceWritten By: David Bird -- 3/25/2009 -- 0 commentsStay informed - get the MSSQLTips.com newsletter and win - cli......

Scheduling a SQL Server Profiler Trace

Written By: David Bird -- 3/25/2009 -- 0 comments

Stay informed - get the MSSQLTips.com newsletter and win - click here

Problem
You want to schedule a trace, but SQL Profiler does not have a built-in scheduling option. So how do you use SQL Agent to schedule a SQL Profiler trace?

Solution
SQL Profiler traces are built using system stored procedures. You can use the SQL commands from an existing profiler trace and construct your own stored procedure that creates and starts a SQL Profiler trace. You will need to specify some additional settings using your stored procedure. These include run duration, file size, and trace output file location. Instructions on how to create, execute, and stop the profiler trace using this stored procedure are covered in detail.

Create the Trace Definition

The most efficient means to define the SQL commands used for constructing a profiler trace is to use SQL Profiler.

  1. Start SQL Profiler and select File > New Trace. Specify the events, columns, and filters you want in your trace.
  2. Start the trace and then stop it.
  3. Export the definition. Click File > Export > Script Trace Definition > For SQL Server 2005
    Note: For SQL Sever 2000 and 2008 choose the appropriate output type.
  4. Save the trace file.

Create a Profile Trace Stored Procedure

如果您需转载 Scheduling a SQL Server Profiler Trace,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门