db2数据迁移del,ixf

       在用db2 import from test.del of del  insert into table导入数据的时候,报错说有几条数据导入失败,但是导出的数据条数和导入的数据条数都与数据库中的数据条数是相等的,很奇怪,后来发现del文件是按行来存储数据的,因为在数据库的一个字段是按文本域存储数据,含有回车的文本内容在del文件中显示另起一行了,则导入数据的时候误认为是一条数据,但结构不对所以无法导入。后来换成ixf格式导出数据,再导入的时候就没有问题了。

       回头系统得理了一下DB2的数据迁移知识,大致如下:

       导出:export;导入:import,load;

       数据移动格式:ASC\DEL文本文件;WSF工作表格式,主要用于LOTUS软件;IXF集成交换格式;

       ASC,DEL,WSF在跨平台时可能会导致数据丢失,跨平台用IXF;DEL文件可视,IXF文件不可视。

       export命令:db2 export to test.ixf of ixf select * from table;

       import命令:db2 import from test.ixf of ixf insert_update into table;

       其中插入方式有以下几种:insert、insert_update、replace、replace_create(只支持ixf格式)、create(只支持ixf格式);

       db2move可以实现整个数据库的转移,语法格式为db2move <dbname> <action> <option>;其中action包括export、import、copy和load;命令:db2move mydatabase export就导入到当前目录下;

 

猜你喜欢

转载自hellohubin-yahoo-com-cn.iteye.com/blog/1869740