tts和字元集的關係--要求源和目的端的資料庫字元集必須一樣,國家字元集必須一樣。,tts字元集

來源:互聯網
上載者:User

tts和字元集的關係--要求源和目的端的資料庫字元集必須一樣,國家字元集必須一樣。,tts字元集
tts和字元集的關係--要求源和目的端的資料庫字元集必須一樣,國家字元集必須一樣。
imp sys/as TRANSPORT_TABLESPACE=Y datafiles= C:\oracle\product\10.2.0\oradata\a\test01.dbf' file=c:\tts_test.dmp log=c:\imp_tts.log

IMP-00058: ORACLE error 1017 encounteredORA-01017: invalid username/password; logon deniedUsername: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V09.02.00 via conventional pathAbout to import transportable tablespace(s) metadata...import done in ZHS16GBK character set and AL16UTF16 NCHAR character setexport client uses AL32UTF8 character set (possible charset conversion). importing SYS's objects into SYS. importing SYS's objects into SYSIMP-00017: following statement failed with ORACLE error 29345: "BEGIN   sys.dbms_plugts.beginImport ('9.2.0.1.0',873,'2000',NULL,'NULL',303" "17,21201,1); END;"IMP-00003: ORACLE error 29345 encounteredORA-29345: cannot plug a tablespace into a database using an incompatible character setORA-06512: at "SYS.DBMS_PLUGTS", line 2386ORA-06512: at "SYS.DBMS_PLUGTS", line 1946ORA-06512: at line 1IMP-00000: Import terminated unsuccessfully
AL32UTF8 上匯出,ZHS16GBK 上匯入 報的錯。

oracle 中文顯示為問號,怎解決,用戶端與服務端字元集一樣的

Oracle資料庫字元集最有用的參數是NLS_LANG參數,格式如下: NLS_LANG = language_territory.charset

anguage:伺服器訊息的語言, 是中文還是英文
Territory: 伺服器的日期和數字格式,
Charset: 指定字元集。
登入以sysdba登入,查看視圖select * from v$nls_parameters,可以知道具體的字元集參數,
正常的應該是
1NLS_LANGUAGE=SIMPLIFIED CHINESE

2NLS_TERRITORY=CHINA

3NLS_CHARACTERSET=ZHS16GBK
然後有問題就去修改參數檔案裡面的參數,最好做個備份哦!
因為改字元集有風險。
用戶端設定(linux)
$NLS_LANG=“simplified chinese”_china.zhs16gbk
$export NLS_LANG
.資料庫伺服器字元集
select * from nls_database_parameters
是表示資料庫的字元集,或者v$nls_parameters

用戶端字元集環境
select * from nls_instance_parameters
或者v$parameter,表示用戶端的字元集的設定,可能是參數檔案,環境變數或者是註冊表

會話字元集環境
select * from nls_session_parameters
v$nls_parameters,表示會話自己的設定,可能是會話的環境變數或者是alter session完成,如果會話沒有特殊的設定,將與nls_instance_parameters一致。
以上都沒問題 就會OK了,
(僅供參考,若有雷同純屬巧合)
 
怎查看Oracle資料庫字元集,詳細操作,xx

資料庫伺服器字元集select * from nls_database_parameters,其來源於props$,是表示資料庫的字元集。
  
  用戶端字元集環境select * from nls_instance_parameters,其來源於v$parameter,
  
  表示用戶端的字元集的設定,可能是參數檔案,環境變數或者是註冊表
  
  會話字元集環境select * from nls_session_parameters,其來源於v$nls_parameters,表示會話自己的設定,可能是會話的環境變數或者是alter session完成,如果會話沒有特殊的設定,將與nls_instance_parameters一致。
  
  用戶端的字元集要求與伺服器一致,才能正確顯示資料庫的非Ascii字元。如果多個設定存在的時候,alter session>環境變數>註冊表>參數檔案
  
  字元集要求一致,但是語言設定卻可以不同,語言設定建議用英文。如字元集是zhs16gbk,則nls_lang可以是American_America.zhs16gbk。

涉及三方面的字元集,
1. oracel server端的字元集;
2. oracle client端的字元集;
3. dmp檔案的字元集。

在做資料匯入的時候,需要這三個字元集都一致才能正確匯入。

2.1 查詢oracle server端的字元集
有很多種方法可以查出oracle server端的字元集,比較直觀的查詢方法是以下這種:
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

SQL>select userenv(‘language’) from dual;
AMERICAN _ AMERICA. ZHS16GBK

2.2 如何查詢dmp檔案的字元集
用oracle的exp工具匯出的dmp檔案也包含了字元集資訊,dmp檔案的第2和第3個位元組記錄了dmp檔案的字元集。如果dmp檔案不大,比如只有幾M或幾十M,可以用UltraEdit開啟(16進位方式),看第2第3個位元組的內容,如0354,然後用以下SQL查出它對應的字元集:
SQL> select nls_charset_name(to_number('0354','xxxx')) from dual;
ZHS16GBK

如果dmp檔案很大,比如有2G以上(這也是最常見的情況),用文字編輯器開啟很慢或者完全打不開,可以用以下命令(在unix主機上):
cat exp.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c 3-6
然後用上述SQL也可以得到它對應的字元集。

2.3 查詢oracle client端的字元集
在windows平台下,就是註冊表裡面相應OracleHome的NLS_LANG。還可以在dos視窗裡面自己設定,
比如: set nls_lang=AMERICAN_AMERICA.ZHS16GBK
這樣就隻影響這個視窗裡面的環境變數。

在unix平台下,就是環境變數NLS_......餘下全文>>
 

相關文章

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.