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

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

新聞中心

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

此文章主要向大家介紹的是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左右。

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:域名與空間、網(wǎng)頁空間、營銷軟件、網(wǎng)站建設(shè)、梁溪網(wǎng)站維護(hù)、網(wǎng)站推廣。

背景:需要更改數(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)DB2數(shù)據(jù)復(fù)制執(zhí)行import腳本;

附錄1:生成export腳本代碼示例:/**

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

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

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

附錄3:export腳本示例db2 connect to testdb user test password test

 
 
 
  1. db2 "export to aa1.ixf of ixf select * from table1"  
  2. db2 "export to aa2.ixf of ixf select * from table2"  
  3. db2 connect reset  

附錄4:import腳本示例db2 connect to testdb user test password test

 
 
 
  1. db2 "load from aa1.ixf of ixf replace into table1 COPY NO without prompting "  
  2. db2 "load from aa2.ixf of ixf replace into table2 COPY NO without prompting "  
  3. db2 connect reset  

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

【編輯推薦】

  1. IBM DB2中新手要了解的東西有哪些?
  2. IBM DB2 Content Manager V83安裝與SQL0818
  3. 掛起DB2 diag.log中看到了什么?
  4. DB2 CM ls對應(yīng)的Content Manager版本級別的確認(rèn)
  5. DB2V8升級到DB2V95在AIX平臺上很簡單
     

網(wǎng)站題目:DB2數(shù)據(jù)復(fù)制與遷移的操作方案大盤點(diǎn)
文章來源:http://www.5511xx.com/article/cdhoceh.html