如何查找导致 SQL Server Profiler 跟踪中报告的错误的原因?

发布于 2024-07-19 04:11:15 字数 349 浏览 3 评论 0原文

我正在使用分析器在 Sql Server 2005 上运行跟踪,需要找出导致报告错误的原因。

我使用了“空白”模板,并选择了以下事件的所有列:

  • 异常
  • Exchange 溢出事件
  • 执行警告
  • 哈希警告
  • 缺少列统计信息
  • 缺少连接谓词

我注意到“TextData”列中存在许多此类错误:

  • 错误:156,严重性:16,状态:0
  • 错误:208,严重性:16,状态:0

我查找了错误(语法错误,对象名称无效),但如何判断哪些存储过程或查询导致了这些错误?

I was running a trace on a Sql Server 2005 using the profiler and need to find out what is causing the reported errors.

I used the "blank" template, and selected all columns of the following events:

  • Exception
  • Exchange Spill Event
  • Execution Warnings
  • Hash Warnings
  • Missing Column Statistics
  • Missing Join Predicate

I noticed a number of these errors in the "TextData" column:

  • Error: 156, Severity: 16, State: 0
  • Error: 208, Severity: 16, State: 0

I looked up the errors (Incorrect syntax, Invalid object name), but how can I tell what stored procedure or query is causing them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玉环 2024-07-26 04:11:15

不用担心 208 错误。 208 是“未找到对象”。 Profiler 通过所谓的“延迟名称解析”来获取这些信息。

请执行以下步骤。

CREATE PROCEDURE Demo AS
  CREATE TABLE #Temp (ID int)
  INSERT INTO #Temp VALUES (1)
  SELECT ID FROM #Temp
GO

该过程将正常运行,没有任何错误,但是,如果您正在运行探查器跟踪,您将看到一两个错误 208 的实例。这是因为当过程启动时,即代码启动时,表 #Temp 不存在被解析和绑定。 绑定到底层对象的过程失败。

一旦创建表运行,其他语句就会重新编译并绑定到正确的表,并且运行时不会出错。

您会看到延迟解析错误的唯一地方是探查器中。

Don't worry about the 208 errors. 208 is "Object not found". Profiler picks up these due to what's called 'deferred name resolution'.

Take the following procedure.

CREATE PROCEDURE Demo AS
  CREATE TABLE #Temp (ID int)
  INSERT INTO #Temp VALUES (1)
  SELECT ID FROM #Temp
GO

That proc will run fine without any errors however, if you have a profiler trace running, you'll see one or two instances of error 208. It's because the table #Temp doesn't exist when the proc starts, which is when the code is parsed and bound. The process of binding to the underlying objects fails.

Once the create table runs, the other statements get recompiled and bound to the correct table and run without error.

The only place you'll see that deferred resolution error is in profiler.

时常饿 2024-07-26 04:11:15

在 sql 2005 中你不能。
您必须运行 SQL:StmtStarting、SQL:StmtCompleted、用户错误消息和异常事件的探查器跟踪,其中包含您需要的 text、transactionId、EventSequence 和 otehr 列,以了解正在发生的情况。

in sql 2005 you can't.
you'll have to run the profiler trace of SQL:StmtStarting, SQL:StmtCompleted, User Error Message and Exception events with text, transactionId, EventSequence and otehr columns you need to get a picture of what's going on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文