日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
BMDB2數(shù)據(jù)復(fù)制與遷移大講堂

I此文主要向大家講述的是BM DB2數(shù)據(jù)復(fù)制與遷移的實(shí)際操作方法,以下的方法是經(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左右。

目前成都創(chuàng)新互聯(lián)已為上千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站改版維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、崇陽網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

背景:

需要更改數(shù)據(jù)庫表空間,或者需要將數(shù)據(jù)庫中所有表的數(shù)據(jù)遷移到一個新的數(shù)據(jù)庫中。

步驟:

1.通過db2控制臺(db2cc)選中源IBM DB2數(shù)據(jù)復(fù)制數(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腳本代碼示例:

 
 
 
  1. /**   
  2. * 創(chuàng)建導(dǎo)出腳本   
  3. * @param conn   
  4. * @param creator 表創(chuàng)建者   
  5. * @param filePath   
  6. */   
  7. public void createExportFile(Connection conn,String creator,String filePath) throws Exception {   
  8. DBBase dbBase = new DBBase(conn);   
  9. String selectTableSql = "select name from sysibm.systables where creator = '" + creator + "' and type='T'";   
  10. try {   
  11. dbBase.executeQuery(selectTableSql);   
  12. } catch (Exception ex) {   
  13. throw ex;   
  14. } finally {   
  15. dbBase.close();   
  16. }   
  17. DBResult result = dbBase.getSelectDBResult();   
  18. List list = new ArrayList();   
  19. while (result.next()) {   
  20. String table = result.getString(1);   
  21. list.add(table);   
  22. }   
  23. StringBuffer sb = new StringBuffer();   
  24. String enterFlag = "\r\n";   
  25. for (int i = 0; i < list.size();i++) {   
  26. String tableName = (String)list.get(i);   
  27. sb.append("db2 \"export to aa" + String.valueOf(i+1)+ ".ixf of ixf select * from " + tableName + "\"");   
  28. sb.append(enterFlag);   
  29. }   
  30. String str = sb.toString();   
  31. FileUtility.saveStringToFile(filePath, str, false);   
  32. }   

附錄2:生成import腳本代碼示例:

 
 
 
  1. /**   
  2. * 創(chuàng)建裝載腳本   
  3. * @param conn   
  4. * @param creator 表創(chuàng)建者  
  5. * @param filePath   
  6. */   
  7. public void createLoadFile(Connection conn,String creator,String filePath) throws Exception {   
  8. DBBase dbBase = new DBBase(conn);   
  9. String selectTableSql = "select name from sysibm.systables where creator = '" + creator + "' and type='T'";   
  10. try {   
  11. dbBase.executeQuery(selectTableSql);   
  12. } catch (Exception ex) {   
  13. throw ex;   
  14. } finally {   
  15. dbBase.close();   
  16. }   
  17. DBResult result = dbBase.getSelectDBResult();   
  18. List list = new ArrayList();   
  19. while (result.next()) {   
  20. String table = result.getString(1);   
  21. list.add(table);   
  22. }   
  23. StringBuffer sb = new StringBuffer();   
  24. String enterFlag = "\r\n";   
  25. for (int i = 0; i < list.size();i++) {   
  26. String tableName = (String)list.get(i);   
  27. sb.append("db2 \"load from aa" + String.valueOf(i+1)+ ".ixf of ixf into " + tableName + " COPY NO without prompting \"");   
  28. sb.append(enterFlag);   
  29. }   
  30. String str = sb.toString();   
  31. FileUtility.saveStringToFile(filePath, str, false);   
  32. }   

附錄3:export腳本示例

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

附錄4:import腳本示例

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

以上的相關(guān)內(nèi)容就是對IBM DB2數(shù)據(jù)復(fù)制和遷移方法的介紹,望你能有所收獲。


分享題目:BMDB2數(shù)據(jù)復(fù)制與遷移大講堂
新聞來源:http://www.5511xx.com/article/djoeoio.html