如何查找导致 SQL Server Profiler 跟踪中报告的错误的原因?
我正在使用分析器在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不用担心 208 错误。 208 是“未找到对象”。 Profiler 通过所谓的“延迟名称解析”来获取这些信息。
请执行以下步骤。
该过程将正常运行,没有任何错误,但是,如果您正在运行探查器跟踪,您将看到一两个错误 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.
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.
在 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.