loading ...
loading...

2006-11-08 | 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应用的场合,随着数据的不断增大,系统变得越来越缓慢,并且经常出现死锁时,应该检查数据库的碎片,并且采用以上方法进行优化。

实际上,应该定期做数据库的碎片整理,保证数据库的物理存储经常处于最优状态,相对于增加硬件而言,这是一种更好的保持数据库性能的低成本的途径。

分享 分享 |  评论 (4) |  阅读 (?)  |  固定链接 |  类别 (资料) |  发表于 19:41  | 最后修改于 2006-11-09 13:03
搜狐博客温馨提示:警惕博客留言诈骗, 搜狐博客管理员的正确地址为http://admin.blog.sohu.com, 其他都是冒牌。搜狐博客官方不会要求参加活动的各位博友缴纳任何的手续费用。请勿轻信留言、评论中的中奖信息,更不要拨打陌生电话及向陌生帐户汇款,谨防受骗!识别更多网络骗术,请 点击查看详情
正在读取评论信息...
您还未登录,只能匿名发表评论。或者您可以 登录 后发表。
 
  一个单亲妈妈的心愿:治好7岁儿子的白血病
表  情:
加载中...
回复通知: 同时用小纸条通知对方该回复