linux redhat8 & oracle9.01
我现在想让字符集由原来的ZHS16GBK 变成utf-8 
谢谢..请高手解决
最好用sqlplus*

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1815/1815886.xml?temp=.6168634
      

  2.   

    Unicode/UCS Transformation Format -8一种不等幅的编码方式
      

  3.   

    to  jiezhi(西域浪子) 
    我要是更改数据的字符集到utf-8,
    NLS_CHARACTERSET =???
      

  4.   

    NLS Setting for Oracle Environment 
    Database Level This way will effect for all sessions that are connected to the database server Add the following lines in init.ora file :
    NLS_LANGAUGE=THAI 
    NLS_TERRITORY=THAILAND  
    Environment level This way will effect only client that use this environment Terminal session 
    (Multi-user environment such as telnet)
    In UNIX environment, set the environment variable as:
    In born, korn shell
    $NLS_LANG=THAI_THAILAND.TH8TISASCII; export NLS_LANG Win95/NT/2000 client 
    1. Run regedit, Registry window will appears 
    2. Select HKEY_LOCAL_MACHINE 
    3. Select SOFTWARE 
    4. Select ORACLE 
    5. Select NLS_LANG 
    Type the NLS_LANG and then enter the value THAI_THAILAND.TH8TISASCII 
     
    Session Level  This way will effect only current session. SQL> alter session set NLS_LANGUAGE=THAI; 
    SQL> alter session set NLS_TERRITORY=THAILAND;  Thai Sorting 
    You can set kind of dictionary on environment level or session level
    Sample in born shell $ NLS_SORT=THAI_DICTIONARY;export NLS_SORT  
    Thai Buddha Calandar  
    You can set kind of dictionary on environment level or session levelSample in born shell $ NLS_CALANDAR = 'Thai Buddha'or
    run 'regedit', set NLS_LANG=THAI_THAILAND.TH8TISASCII and add NLS_CALANDAR = Thai Buddha  How to check current database character set? 
    1. Use SQL*Plus connect to database by using any user.
    2. Enter the following SELECT command. SQL> SELECT * FROM V$NLS_PARAMETERS; 
    or 
    SQL> select * from nls_database_parameters;  How to check current environment value? 
    1. Use SQL*Plus connect to database by using any user. 
    2. Enter the following SELECT command. SQL> select * from nls_session_parameters;  How to change database character set ? 
    Version 7.3.4 - by updating props% view 
    PROPS$ is an important view, it shows some NLS parameters. 
    Changing these parameters will effect with database NLS parameters. 
    Before changing it, please backup your database first. Warning: 
    If you do it wrongly, your database will be absalutely gone. 
    And you can't use this way in Oracle 8 and later version.Steps to change
    1. Use SQL*Plus connect to database as user SYS
    2. Issue this below command SQL> UPDATE PROPS$ SET VALUE$='TH8TISASCII' WHERE NAME='NLS_CHARACTERSET'; 3. Shutdown database and restart it
     
    8.0.X  
    For Oracle 8, there is ALTER DATABASE CHARACTER SET command to change database character set. 
    The "update props$" cannot be used in this version.
     
    8.1.X  
    For Oracle 8i, there is ALTER DATABASE CHARACTER SET command to change database character set. 
    The "update props$" cannot be used in this version.You can change database character set by doing the following steps. 
    In this case SID name is fujudb. Login to oracle Database server as sys privilege:SQLPLUS> connect sys/change_on_install as sysdba;
    SQLPLUS> shutdown immediate;
    SQLPLUS> startup mount;
    SQLPLUS> alter system enable restricted session;
    SQLPLUS> alter system set job_queue_processes=0;
    SQLPLUS> alter system set aq_tm_processes=0; 
    SQLPLUS> alter database open; 
    SQLPLUS> alter database fujudb character set TH8TISASCII;
    SQLPLUS> alter database fujudb national character set TH8TISASCII;
    SQLPLUS> shutdown immediate;
    SQLPLUS> startup;  
    Warning 
    You can't change character set of current database that have number of bits greater than the new one. For example,US7ASCII -> WE8ISO8859P1 => Can
    TH8TISASCII -> US7ASCII => Cannot
    WE8ISO8859P1 -> TH8TISASCII => Cannot 
    TH8TISASCII -> WE8ISO8859P1 => Can
    US7ASCII -> TH8TISASCII => Can How to force client not to convert character set? 
    set ORA_NLS_CHARACTERSET_CONVERSION in environment level in korn shell  
    $export ORA_NLS_CHARACTERSET_CONVERSION=NO_CHARACTER_SET_CONVERSION  The NLS_LANG parameter 
    The NLS_LANG parameter has 3 components (language, territory, and character set) in the form: 
    NLS_LANG = language_territory.charset Each component controls the operation of a subset of NLS features: language 
    Specifies conventions such as the language used for Oracle messages, sorting, day names, 
    and month names. territory 
    Specifies conventions such as the default date, monetary, and numeric formats. charset 
    Specifies the character set used by the client application. 
    For example, US7ASCII, WE8ISO8859P1, TH8TISASCII, or JA16EUC.ref: Oracle9i Globalization Support Guide Release 1 (9.0.1) Part Number A90236-02 
        看明白了再做,要慎重!