Oracle Database 11g Express Edition修改字元集

來源:互聯網
上載者:User

標籤:style   blog   io   ar   color   os   使用   sp   資料   

為什麼要修改字元集?

使用使用者system,通過sqlplus程式串連到Oracle資料庫,輸入以下命令,查看字元集:

SQL> select userenv(‘language‘) from dual;USERENV(‘LANGUAGE‘)----------------------------------------------------AMERICAN_AMERICA.AL32UTF8SQL>

我們可以看到查到的字元集為“AMERICAN_AMERICA.AL32UTF8”,而國內資料庫常用的字元集為“ZHS16GBK”。

例如:某欄位在企業版中定義的為varchar2(4),儲存資料為‘‘田田‘‘,則匯入oraclexe時,該欄位定義仍為varchar2(4),但資料‘‘田田‘‘就需要佔用6個字元長度,出現的問題如下所示:

IMP-00019: 由於 ORACLE 錯誤 12899 而拒絕行
IMP-00003: 遇到 ORACLE 錯誤 12899
ORA-12899: 列 "TEST"."TEST_TIANYC"."A" 的值太大 (實際值: 6, 最大值: 4)

此時就需要按照以下操作說明進行操作後即可解決問題。

操作說明:

開始菜單-->所有程式-->Oracle Database 11g Express Edition-->運行SQL命令列,啟動sqlplus程式。

由於sqlplus程式不支援直接在程式視窗中右鍵,進行複製、粘貼等操作,所以博主採用的是在運行命令列中啟動sqlplus程式。

開始菜單-->運行-->輸入cmd,並斷行符號-->開啟cmd命令列。

Microsoft Windows [版本 6.1.7601]著作權 (c) 2009 Microsoft Corporation。著作權所有,並保留一切權利。C:\Users\Candy>C:\oraclexe\app\oracle\product\11.2.0\server\bin\sqlplus.exe /nologSQL*Plus: Release 11.2.0.2.0 Production on 星期三 11月 26 12:11:59 2014Copyright (c) 1982, 2010, Oracle.  All rights reserved.SQL> connect system as sysdba輸入口令:已串連。SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。ORACLE 常式已經關閉。SQL> startup mountORACLE 常式已經啟動。Total System Global Area  644468736 bytesFixed Size                  1385488 bytesVariable Size             192941040 bytesDatabase Buffers          444596224 bytesRedo Buffers                5545984 bytes資料庫裝載完畢。SQL> alter system enable restricted session;系統已更改。SQL> alter system set JOB_QUEUE_PROCESSES=0;系統已更改。SQL> alter system set AQ_TM_PROCESSES=0;系統已更改。SQL> alter database open;資料庫已更改。SQL> alter database character set internal_use ZHS16GBK;資料庫已更改。SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。ORACLE 常式已經關閉。SQL> startupORACLE 常式已經啟動。Total System Global Area  644468736 bytesFixed Size                  1385488 bytesVariable Size             192941040 bytesDatabase Buffers          444596224 bytesRedo Buffers                5545984 bytes資料庫裝載完畢。資料庫已經開啟。SQL> select userenv(‘language‘) from dual;USERENV(‘LANGUAGE‘)----------------------------------------------------SIMPLIFIED CHINESE_CHINA.ZHS16GBKSQL>

此時,再進行資料匯入或者在欄位類型為varchar2(4)的欄位插入“田田”,就不會報錯了。

修改字元集後可能導致navicat連不上Oracle資料庫,請在菜單-->工具-->選項-->其他-->OCI中將OCI library(oci.dll)的值修改為

C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll,點擊確定後,重啟navicat即可。

Oracle Database 11g Express Edition修改字元集

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.