一个Tomcat应用原先使用的数据库版本是Oracle8i,近期在往Oracle10g上迁移的时候,遇到了一些问题,在此先罗列一下现象和主要的解决办法,晚些时候再补充具体的过程吧(有的问题没有记录下来,也先空着号)。
问题现象01:
数据库访问页面,显示错误信息:ttcgcshnd-1
java.sql.SQLException: ORA-00600: 内部错误代码, 参数: [ttcgcshnd-1], [0], [], [], [], [], [], []...
解决方案01:使用正确的jdbc的驱动(class12.zip)
问题现象05:
数据库访问页面,显示错误信息:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
......
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
.......
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
解决方案05:Oracle Database Listener配置有问题
问题现象06:
提交的数据没有汉字时,程序不报错。如果有汉字,出现:ORA-01461 : can bind a LONG value only for insert into a LONG column 错误。
解决方案06:
classes12.jar的版本问题。可参考 http://www.blogjava.net/chenlb/archive/2009/05/04/154558.html.
问题现象07:显示的日期或时间与预期的有出入。如填写出生日期1986/05/04,却显示1986/05/03。
解决方案07:配置 Tomcat 的时区
问题现象08:显示查询结果列表的顺序与 8i 下显示的顺序不一致
我的有问题的语句是:
select y.xzqhdm,y.bmddm,to_char(y.bmdsj,'yyyy-mm-dd') bmdsj,y.cnt_sub,x.cnt_total,
to_char((y.cnt_sub/x.cnt_total)*100,'900.00') percent
from ( select a.xzqhdm,a.bmddm,count(*) cnt_total from t_bmddm a,t_bmdsj b,t_bmk c
where a.bmddm=b.bmddm and a.bmddm=c.bmddm and to_char(b.bmdsj,'yyyy-mm-dd')=c.bmyysj
group by a.xzqhdm,a.bmddm ) x, (
select a.xzqhdm,a.bmddm,b.bmdsj,count(*) cnt_sub from t_bmddm a,t_bmdsj b,t_bmk c
where a.bmddm=b.bmddm and a.bmddm=c.bmddm and to_char(b.bmdsj,'yyyy-mm-dd')=c.bmyysj
group by a.xzqhdm,a.bmddm,b.bmdsj ) y
where x.xzqhdm=y.xzqhdm and x.bmddm=y.bmddm ;
解决方案08:修改程序,增加 order by
问题现象09:
从 oracle10g1.2往1.1上导入的时候,表数据能正确导入,但中间夹杂着一些错误信息:
IMP-00017: following statement failed with ORACLE error 20001:
"BEGIN DBMS_STATS.SET_INDEX_STATS(NULL,'"SYS_C001199"',NULL,NULL,NULL,1,1,1"
",1,1,1,0,6); END;"
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
ORA-06512: at "SYS.DBMS_STATS", line 4572
ORA-06512: at line 1
IMP-00017: following statement failed with ORACLE error 20001:
"BEGIN DBMS_STATS.SET_TABLE_STATS(NULL,'"AFFICHE"',NULL,NULL,NULL,1,5,66,6)"
"; END;"
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
ORA-06512: at "SYS.DBMS_STATS", line 5167
ORA-06512: at line 1
IMP-00017: following statement failed with ORACLE error 20001:
"DECLARE SREC DBMS_STATS.STATREC; BEGIN SREC.MINVAL := 'C20212'; SREC.MAXVA"
"L := 'C20212'; SREC.EAVS := 0; SREC.CHVALS := NULL; SREC.NOVALS := DBMS_STA"
"TS.NUMARRAY(117,117); SREC.BKVALS := DBMS_STATS.NUMARRAY(0,1); SREC.EPC := "
"2; DBMS_STATS.SET_COLUMN_STATS(NULL,'"AFFICHE"','"ID"', NULL ,NULL,NULL,1,1"
",0,srec,4,6); END;"
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
ORA-06512: at "SYS.DBMS_STATS", line 4194
ORA-06512: at line 1
IMP-00017: following statement failed with ORACLE error 20001:
"DECLARE SREC DBMS_STATS.STATREC; BEGIN SREC.MINVAL := '32303038C4EAB0B2BBD"
"5CAA1B3C9C8CBB8DFD0A3D5D0C9FABFBCCAD4CAA1BFBC'; SREC.MAXVAL := '32303038C4E"
"AB0B2BBD5CAA1B3C9C8CBB8DFD0A3D5D0C9FABFBCCAD4CAA1BFBC'; SREC.EAVS := 0; SRE"
"C.CHVALS := NULL; SREC.NOVALS := DBMS_STATS.NUMARRAY(2605922191087360000000"
"00000000000000,260592219108736000000000000000000000); SREC.BKVALS := DBMS_S"
"TATS.NUMARRAY(0,1); SREC.EPC := 2; DBMS_STATS.SET_COLUMN_STATS(NULL,'"AFFIC"
"HE"','"TITLE"', NULL ,NULL,NULL,1,1,0,srec,51,6); END;"
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
ORA-06512: at "SYS.DBMS_STATS", line 4194
ORA-06512: at line 1
IMP-00017: following statement failed with ORACLE error 20001:
"DECLARE SREC DBMS_STATS.STATREC; BEGIN SREC.MINVAL := '323030382D30392D323"
"7'; SREC.MAXVAL := '323030382D30392D3237'; SREC.EAVS := 0; SREC.CHVALS := N"
"ULL; SREC.NOVALS := DBMS_STATS.NUMARRAY(26059221892530700000000000000000000"
"0,260592218925307000000000000000000000); SREC.BKVALS := DBMS_STATS.NUMARRAY"
"(0,1); SREC.EPC := 2; DBMS_STATS.SET_COLUMN_STATS(NULL,'"AFFICHE"','"TIME"'"
", NULL ,NULL,NULL,1,1,0,srec,11,6); END;"
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
ORA-06512: at "SYS.DBMS_STATS", line 4194
ORA-06512: at line 1
解决方案09:
导入命令加入statistics=none选项