我们项目在做crm2.0改造的时候全部在测试环境开发。生产系统上线的时候,需要迁移所有程序,表和数据。迁移方案很多。我们最终在
我们项目在做crm2.0改造的时候全部在测试环境开发。生产系统上线的时候,需要迁移所有程序,表和数据。迁移方案很多。我们最终在数据和表的迁移中选择了利用联邦数据库迁移的方案。具体思路是,,在目标库上建立到测试库的连接然后利用create table ddd like ddd 创建表接口,最后用游标装载数据。
--创建包装器
create wrapper fedb2 library 'libdb2drda.a' options (
add db2_fenced 'n'
);
--创建联邦server
create server fe206
type db2/udb
version '9.7'
wrapper fedb2
authorization odsdev
password odsdev
options (
add dbname 'cqtest1'
);
--创建用户映射
create user mapping for odsdev server fe206 options (
add remote_authid 'odsdev',
remote_password '******'
);
--创建nickname
create nickname tbowner.nt_cust for fe206.tbowner.cust;
--创建表结构
create table tbowner.cust like tbowner.nt_cust in tbs_ods_01 compress yes not logged initially ;
--装载数据
declare cur_xxx cursor for select * from tbowner.nt_cust ;
load from cur_xxx of cursor replace into tbowner.cust;
用shell封装下,就可以成为一个迁移工具。