长话短说,一些同事正在运行一个非常古老的设置(x86_64中的oc4j jdk1.5.6),其中一个应用程序恰好是关键任务.他们最近尝试部署新版本的应用程序,但是一旦他们执行java进程就会抛出核心转储并死掉.
问题是,核心转储看起来很好,gdb可以打开它们,但jmap和其他工具拒绝处理它们:
# /usr/java/jdk1.5.0_06/bin/jmap /usr/java/jdk1.5.0_06/bin/java core
Attaching to core core from executable /usr/java/jdk1.5.0_06/bin/java, please wait...
Error attaching to core file: Can't attach to the core file
Run Code Online (Sandbox Code Playgroud)
更新的版本抛出异常:
# jdk1.6.0_45/bin/jmap /usr/java/jdk1.5.0_06/bin/java core
Attaching to core core from executable /usr/java/jdk1.5.0_06/bin/java, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.tools.jmap.JMap.runTool(JMap.java:179)
at sun.tools.jmap.JMap.main(JMap.java:110)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 20.45-b01. Target VM is 1.5.0_06-b05
at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:224)
at sun.jvm.hotspot.runtime.VM.<init>(VM.java:287)
at sun.jvm.hotspot.runtime.VM.initialize(VM.java:357)
at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:594)
at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:494) …Run Code Online (Sandbox Code Playgroud) 我最近发现可以像这样调用jdbc中的aoymous块:
String plsql = "BEGIN" +
" :result := foobar( booleanparameter => :mypar > 2);" +
"END;";
con.prepareCall(plsql);
这很好,因为我可以使用它来"包装"一些函数调用并克服一些jdbc限制.例如,我不能将布尔变量传递给pl/sql过程,并且不能更改过程签名,因为有很多代码依赖于它们.由于内部政策原因,添加新的"包装"程序也不容易.
所以它似乎是一个可接受的解决方案,但是,我担心解析开销.像这样存储的匿名块是在SGA中解析还是在每次调用它们时进行解析?
谢谢
更新1:我已经制作了一个快速的beanhell脚本来查看v $ sqlarea,因为egorius建议:
String plsql = "BEGIN :myresult := dbms_random.random ; END;";
OracleDriver oracledrv = new OracleDriver();
Connection con = oracledrv.connect(connstr, new Properties());
for (int i = 0 ; i < 1000 ; i++ ) {
CallableStatement cb = con.prepareCall(plsql);
cb.registerOutParameter("myresult", Types.INTEGER);
cb.execute();
System.out.println("random ->" +cb.getInt("myresult"));
cb.close();
}
con.close();
这就是我得到的v $ sqlarea(我已经运行了两次):
SQL_TEXT -------------------------------------------------------------------------------- PARSE_CALLS EXECUTIONS ----------- ---------- …