28、数据迁移
db2提供了很多工具,如:export,import,load,db2look,db2move,db2dart
db2支持的文件格式:del,asc,pc/ixf 和wsf,wsf主要用在lotus1-2-3,新版本中将不在支持。
pc/ixf是IBM特定的二进制格式,适用于在异构平台间进行数据迁移,优点时数据占用空间小,而且包含表结构的定义,可以通过ixf文件重建表
cursor适用于表间的数据库迁移,只有load支持游标,其余几种工具不支持
declare mycursor cursor for select col1,col2,col3 from t1 load from mycursor of cursor insert into t2;
export 适用于表的数据导出到文件中
将emp数据导出到emp.del中,并记录消息
db2 "export to emp.del of del messages emp.msg select * from emp"
export导出数据,用‘’分隔字符串,不是用默认的“”
export "export to emp.del of del modified by chardel'' message emp.msg select * from emp"
导出大对象,1 modified by lobsinfile 大对象字段的所有值都保存到一个文件中
db2 "export to emp.del of del lobs to d:\temp modified by lobsinfile select * from emp"
2 modified by lobsinsepfiles 大对象字段的每个值都存在一个独立的文件中
db2 "export to emp.del of del lobs to d:\temp modified by lobsinsepfiles select * from emp"
导入数据import,将文件数据导入到emp
db2 "import from emp.del of messages emp.msg insert into emp"
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12961536/viewspace-1061362/
,如需转载,请注明出处,否则将追究法律责任。