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

IBM DB2數(shù)據復制與遷移方法的背景與實際操作步驟

數(shù)據庫
我們今天主要向大家講述的是IBM DB2數(shù)據復制與遷移方法的描述,以及對其在實際操作中要遇到的一些問題的描述,以下就是文章的主要內容講述。

文章主要講述的是IBM DB2數(shù)據復制與遷移方法的描述,下面的這些方法都是經過相關經測試,在環(huán)境IBM x346,3.2G×2,4G,RAID 1,DB2 V8.2.4,Win2000 Adv Server,DMS表空間中,數(shù)據的load速度在60-100萬條/min左右。

背景:

 

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

步驟:

 

1.通過db2控制臺(db2cc)選中源數(shù)據庫中的所有表,將其導出成DDL腳本;

 

2.根據需要對腳本進行必要的修改,譬如更改表空間為GATHER;

 

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

 

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

 

5.編寫代碼查詢源數(shù)據庫中的所有表,自動生成export腳本;

 

6.編寫代碼查詢源數(shù)據庫中的所有表,自動生成import腳本;

 

7.連接源數(shù)據庫執(zhí)行export腳本;

 

8.連接目標數(shù)據庫執(zhí)行import腳本;

 

 

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

/**

 

* 創(chuàng)建導出腳本

 

 

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

 

 

 

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

/**

 

* 創(chuàng)建裝載腳本

 

* @param conn

 

* @param creator 表創(chuàng)建者

 

 

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

 

 

 

附錄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  
  5. TAG: IBM ibm   

 

 

 

責任編輯:佚名 來源: wpzune
相關推薦

2010-08-13 10:13:15

DB2數(shù)據復制

2010-08-06 11:21:45

IBM DB2 數(shù)據復

2010-08-12 10:34:40

IBM DB2數(shù)據

2010-08-17 10:06:25

IBM DB2的數(shù)據復

2010-08-03 13:56:11

DB2表復制

2010-08-03 09:32:19

DB2在線備份

2010-07-28 08:58:50

DB2并行索引

2010-07-27 11:20:02

DB2打補丁

2010-08-03 09:44:42

DB2在線增量備份

2011-03-16 13:02:47

DB2數(shù)據復制遷移

2010-08-20 13:39:23

DB2數(shù)據復制

2010-08-03 09:49:58

DB2恢復數(shù)據庫

2010-08-12 09:06:30

DB2數(shù)據庫自動備份

2010-08-05 14:34:26

DB2存儲過程

2010-05-13 17:00:32

MySQL啟動方法

2010-08-09 13:43:37

DB2數(shù)據遷移

2010-08-12 17:36:48

DB2還原某個表空間

2010-08-05 11:34:01

DB2 代碼

2010-08-13 09:43:13

IBM DB2

2010-07-30 14:21:10

DB2數(shù)據集
點贊
收藏

51CTO技術棧公眾號