遇到一个ora-02248: invalid option for ALTER SESSION的错误.环境是
java/10g instant client连接到
Oracle 9206 数据库发生的
Java 报告的错误:
WARN support.SQLErrorCodesFactory – Error while extracting database product name – falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00604: error occurred at recursive SQL level 1
ORA-02248: invalid option for ALTER SESSION
)
当时连接不到网络,上不去Metalink,只好托Donny帮忙查一下,信息不太多.
后来自己没有办法,只好死马当作活马医,设置Event跟踪.发现正常的连接有如下类似的操作:
ALTER SESSION SET NLS_LANGUAGE= ‘AMERICAN’ NLS_TERRITORY= ‘AMERICA’ NLS_CURRENCY= ‘$’
NLS_ISO_CURRENCY= ‘AMERICA’ NLS_NUMERIC_CHARACTERS= ‘.,’ NLS_CALENDAR= ‘GREGORIAN’ NLS_DATE_FORMAT= ‘DD-MON-RR’
NLS_DATE_LANGUAGE= ‘AMERICAN’ NLS_SORT= ‘BINARY’ TIME_ZONE= ‘+08:00’ NLS_DUAL_CURRENCY = ‘$’ NLS_TIME_FORMAT = ‘HH.MI.SSXFF AM’
NLS_TIMESTAMP_FORMAT = ‘DD-MON-RR HH.MI.SSXFF AM’
NLS_TIME_TZ_FORMAT = ‘HH.MI.SSXFF AM TZR’
NLS_TIMESTAMP_TZ_FORMAT = ‘DD-MON-RR HH.MI.SSXFF AM TZR’
END OF STMT
而出错的连接有如下的Trace信息:
ALTER SESSION SET NLS_LANGUAGE= ‘SIMPLIFIED CHINESE’ NLS_TERRITORY= ‘CHINA’ NLS_CURRENCY= ‘£¿ NLS_ISO_CURRENCY= ‘CHINA’ NLS_NUMERIC_CHARACTERS= ‘.,’ NLS_CALENDAR= ‘GREGORIAN’ NLS_DATE_FORMAT= ‘DD-MON-RR’ NLS_DATE_LANGUAGE= ‘SIMPLIFIED CHINESE’
NLS_SORT= ‘BINARY’ TIME_ZONE= ‘+08:00′ NLS_COMP=’BINARY’ NLS_DUAL_CURRENCY = ‘£¿
NLS_TIME_FORMAT = ‘HH.MI.SSXFF AM’
NLS_TIMESTAMP_FORMAT = ‘DD-MON-RR HH.MI.SSXFF AM’
NLS_TIME_TZ_FORMAT = ‘HH.MI.SSXFF AM TZR’
NLS_TIMESTAMP_TZ_FORMAT = ‘DD-MON-RR HH.MI.SSXFF AM TZR’
修改NLS_LANG之后即可正常登录数据库
修改客户端的nls_lang?
由于在环境变量中修改了nls_date_format=’yyyy-mm-dd hh24:mi:ss’
之后就出现了ora-02248
由于在环境变量中修改了nls_date_format=’yyyy-mm-dd hh24:mi:ss’
之后就出现了ora-02248
我刚装的也是,后台删除nls_date_format=’yyyy-mm-dd hh24:mi:ss’
就ok