Garbled question about oracle database import after use imp

Many people have encountered because of the different circumstances make the character set data import failed. This involves three aspects of the character set, one oracel server-side character set, the second is the oracle client-side character set; third dmp file character set. In doing data import requires the same three character sets can be imported correctly.

1, the query oracle server-side character set
  There are many ways to find oracle server-side character sets, more intuitive method is a query that: SQL> select userenv ( 'language') from dual;
  Results similar to the following: AMERICAN _ AMERICA ZHS16GBK.
2, how to query dmp document character set
  Oracle exp derived using the tool dmp file also contains the character set information, 2 and 3 bytes recorded dmp file character set dmp file. If not dmp file, such as only a few tens of M or M, can be used to open UltraEdit (hexadecimal), see the second and third bytes of content, such as 0354, and then the character corresponding to the following SQL it set:
  SQL> select nls_charset_name(to_number('0354','xxxx')) from dual;
  ZHS16GBK
  If the dmp file is large, such as a 2G or more (this is the most common case), open very slowly or completely open with a text editor, you can use the following command (in unix host):
  cat exp.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c 3-6
  SQL can then be obtained using the above set of characters corresponding to it.
3, the query oracle client-side character set
  This is relatively simple. In windows platform, which is the registry corresponding OracleHome of NLS_LANG. You can also set up their own in the dos window inside, such as:
  set nls_lang=AMERICAN_AMERICA.ZHS16GBK
  This affects only the environment variables inside the window.
  In the unix platform, it is the environment variable NLS_LANG.
  $echo $NLS_LANG
  AMERICAN_AMERICA.ZHS16GBK
  If the results of the inspection found that server-side and client-side character set is inconsistent, please unified modify the same with the server-side character set.
4. Set the client character set import and export

- Query Character Set

select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

--linux client
env | grep the NLS_LANG
Export AMERICAN_AMERICA.ZHS16GBK the NLS_LANG =

--windows client

echo %NLS_LANG%
set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

If you can not find linux environment NLS_LANG, you can re-set at the client character set environment (export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)

 

Guess you like

Origin www.cnblogs.com/zhangshuaihui/p/11974705.html