1. 程式人生 > >除錯經驗——ORA-29275: partial multibyte character的解決方案

除錯經驗——ORA-29275: partial multibyte character的解決方案

問題描述:

有個生產報表執行失敗,報錯:ORA-29275: partial multibyte character。藉助百度、Google前前後後試過多種方法,解決不掉。

後來,想到是否可以更改登錄檔中的NLS_LANG選項,問題還真解決了。

詳細解決方案:

1. 在登錄檔中修改Oracle NLS_LANG選項(需管理員許可權):

路徑:Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\oracle\KEY_OraClient11g_home1_32bit

NLS_LANG的當前值為:AMERICAN_AMERICA.WE8MSWIN1252,將其修改為:AMERICAN_AMERICA.AL32UTF8

2. 重啟電腦

3. 使用SQLPLUS執行相同的指令碼(Toad中不行,原因未知),不再報錯,可成功查詢出結果

補充說明:

能夠找到百度、Google中也沒有的解決方案,還是挺有成就感的!

延伸閱讀:

ORA-29275: partial multibyte character

Cause: The requested read operation could not complete because a partial multibyte character was found at the end of the input.

Action: Ensure that the complete multibyte character is sent from the remote server and retry the operation. Or read the partial multibyte character as RAW.

The core issue of that the nls_chracterset values for the multibyte character set does not match between either two databases in a distributed query, or a query where the webserver has a different character set.  There are several possible fixes for the ORA-29275 error, all involving getting the NLS character sets to match:

1 - write a function to convert each row.  Place this function inside a PL/SQL function and call it for each row of the table: CONVERT(COLUMN NAME,'NLS_CHARACTERSET','NLS_CHARACTERSET');

2 - If you have a webserver, try setting the NLS_LANG environmental variable on the webserver to american_america.al32utf8.