神秘的 SQL 阻止我的存储过程在 ORACLE 上执行
我正在尝试使用瘦 jdbc 客户端和 c3p0 在 ORACLE 上运行一个过程。
这是应该运行的代码:
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("I_NODE_ID", nodeId);
paramMap.put("I_PARENT_ID", parentId);
paramMap.put("I_STRUCTURE_ID", structureId);
paramMap.put("I_FROM_DATE", beginTime);
paramMap.put("I_TO_DATE", END_OF_TIME);
new SimpleJdbcCall(jdbcTemplate).withProcedureName("TC_INSERT_NODE_A").execute(paramMap);
paramMap.put("I_NOW_DATE", currentTime);
new SimpleJdbcCall(jdbcTemplate).withProcedureName("TC_INSERT_NODE_B").execute(paramMap);
系统似乎挂起,并且以下查询在企业管理器上显示,占用了我的 CPU 的 100%。
SELECT package_name AS procedure_cat,
owner AS procedure_schem,
object_name AS procedure_name,
argument_name AS column_name,
DECODE(position,
0, 5,
DECODE(in_out,
'IN', 1,
'OUT', 4,
'IN/OUT', 2,
0)) AS column_type,
DECODE(data_type,
'CHAR', 1,
'VARCHAR2', 12,
'NUMBER', 3,
'LONG', -1,
'DATE', 91,
'RAW', -3,
'LONG RAW', -4,
'TIMESTAMP', 93,
'TIMESTAMP WITH TIME ZONE', -101,
'TIMESTAMP WITH LOCAL TIME ZONE', -102,
'INTERVAL YEAR TO MONTH', -103,
'INTERVAL DAY TO SECOND', -104,
'BINARY_FLOAT', 100,
'BINARY_DOUBLE', 101,
1111) AS data_type,
DECODE(data_type,
'OBJECT', type_owner || '.' || type_name,
data_type) AS type_name,
DECODE(data_precision,
NULL, data_length,
data_precision) AS precision,
data_length AS length,
data_scale AS scale,
10 AS radix,
1 AS nullable,
NULL AS remarks,
sequence,
overload,
default_value
FROM all_arguments
WHERE owner LIKE :1 ESCAPE '/' AND
object_name LIKE :2 ESCAPE '/' AND
package_name IS NULL AND
(argument_name LIKE :5 ESCAPE '/' OR
(argument_name IS NULL AND data_type IS NOT NULL))
ORDER BY procedure_schem, procedure_name, overload, sequence
这意味着什么?我应该从哪里开始寻找解决这个问题的方法?
I am trying to run a procedure on ORACLE with the thin jdbc client and c3p0.
here's the code that's supposed to run:
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("I_NODE_ID", nodeId);
paramMap.put("I_PARENT_ID", parentId);
paramMap.put("I_STRUCTURE_ID", structureId);
paramMap.put("I_FROM_DATE", beginTime);
paramMap.put("I_TO_DATE", END_OF_TIME);
new SimpleJdbcCall(jdbcTemplate).withProcedureName("TC_INSERT_NODE_A").execute(paramMap);
paramMap.put("I_NOW_DATE", currentTime);
new SimpleJdbcCall(jdbcTemplate).withProcedureName("TC_INSERT_NODE_B").execute(paramMap);
The system is seemingly hanging, and the following query appears on Enterprise Manager as taking up 100% of my CPU.
SELECT package_name AS procedure_cat,
owner AS procedure_schem,
object_name AS procedure_name,
argument_name AS column_name,
DECODE(position,
0, 5,
DECODE(in_out,
'IN', 1,
'OUT', 4,
'IN/OUT', 2,
0)) AS column_type,
DECODE(data_type,
'CHAR', 1,
'VARCHAR2', 12,
'NUMBER', 3,
'LONG', -1,
'DATE', 91,
'RAW', -3,
'LONG RAW', -4,
'TIMESTAMP', 93,
'TIMESTAMP WITH TIME ZONE', -101,
'TIMESTAMP WITH LOCAL TIME ZONE', -102,
'INTERVAL YEAR TO MONTH', -103,
'INTERVAL DAY TO SECOND', -104,
'BINARY_FLOAT', 100,
'BINARY_DOUBLE', 101,
1111) AS data_type,
DECODE(data_type,
'OBJECT', type_owner || '.' || type_name,
data_type) AS type_name,
DECODE(data_precision,
NULL, data_length,
data_precision) AS precision,
data_length AS length,
data_scale AS scale,
10 AS radix,
1 AS nullable,
NULL AS remarks,
sequence,
overload,
default_value
FROM all_arguments
WHERE owner LIKE :1 ESCAPE '/' AND
object_name LIKE :2 ESCAPE '/' AND
package_name IS NULL AND
(argument_name LIKE :5 ESCAPE '/' OR
(argument_name IS NULL AND data_type IS NOT NULL))
ORDER BY procedure_schem, procedure_name, overload, sequence
What does this mean? Where should I start looking to solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此 SQL 查询存储过程的参数。它看起来效率很低,因为它使用了几个(可能不必要的)LIKE 运算符。这可能会非常慢,特别是如果您的系统有大量 PL/SQL,尤其是 Oracle 11g,对于像这样的元数据查询来说,它会变得慢得多。
Spring 框架是否会在调用存储过程时运行这样的查询(我从未使用过 Spring)?
This SQL queries the parameters of a stored procedure. It looks very inefficient because it uses several (probably unnecessary) LIKE operators. This can be very slow, in particular if you have a system with lots of PL/SQL and in particular with Oracle 11g, which has gotten much slower for meta data queries like this.
Could it be that the Spring framework runs queries like this a part of calling a stored procedure (I've never used Spring)?