热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

IBM DB2 数据复制迁移方法

来源: 作者: 时间:2007-09-09 Tag: 点击:
附录2:生成import脚本代码示例

/**
* 创建装载脚本
* @param conn
* @param creator 表创建者
* @param filePath
*/
public void createLoadFile(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(1);
list.add(table);
}
StringBuffer sb = new StringBuffer();
String enterFlag = "\r\n";
for (int i = 0; i < list.size();i++) {
String tableName = (String)list.get(i);
sb.append("db2 \"load from aa" + String.valueOf(i+1)+ ".ixf of ixf into " + tableName + " COPY NO without prompting \"");
sb.append(enterFlag);
}
String str = sb.toString();
FileUtility.saveStringToFile(filePath, str, false);
}

  附录3:export脚本示例

  db2 connect to testdb user test password test
  db2 "export to aa1.ixf of ixf select * from table1"
  db2 "export to aa2.ixf of ixf select * from table2"
  db2 connect reset

  附录4:import脚本示例

  db2 connect to testdb user test password test
  db2 "load from aa1.ixf of ixf replace into table1 COPY NO without prompting "
  db2 "load from aa2.ixf of ixf replace into table2 COPY NO without prompting "
  db2 connect reset




相关文章:
db2日期操作函数
SQL 语法参考手册
谈谈IBM DB2的数据库备份与恢复
对 DB2 V9 中 XML 类型的编码处理(dW)
构建DB2 Cube View元数据桥
DB2存储过程开发最佳实践
DB2中使用所有内存
DB2与SQL Server2000间SQL数据复制
用户和组帐户与DB2 UDB的交互
DB2 9数据库优点及缺点详细分析
DB2中实现Oracle的相关功能
将Siebel 7电子商务应用程序从DB2 UDB V8 迁移到D
解析:DB2 无限活动日志策略的实用技巧
DB2 9数据服务器发展的3个阶段
为DB2数据库添加验证约束
DB2数据库创建存储过程时遇到的错误
DB2 9数据库性能理解的二十大误区
DB2中的终极SQL性能调节技术
DB2数据库应用系统性能优化深入探究
提高DB2 Web程序性能5条规则
详解安装DB2 9数据库管理软件的4种方式
DB2 9.5的数据库内存保护技术
解决DB2中出现的SQL1032N错误现象
创建克隆文件
DB2数据库优化的几条策略
如何解决DB2中出现的SQL1032N错误现象
解决DB2数据库代码页不兼容的问题
DB2创建存储过程时遇到的错误
教你提高商业智能环境中的DB2查询性能
DB2 9.5的数据库内存保护