av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

IBM DB2 的數(shù)據(jù)復(fù)制、遷移方法

瀏覽:3日期:2023-11-10 15:52:13
以下方法經(jīng)測試,在環(huán)境IBM x346,3.2G×2,4G,RAID 1,DB2 V8.2.4,Win2000 Adv Server,DMS表空間中,數(shù)據(jù)的load速度在60-100萬條/min左右。背景:需要更改數(shù)據(jù)庫表空間,或者需要將數(shù)據(jù)庫中所有表的數(shù)據(jù)遷移到一個新的數(shù)據(jù)庫中。步驟:1.通過db2控制臺(db2cc)選中源數(shù)據(jù)庫中的所有表,將其導(dǎo)出成DDL腳本;2.根據(jù)需要對腳本進(jìn)行必要的修改,譬如更改表空間為GATHER;3.新建數(shù)據(jù)庫,新建DMS表空間:GATHER;4.將DDL腳本在此數(shù)據(jù)庫中執(zhí)行;5.編寫代碼查詢源數(shù)據(jù)庫中的所有表,自動生成export腳本;6.編寫代碼查詢源數(shù)據(jù)庫中的所有表,自動生成import腳本;7.連接源數(shù)據(jù)庫執(zhí)行export腳本;8.連接目標(biāo)數(shù)據(jù)庫執(zhí)行import腳本;附錄1:生成export腳本代碼示例:/*** 創(chuàng)建導(dǎo)出腳本* @param conn* @param creator 表創(chuàng)建者* @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(1);list.add(table);}StringBuffer sb = new StringBuffer();String enterFlag = "";for (int i = 0; i < list.size();i++) {String tableName = (String)list.get(i);sb.append("db2 "export to aa" + String.valueOf(i+1)+ ".ixf of ixf select * from " + tableName + """);sb.append(enterFlag);}String str = sb.toString();FileUtility.saveStringToFile(filePath, str, false);}附錄2:生成import腳本代碼示例:/*** 創(chuàng)建裝載腳本* @param conn* @param creator 表創(chuàng)建者* @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 = "";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 testdb2 "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 testdb2 "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
標(biāo)簽: DB2 數(shù)據(jù)庫
主站蜘蛛池模板: 国产精品美女在线观看 | 国产综合一区二区 | 成人毛片在线 | 精品免费观看 | 久久黄视频| av在线一区二区 | 91一区二区三区 | 亚洲成人精品在线观看 | 久久久一区二区三区 | 欧美日韩一二区 | 国产精品毛片久久久久久久 | 天天干夜夜骑 | 明日边缘 | 色午夜| 色综合一区| 亚洲高清在线播放 | 亚洲一区二区免费视频 | 亚洲欧美日韩国产 | 欧美日韩无| 午夜精品一区二区三区在线视频 | 欧美综合一区二区 | 黄色片视频 | 九九九精品视频 | 手机在线免费av | 一区二区三区视频 | 日本免费中文字幕 | 色虎网站| 亚洲日本视频 | 欧美在线视频免费观看 | 中文字幕在线播放视频 | 欧美日韩一区二 | 成人福利视频在线观看 | 欧美三级在线视频 | 中国黄色录像 | 日韩精品区| 日本中文字幕在线视频 | 五月天激情视频 | 九九精品视频在线观看 | 久久不卡视频 | 国产免费网址 | 四虎免费在线观看 |