2008年10月28日星期二

ORA-12705错误

ORA-12705: "invalid or unknown NLS parameter value specified"

Cause: There are two possible causes:

- An attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value.

- The NLS_LANG environment variable contains an invalid language, territory, or character set. (大部分人碰到的是这种情况)

Action: Check the syntax of the ALTER SESSION command and the NLS parameter, correct the syntax and retry the statement, or specify correct values in the NLS_LANG environment variable.

以下是metalink给出的碰见下列情况就有可能会报这个错误:
1. ORA-12705 with incorrect NLS_LANG parameter
2. ORA-12705 with incorrectly specified ORA_NLSx
3. ORA-12705 from incorrect Oracle install or configuration
4. ORA-12705 when using Special Character sets
5. ORA-12705 when connecting with SQL*Net
6. ORA-12705 during migrations
7. ORA-12705 when connecting with SQL*Plus
8. ORA-12705 when connecting with language pre-compilers
9. ORA-12705 during Export/Import

通常情况的解决办法(检查并修改NLS_LANG,NLSPATH,LANG):
unix下(也包括linux):
NLS_LANG=american_america.we8iso8859p1
export NLS_LANG

NLSPATH=NLSPATH=$NLSPATH:/usr/xxx
export NLSPATH

LANG=en_US
export LANG

如果是windows平台下则需要修改注册表:\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE,修改相应的参数即可。
也可以使用如下命令:C:>set NLS_LANG=

如果是.net连接ORACLE报这个错误,请看这篇文章。如果是在ECLIPSE平台的DATA EXPLORER里连接ORACLE数据库报这个错误,则需要检查相应的配置文件eclipse.ini,将Duser.language设置为合适的值。

没有评论: