您现在的位置是:首页 >

微信迁移工具 IBM DB2 的数据复制、迁移方法[1]

火烧 2023-04-08 23:04:32 1094
IBM DB2 的数据复制、迁移方法[1] 以下方法经测试 在环境IBM x G× G RAID DB V Wi Adv Server DMS表空间中 数据的load速度在 万条/mi 左右 背景 需

IBM DB2 的数据复制、迁移方法[1]  

    以下方法经测试 在环境IBM x G× G RAID DB V Win Adv Server DMS表空间中 数据的load速度在 万条/min左右

    背景 需要更改数据库表空间 或者需要将数据库中所有表的数据迁移到一个新的数据库中

    步骤

     通过db 控制台(db cc)选中源数据库中的所有表 将其导出成DDL脚本;

     根据需要对脚本进行必要的修改 譬如更改表空间为GATHER;

     新建数据库 新建DMS表空间:GATHER;

     将DDL脚本在此数据库中执行;

     编写代码查询源数据库中的所有表 自动生成export脚本;

     编写代码查询源数据库中的所有表 自动生成import脚本;

     连接源数据库执行export脚本;

     连接目标数据库执行import脚本;

微信迁移工具 IBM DB2 的数据复制、迁移方法[1]

    附录:生成export脚本代码示例:/**     * 创建导出脚本

    * @param conn

    * @param creator 表创建者

    * @param filePath

    */

    public void createExportFile(Connection conn String creator String filePath) throws Exception {

    DBBase dbBase = new DBBase(conn);

    String selectTableSql = select name from sysibm systables where creator = + creator + and type= T ;

    try {

    dbBase executeQuery(selectTableSql);

    } catch (Exception ex) {

    throw ex;

    } finally {

    dbBase close();

    }

    DBResult result = dbBase getSelectDBResult();

    List list = new ArrayList();

    while (result next()) {

    String table = result getString( );

    list add(table);

    }

    StringBuffer sb = new StringBuffer();

    String enterFlag = rn ;

    for (int i = ; i < list size();i++) {

    String tableName = (String)list get(i);

    sb append( db export to aa + String valueOf(i+ )+ ixf of ixf select * from + tableName + );

lishixinzhi/Article/program/DB2/201311/21944  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码