偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

DB2數(shù)據(jù)復(fù)制與數(shù)據(jù)庫(kù)遷移追根述源

數(shù)據(jù)庫(kù)
我們今天主要向大家講述的是DB2數(shù)據(jù)復(fù)制與數(shù)據(jù)庫(kù)遷移的實(shí)際操作方法,以及對(duì)其在實(shí)際操作中的步驟與操作背景的描述。

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

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

步驟:

1. 通過(guò)db2控制臺(tái)(db2cc)選中源數(shù)據(jù)庫(kù)中的所有表,將其導(dǎo)出成DDL腳本;

2. 根據(jù)需要對(duì)腳本進(jìn)行必要的修改,譬如更改表空間為GATHER;

3. 新建數(shù)據(jù)庫(kù),新建DMS表空間:GATHER;

4. 將DDL腳本在此數(shù)據(jù)庫(kù)中執(zhí)行;

5. 編寫(xiě)代碼查詢(xún)?cè)磾?shù)據(jù)庫(kù)中的所有表,自動(dòng)生成export腳本;

6. 編寫(xiě)代碼查詢(xún)?cè)磾?shù)據(jù)庫(kù)中的所有表,自動(dòng)生成import腳本;

7. 連接源數(shù)據(jù)庫(kù)執(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)容就是對(duì)DB2數(shù)據(jù)復(fù)制和遷移方法的介紹,望你能有所收獲。
 

責(zé)任編輯:佚名 來(lái)源: ibm.com
相關(guān)推薦

2011-03-16 13:02:47

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

2009-07-06 17:34:26

遠(yuǎn)程復(fù)制DB2

2010-09-01 13:38:41

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

2010-08-04 16:18:48

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

2010-08-19 10:32:07

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

2010-08-26 10:37:40

DB2Q復(fù)制

2010-08-17 10:06:25

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

2010-08-20 13:39:23

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

2010-08-16 14:45:15

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

2010-08-12 10:34:40

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

2010-08-10 10:07:29

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

2010-08-03 14:40:05

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

2010-09-07 14:44:50

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

2010-08-04 12:39:55

2010-08-03 13:56:11

DB2表復(fù)制

2010-08-25 10:50:48

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

2011-03-11 16:02:03

DB2數(shù)據(jù)庫(kù)安裝

2010-08-26 16:15:25

DB2數(shù)據(jù)庫(kù)管理

2010-11-01 11:30:41

DB2數(shù)據(jù)庫(kù)權(quán)限

2010-09-30 11:49:21

DB2數(shù)據(jù)庫(kù)權(quán)限
點(diǎn)贊
收藏

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