问题是这样的,一个定时调度,需要从数据库查询数据,但是要查询的表是一张非常大的表,记录上亿条,直接把sql放到plsql客户端上手动查询需要20分钟左右,才能出结果,sql很简单,数据库有索引,所以查询时间无法优化,程序跑起来后每到这里就过不去了,一把在查询到10分钟左右就报这个异常
org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: 关闭的语句: getMetaData
### The error may exist in file [F:\works\target\classes\static\mybatis\xml\Tables.xml]
### The error may involve com.ultrasoft.satellite.dao.TablesMapper.selectOrderDateBySql
### The error occurred while handling results
### SQL: select l.filename "fileName", to_char(l.logdate, 'yyyy-MM-dd hh:mm:ss') "logDate", l.logcontent "logContent" from (select ROW_NUMBER() OVER(PARTITION BY c.filename ORDER BY c.logdate DESC) rn, c.* from arss.combussinessrunninglog c where c.filename in (select a.filename from arss.arcarchivestatus a where a.filenamedate >= to_date('2018-06-01', 'yyyy-MM-dd') and a.filenamedate < to_date('2018-07-01', 'yyyy-MM-dd') and exists (select t.filenamecode from arss.COMPRODUCTIONDEF t where t.filenamecode = a.productioncode and t.filenamecode in ('FY4A-_AGRI--_N_DISK_1047E_L0-_GRD-_MULT_NUL_YYYYMMDDhhmmss_YYYYMMDDhhmmss_00000_00001_AFNYYYYMMDDhhmmss.DAT','FY4A-_AGRI--_N_DISK_1047E_L0A_PRM-_MULT_NUL_YYYYMMDDhhmmss_YYYYMMDDhhmmss_00000_00001_AFNYYYYMMDDhhmmss.DAT','FY4A-_AGRI--_N_REGC_1047E_L1-_HRIT_C011_NOM_YYYYMMDDhhmmss_YYYYMMDDhhmmss_4000M_Skkll.DAT','FY4A-_AGRI--_N_REGC_1047E_L1-_HRIT_C012_NOM_YYYYMMDDhhmmss_YYYYMMDDhhmmss_4000M_Skkll.DAT','FY4A-_LMI---_N_REGX_1047E_L1B_ORI-_SING_NUL_YYYYMMDDHHMMSS_yyyymmddhhmmss_7800M_NmmVk.HDF') ) and (a.DATAGETFLAG = -2 or a.METADATAGETFLAG = -2 or a.DATAQUALITYFLAG = -2))) l where l.rn = 1 order by l.filename, l.updated desc
### Cause: java.sql.SQLException: 关闭的语句: getMetaData
; uncategorized SQLException for SQL []; SQL state [null]; error code [17009]; 关闭的语句: getMetaData; nested exception is java.sql.SQLException: 关闭的语句: getMetaData
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
at com.sun.proxy.$Proxy71.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231)

org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: 关闭的语句: getMetaData
### The error may exist in file [F:\works\target\classes\static\mybatis\xml\Tables.xml]
### The error may involve com.ultrasoft.satellite.dao.TablesMapper.selectOrderDateBySql
### The error occurred while handling results
### SQL: select l.filename "fileName", to_char(l.logdate, 'yyyy-MM-dd hh:mm:ss') "logDate", l.logcontent "logContent" from (select ROW_NUMBER() OVER(PARTITION BY c.filename ORDER BY c.logdate DESC) rn, c.* from arss.combussinessrunninglog c where c.filename in (select a.filename from arss.arcarchivestatus a where a.filenamedate >= to_date('2018-06-01', 'yyyy-MM-dd') and a.filenamedate < to_date('2018-07-01', 'yyyy-MM-dd') and exists (select t.filenamecode from arss.COMPRODUCTIONDEF t where t.filenamecode = a.productioncode and t.filenamecode in ('FY4A-_AGRI--_N_DISK_1047E_L0-_GRD-_MULT_NUL_YYYYMMDDhhmmss_YYYYMMDDhhmmss_00000_00001_AFNYYYYMMDDhhmmss.DAT','FY4A-_AGRI--_N_DISK_1047E_L0A_PRM-_MULT_NUL_YYYYMMDDhhmmss_YYYYMMDDhhmmss_00000_00001_AFNYYYYMMDDhhmmss.DAT','FY4A-_AGRI--_N_REGC_1047E_L1-_HRIT_C011_NOM_YYYYMMDDhhmmss_YYYYMMDDhhmmss_4000M_Skkll.DAT','FY4A-_AGRI--_N_REGC_1047E_L1-_HRIT_C012_NOM_YYYYMMDDhhmmss_YYYYMMDDhhmmss_4000M_Skkll.DAT','FY4A-_LMI---_N_REGX_1047E_L1B_ORI-_SING_NUL_YYYYMMDDHHMMSS_yyyymmddhhmmss_7800M_NmmVk.HDF') ) and (a.DATAGETFLAG = -2 or a.METADATAGETFLAG = -2 or a.DATAQUALITYFLAG = -2))) l where l.rn = 1 order by l.filename, l.updated desc
### Cause: java.sql.SQLException: 关闭的语句: getMetaData
; uncategorized SQLException for SQL []; SQL state [null]; error code [17009]; 关闭的语句: getMetaData; nested exception is java.sql.SQLException: 关闭的语句: getMetaData
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
at com.sun.proxy.$Proxy71.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231)










