OracleDatabase character set (1) -- Case Analysis: One Database Export (exp) Case Analysis 1) database character set 12: 40: 37SYS @ prodshowparameternlsNAME & n ..
OracleDatabase character set (1) -- Case Analysis: One Database Export (exp) Case Analysis 1) database character set 12: 40: 37SYS @ prodshowparameternlsNAME & n ..
Oracle Database character set (1) -- Case Study
Case Analysis:
Case Study of One Database Export (exp)
1) database Character Set
12:40:37 SYS @ prod> show parameter nls
Name type value ------------------------------------ ----------- -------------------------------- nls_language string AMERICANnls_territory string AMERICA
12:40:49 SYS @ prod> select userenv ('language') from dual;
USERENV ('language') ---------------------------------------------------- AMERICAN_AMERICA.ZHS16GBK
12:41:15 SYS @ prod> select to_char (nls_charset_id ('zhs16gbk'), 'xxx') from dual;
TO_CH ----- 354
2. Export table (EXP)
[Oracle @ rh6 exp] $ exp scott/tiger file = emp. dmp indexes = n log = emp. log tables = emp
Export: Release 11.2.0.1.0-Production on Tue Aug 12 12:43:18 2014
Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
Server uses ZHS16GBK character set (possible charset conversion)
Note: indexes on tables will not be exported
About to export specified tables via Conventional Path...
.. Exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
@ Export Error
[Oracle @ rh6 ~] $ Oerr exp 00091
00091,000 00, "Exporting questionable statistics. "// * Cause: Export was able export statistics, but the statistics may not be // usuable. the statistics are questionable because one or more of // the following happened during export: a row error occurred, client // character set or NCHARSET does not match with the server, a query // clause was specified on export, only certain partitions or // subpartitions were exported, or a fatal error occurred while // processing a table. // * Action: To export non-questionable statistics, change the client character // set or NCHARSET to match the server, export with no query clause, // export complete tables. if desired, import parameters can be // supplied so that only non-questionable statistics will be imported, // and all questionable statistics will be recalculated.
3. view the Client Character Set
[Oracle @ rh6 ~] $ Echo $ LANG
En_US.UTF-8
4. view the exported file Character Set
[Oracle @ rh6 exp] $ cat emp. dmp | od-x | head-1 | awk '{print $2 $3}' | cut-c 3-6
0345
5. view the exported file character set through ultraedit
@ From the perspective of 2 and 3 bytes, The hexadecimal code of the character set is '123'
13:36:27 SYS @ prod> select nls_charset_name (to_number ('123', 'xxx') from dual;
NLS_CHARSET_NAME (TO_NUMBER ('123', 'xxxx' ---------------------------------------- US7ASCII
@ '000000': the character set is 'us7ascii '. A conversion occurs during export.
6. Modify the client Character Set
[Oracle @ rh6 ~] $ Cat. bash_profile
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
[Oracle @ rh6 ~] $ Echo $ NLS_LANG
AMERICAN_AMERICA.ZHS16GBK
[Oracle @ rh6 ~] $ Echo $ LANG
En_US.UTF-8
7. Re-export table (EXP)