SQL事件探查器通过CMD线导入模板(SQL Profiler Import Template via CMD Line)

编程入门 行业动态 更新时间:2024-10-27 23:26:38
SQL事件探查器通过CMD线导入模板(SQL Profiler Import Template via CMD Line)

我们只是为我们的用户创建一个简单的实用程序来触发他们的SQL Server数据库上的跟踪。 应用程序只需获取服务器连接详细信息,然后单击开始跟踪。 在引擎盖下它触发以下探查器命令行:

profiler /S MY-LAPTOP /U sa /P Admin123 /T "Tracer2008" /O "C:\Trace.trc" /M "05-16-14 10:15:46" /Z 20

这种工作正常,因为已经有一个Profiler模板导入到名为Tracer2008的探查器中。

我已经导出了Tracer2008.tdf文件。 只是想知道我们如何通过命令行或某些庄园导入模板,以便在我们启动探查器调用之前它已经在系统中?

We are just creating a simple utility for our users to fire off a trace on their SQL Server Database. The App just takes their server connection details and they click start trace. Under the hood it fire the following profiler command line:

profiler /S MY-LAPTOP /U sa /P Admin123 /T "Tracer2008" /O "C:\Trace.trc" /M "05-16-14 10:15:46" /Z 20

This works fine in there is already a Profiler template imported into the profiler called Tracer2008.

I've got the Tracer2008.tdf file exported. Just wanting to know how we can go about importing the template via command line or in some manor so that it already in the system before we fire off the profiler call?

最满意答案

您可以添加将模板从某个共享位置复制到预期的本地文件夹的步骤。 检查SQL Profiler模板是否缺失 - 其他修复步骤? 详情。

本地文件夹取决于探查器的版本以及要连接的服务器的版本。

例如,连接到SQL Server 2012的探查器的SQL Server 2012版本使用以下文件夹作为模板:

C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Profiler\Templates\Microsoft SQL Server\110

You can add a step that copies the template from some shared location into the expected local folder. Check the SQL Profiler Templates Missing - additional repair steps? for details.

The local folder depends on both the profiler's version as well as the version of the server you are connecting to.

For example, the SQL Server 2012 version of the profiler connecting to the SQL Server 2012 uses the following folder for templates:

C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Profiler\Templates\Microsoft SQL Server\110

更多推荐

本文发布于:2023-07-23 22:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1238177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模板   事件   CMD   SQL   Line

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!