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

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

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

文章主要講述的是IBM DB2數(shù)據(jù)復(fù)制與遷移方法的描述,下面的這些方法都是經(jīng)過相關(guān)經(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左右。

背景:

 

需要更改數(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)數(shù)據(jù)庫執(zhí)行import腳本;

 

 

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

/**

 

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

 

 

  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   

 

 

 

責(zé)任編輯:佚名 來源: wpzune
相關(guān)推薦

2010-08-13 10:13:15

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

2010-08-06 11:21:45

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

2010-08-12 10:34:40

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

2010-08-17 10:06:25

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

2010-08-03 13:56:11

DB2表復(fù)制

2010-08-03 09:32:19

DB2在線備份

2010-07-28 08:58:50

DB2并行索引

2010-07-27 11:20:02

DB2打補(bǔ)丁

2010-08-03 09:44:42

DB2在線增量備份

2011-03-16 13:02:47

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

2010-08-03 09:49:58

DB2恢復(fù)數(shù)據(jù)庫

2010-08-12 09:06:30

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

2010-08-20 13:39:23

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

2010-05-13 17:00:32

MySQL啟動方法

2010-08-09 13:43:37

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

2010-08-05 14:34:26

DB2存儲過程

2010-08-05 11:34:01

DB2 代碼

2010-08-12 17:36:48

DB2還原某個表空間

2010-08-13 09:43:13

IBM DB2

2010-07-30 14:21:10

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

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

主站蜘蛛池模板: 国产精品久久久久久久久久久久 | 欧美日本韩国一区二区 | 人人干免费 | 一呦二呦三呦国产精品 | 亚洲在线一区 | 激情久久av一区av二区av三区 | 欧洲一区在线观看 | www.中文字幕av | 狠狠爱一区二区三区 | 欧美日韩精品国产 | 中文字幕免费视频 | 亚洲综合色丁香婷婷六月图片 | 国产午夜精品视频 | 精品毛片视频 | 亚洲精品4 | 亚洲3级| 日本精品一区二区三区在线观看视频 | 成年免费大片黄在线观看一级 | 99精品久久久久久 | 免费观看黄色片视频 | 成人不卡在线 | 免费黄色a视频 | 国产精品免费av | 欧美日本韩国一区二区三区 | 在线看亚洲 | www.色综合 | 六月成人网| 九九综合 | 精精国产xxxx视频在线播放 | 国产欧美视频一区二区 | 精品一区二区三区av | 欧美一级淫片免费视频黄 | 久久精品亚洲 | 日韩播放 | 男人天堂午夜 | 欧美国产日韩一区二区三区 | 欧美偷偷操 | 国产精品久久久久久久久久免费看 | 日本久久综合网 | 亚洲一区二区三区在线视频 | 国产一级毛片精品完整视频版 |