bcp 錯誤匯入問題解決

來源:互聯網
上載者:User

sybase bcp 錯誤大全 Sybase BCP 錯誤總結
一. Bcp 錯誤

ct_connect(): network packet layer: internal net library error: Net-Lib protocol driver call to connect two endpoints failed
Establishing connection failed.
無法串連遠程伺服器

cs_convert: cslib user api layer: common library error: The conversion/operation was stopped due to a syntax error in the source field.
CSLIB Message: - L0/O0/S0/N36/1/0:
匯入表對應的列數量不正確

cs_convert: cslib user api layer: common library error: The conversion/operation was stopped due to a syntax error in the source field.
匯入資料存在自增長列,但資料來源不存在自增長列

blk_rowxfer(): blk layer: internal BLK-Library error: Data truncated while doing local character set conversion. col = 3
匯入表對應的欄位長度不足

ct_sendpassthru(): network packet layer: internal net library error: Net-Library operation terminated due to disconnect
CTLIB Message: - L5/O3/S5/N5/5/0:

字元集錯誤

Server Message: HSUN - Msg 7415, Level 10, State 1:
The transaction log in database DBNAME is almost full.  Your transaction is being
suspended until space is made available in the log.

日誌滿,使用dump transaction DBNAME with truncate_only命令清日誌

二. Bcp 匯入不同字元集資料

bcp in到字元集是utf8的資料庫時使用以下的參數,這樣就可以解決java程式使用utf8字元集看中文是亂碼的問題
bcp dbname..tabname in filename -Uxx -Pxx -Sxx -Jcp936 -c -Y

三. 注意事項

1. Tempdb的大小

當Sybase執行bcp in指令碼時,會佔用匯入資料2倍的tempdb空間,因此在執行前要仔細估計最大的table的大小,保證有足夠的tempdb空間。當空間不夠時,要考慮用分割table或刪除陳舊資料的方法縮小table的大小,或者考慮增加tempdb的大小。

2. 資料庫配置選項的設定

當資料庫執行bcp in指令碼時會產生大量的log,為保證bcp in進程不致因為log溢出而中斷,應該設定database的選項“truncate log on chkpt”為“true”。

雖然Sybase資料庫是自最佳化的,但只要資料庫是動態,資料庫片段現象就會存在。在OLTP應用的場合,隨著資料的不斷增大,系統變得越來越緩慢,並且經常出現死結時,應該檢查資料庫的片段,並且採用以上方法進行最佳化。

實際上,應該定期做資料庫的磁碟重組,保證資料庫的實體儲存體經常處於最優狀態,相對於增加硬體而言,這是一種更好的保持資料庫效能的低成本的途徑。
 
 
錯誤:
BCP insert operation is disabled when data size is changing between client and server character sets. Please use BCP's -Y option to invoke client-side conversion.
解決方案:
將用戶端和伺服器端字元集設定一樣

聯繫我們

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