Linux Oracle中文字元亂碼問題的解決

來源:互聯網
上載者:User

1)查看資料庫字元集

03:12:58 SQL> select userenv('language') from dual;

USERENV('LANGUAGE')

----------------------------------------------------

AMERICAN_AMERICA.ZHS16GBK

2)編輯linux 的NLS_LANG變數

03:13:20 SQL> !

[oracle@oraserv ~]$ pwd

/home/oracle

[oracle@oraserv ~]$ ls -a

.                      cr_dbprod.sql  .gconfd            .ICEauthority  .rman_history     .Xauthority

cr_db.sql      .gnome             logmnr         sel.sql           .xsession-errors

.bash_history          cr_dict.sql    .gnome2            .metacity      sql.log           中國

.bash_logout           Desktop        .gnome2_private    .mozilla       sqlnet.log

.bash_profile          .dmrc          .gstreamer-0.10    .nautilus      .sqlplus_history

.bashrc                .eggcups       .gtkrc-1.2-gnome2  ora.sh         s.sh

close_bak_command.sql  ftp.msg        hot_bak_cmd.sql    ora.txt        start.sh

cold_bak.sql           .gconf         hot_bak.sql        .redhat        .Trash

[oracle@oraserv ~]$ vi .bashrc

# .bashrc

# Source global definitions

if [ -f /etc/bashrc ]; then

. /etc/bashrc

fi

# User specific aliases and functions

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

".bashrc" 10L, 167C written

本文URL地址:http://www.bianceng.cn/OS/Linux/201410/45427.htm

3)登出oracle使用者,重新登入

[oracle@oraserv ~]$ su - oracle

Password: ******

[oracle@oraserv ~]$ env |grep LANG

NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

LANG=en_US.UTF-8

[oracle@oraserv ~]$ export ORACLE_SID=prod

[oracle@oraserv ~]$ env |grep LANG

NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

LANG=en_US.UTF-8

[oracle@oraserv ~]$ !sql

sqlplus '/as sysdba';

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 8 03:15:59 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

03:16:02 SQL> conn scott/tiger

Connected.

03:16:08 SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID

------------------------------ ------- ----------

DEPT                           TABLE

EMP                            TABLE

BONUS                          TABLE

SALGRADE                       TABLE

03:16:16 SQL> update dept set dname='財務' where deptno=10;

1 row updated.

03:16:47 SQL> select * from dept;

DEPTNO DNAME          LOC

---------- -------------- -------------

10 財務   NEW YORK

20 RESEARCH       DALLAS

1)查看資料庫字元集

03:12:58 SQL> select userenv('language') from dual;

USERENV('LANGUAGE')

----------------------------------------------------

AMERICAN_AMERICA.ZHS16GBK

2)編輯linux 的NLS_LANG變數

03:13:20 SQL> !

[oracle@oraserv ~]$ pwd

/home/oracle

[oracle@oraserv ~]$ ls -a

.                      cr_dbprod.sql  .gconfd            .ICEauthority  .rman_history     .Xauthority

cr_db.sql      .gnome             logmnr         sel.sql           .xsession-errors

.bash_history          cr_dict.sql    .gnome2            .metacity      sql.log           中國

.bash_logout           Desktop        .gnome2_private    .mozilla       sqlnet.log

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.