成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

DB2數(shù)據(jù)復(fù)制與遷移的實(shí)際操作方法,經(jīng)典版!

數(shù)據(jù)庫
我們今天是要和大家一起討論的是DB2數(shù)據(jù)復(fù)制與遷移的實(shí)際操作方法,以及對在實(shí)際操作中一些值得我們大家留意的事項(xiàng)的描述。

以下的文章主要是介紹DB2數(shù)據(jù)復(fù)制與遷移的實(shí)際操作方法,下面的方法是經(jīng)過測試的,其在環(huán)境IBM x346,3.2G×2,4G,RAID 1,DB2 V8.2.4,Win2000 Adv Server下運(yùn)行,DMS表空間中,數(shù)據(jù)的load速度在60-100萬條/min左右。

背景:需要更改數(shù)據(jù)庫表空間,或者需要將數(shù)據(jù)庫中所有表的數(shù)據(jù)遷移到一個(gè)新的數(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腳本代碼示例:/**

  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. 備份恢復(fù)DB2數(shù)據(jù)庫的3步驟,好用!
  2. 對DB2 Online備份方案的具體描述
  3. IBM DB2 UDB 在線備份與恢復(fù)完美演習(xí)!
  4. DB2數(shù)據(jù)庫的備份是否成功,一看就知道!
  5. DB2還原某個(gè)表空間的實(shí)際操作步驟剖析
責(zé)任編輯:佚名 來源: 網(wǎng)易科技報(bào)道
相關(guān)推薦

2010-08-06 11:21:45

IBM DB2 數(shù)據(jù)復(fù)

2010-08-10 14:02:26

IBM DB2數(shù)據(jù)復(fù)制

2010-08-09 13:43:37

DB2數(shù)據(jù)遷移

2010-07-27 13:16:50

DB2使用所有內(nèi)存

2010-09-07 13:04:20

DB2數(shù)據(jù)庫

2010-08-03 13:56:11

DB2表復(fù)制

2011-03-16 13:02:47

DB2數(shù)據(jù)復(fù)制遷移

2010-08-03 09:32:19

DB2在線備份

2010-07-30 14:21:10

DB2數(shù)據(jù)集

2010-08-20 13:39:23

DB2數(shù)據(jù)復(fù)制

2010-08-17 10:06:25

IBM DB2的數(shù)據(jù)復(fù)

2010-07-28 08:58:50

DB2并行索引

2010-09-30 10:41:29

2010-08-13 16:29:03

DB2數(shù)據(jù)復(fù)制

2009-12-30 15:53:28

Silverlight

2010-07-27 11:20:02

DB2打補(bǔ)丁

2010-07-30 13:45:17

執(zhí)行DB2

2010-08-03 09:44:42

DB2在線增量備份

2010-08-17 13:25:39

DB2恢復(fù)刪除表

2010-08-04 11:12:09

DB2命令執(zhí)行
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 久久婷婷av| 色爱综合网 | 亚洲成在线观看 | 天天天天天操 | 91在线看| 91免费观看国产 | 天堂一区二区三区 | 欧美精品在线一区二区三区 | 中文字幕一区二区三区精彩视频 | 欧美精品一区二区在线观看 | 日韩欧美操 | 日韩欧美精品一区 | 亚洲精品视频免费观看 | 国产精品一区二区日韩 | 国产视频精品免费 | 欧美久久久久久久久 | 麻豆久久久久久久 | 中国三级黄色录像 | 国产福利91精品 | 久久99这里只有精品 | 蜜桃臀av一区二区三区 | 日韩精品一区二区三区高清免费 | 国产高清一区二区三区 | 色婷婷一区 | 日本一区二区三区在线观看 | 国产精品日韩欧美一区二区三区 | 91成人在线| 久久综合成人精品亚洲另类欧美 | 国产精品1区2区 | 在线成人免费视频 | 欧美aⅴ| 精品产国自在拍 | 久久精品99久久 | 国产一级在线观看 | 狠狠婷婷综合久久久久久妖精 | av毛片| 视频一区二区在线观看 | 亚洲高清在线观看 | 中文字幕在线国产 | 久久久久久网 | 国产中文视频 |