Teradata 14.10获取当前执行查询时MonitorSQLText函数报错求助
Fixing Teradata 14.10 MonitorSQLText Error 9881
Got it, let's figure out why you're hitting that 9881 error when trying to pull active queries in Teradata 14.10.
The Root Cause
Your current query passes 3 parameters to MonitorSQLText, but the 14.10 version of this function only accepts 2 arguments. That's exactly what the error is telling you—invalid number of parameters.
Correct Syntax for Teradata 14.10
Here's the valid parameter signature for MonitorSQLText in 14.10:
SELECT * FROM TABLE (MonitorSQLText(session_id, filter_pattern)) AS T;
Let's break down each parameter clearly:
session_id: Use-1to fetch queries from all active sessions (which matches your original intent). You can also plug in a specific session ID if you only care about monitoring one single session.filter_pattern: Your'*'works perfectly here—it acts as a wildcard to match all SQL text. If you wanted to narrow results, you could use a more specific pattern like'%INSERT%'to only see insert queries, for example.
Working Query Example
Swap your original query for this one, and it should resolve the error:
SELECT * FROM TABLE (MonitorSQLText(-1, '*')) AS T2;
Quick Extra Tips
- That third parameter you tried to use (the
0) is a feature added in newer Teradata versions (post-14.10)—it's not supported in 14.10, so we can omit it entirely. - Double-check you have the right privileges to run this function. Usually, you need the
MONITORrole or explicit access granted toMonitorSQLTextto pull active query data.
内容的提问来源于stack exchange,提问作者madsthiru
相关产品推荐
相关产品推荐

