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

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

數(shù)據(jù)庫(kù)
DB2數(shù)據(jù)庫(kù)是IBM出口的一系列關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng),DB2數(shù)據(jù)庫(kù)的操作涉及到很多數(shù)據(jù)的復(fù)制、遷移,本文將圍繞DB2數(shù)據(jù)庫(kù)的數(shù)據(jù)復(fù)制、遷移的方法展開(kāi)。

DB2數(shù)據(jù)庫(kù)的數(shù)據(jù)復(fù)制以及遷移是DB2數(shù)據(jù)庫(kù)操縱經(jīng)常用到的,數(shù)據(jù)復(fù)制、遷移是要講求一定方法的,這些方法會(huì)很大程度簡(jiǎn)便我們的操作,大家何樂(lè)而不為???下面就重點(diǎn)為大家介紹DB2數(shù)據(jù)庫(kù)數(shù)據(jù)復(fù)制、遷移的方法。

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

以下方法經(jīng)測(cè)試,在環(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ě)代碼查詢?cè)磾?shù)據(jù)庫(kù)中的所有表,自動(dòng)生成export腳本;

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

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

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


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

/**

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

* @param conn

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

* @param filePath

*/

public void createExportFile(Connection conn,String creator,String filePath) throws Exception {

DBBase dbBase = new DBBase(conn);

String selectTableSql = "select name from sysibm.systables where creator = '" + creator + "' and type='T'";

try {

dbBase.executeQuery(selectTableSql);

} catch (Exception ex) {

throw ex;

} finally {

dbBase.close();

}

DBResult result = dbBase.getSelectDBResult();

List list = new ArrayList();

while (result.next()) {

String table = result.getString(1);

list.add(table);

}

StringBuffer sb = new StringBuffer();

String enterFlag = "\r\n";

for (int i = 0; i < list.size();i++) {

String tableName = (String)list.get(i);

sb.append("db2 \"export to aa" + String.valueOf(i+1)+ ".ixf of ixf select * from " + tableName + "\"");

sb.append(enterFlag);

}

String str = sb.toString();

FileUtility.saveStringToFile(filePath, str, false);

}

#p#


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

/**

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

* @param conn

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

* @param filePath

*/

public void createLoadFile(Connection conn,String creator,String filePath) throws Exception {

DBBase dbBase = new DBBase(conn);

String selectTableSql = "select name from sysibm.systables where creator = '" + creator + "' and type='T'";

try {

dbBase.executeQuery(selectTableSql);

} catch (Exception ex) {

throw ex;

} finally {

dbBase.close();

}

DBResult result = dbBase.getSelectDBResult();

List list = new ArrayList();

while (result.next()) {

String table = result.getString(1);

list.add(table);

}

StringBuffer sb = new StringBuffer();

String enterFlag = "\r\n";

for (int i = 0; i < list.size();i++) {

String tableName = (String)list.get(i);

sb.append("db2 \"load from aa" + String.valueOf(i+1)+ ".ixf of ixf into " + tableName + " COPY NO without prompting \"");

sb.append(enterFlag);

}

String str = sb.toString();

FileUtility.saveStringToFile(filePath, str, false);

}


附錄3:export腳本示例

db2 connect to testdb user test password test

db2 "export to aa1.ixf of ixf select * from table1"

db2 "export to aa2.ixf of ixf select * from table2"

db2 connect reset


附錄4:import腳本示例

db2 connect to testdb user test password test

db2 "load from aa1.ixf of ixf replace into table1 COPY NO without prompting "

db2 "load from aa2.ixf of ixf replace into table2 COPY NO without prompting "

db2 connect reset
 

這就是我為大家介紹的DB2數(shù)據(jù)庫(kù)數(shù)據(jù)復(fù)制、遷移的方法的全部?jī)?nèi)容,希望文章中介紹的方法大家在以后的工作中都能用到。

【編輯推薦】

  1. 理解DB2數(shù)據(jù)庫(kù)中的catalog
  2. BM DB2數(shù)據(jù)復(fù)制與遷移大講堂
  3. IBM DB2數(shù)據(jù)復(fù)制與遷移方法的背景與實(shí)際操作步驟
責(zé)任編輯:迎迎 來(lái)源: 天極網(wǎng)
相關(guān)推薦

2010-08-17 10:06:25

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

2010-08-04 12:39:55

2010-08-19 10:32:07

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

2010-08-20 13:39:23

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

2010-08-13 16:29:03

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

2010-08-13 10:13:15

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

2010-08-12 10:34:40

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

2010-08-10 14:02:26

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

2009-07-06 17:34:26

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

2010-08-26 10:37:40

DB2Q復(fù)制

2010-09-01 13:38:41

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

2012-11-12 10:30:25

IBMdw

2010-08-03 13:56:11

DB2表復(fù)制

2010-08-06 11:21:45

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

2010-11-02 13:40:34

DB2函數(shù)調(diào)用

2010-08-17 13:00:19

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

2010-08-11 09:14:33

DB2數(shù)據(jù)類型

2010-09-30 11:44:40

DB2表快速清空

2011-10-21 13:04:00

DB2Oracle

2011-10-21 09:44:08

OracleDB2
點(diǎn)贊
收藏

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

主站蜘蛛池模板: 亚洲日产精品 | 国产精品一区二区视频 | 精品国产伦一区二区三区观看体验 | 视频二区国产 | 在线观看你懂的网站 | 亚洲 精品 综合 精品 自拍 | 美女天天操 | 国产精品视频一 | 国产成人在线一区二区 | h视频在线观看免费 | 亚洲免费av一区 | 国内精品免费久久久久软件老师 | 亚洲精品一区二区 | 久久69精品久久久久久国产越南 | 在线欧美亚洲 | 精品久久国产老人久久综合 | 日本福利一区 | 欧美久久久久久 | 国产 日韩 欧美 制服 另类 | 成人h动漫亚洲一区二区 | 精品久久久久久中文字幕 | 亚洲欧美日韩精品久久亚洲区 | 亚洲精品在线观看视频 | 日日草夜夜草 | 国产一级电影在线 | 91久久久www播放日本观看 | 精品一级 | 超碰精品在线 | 久久久久国产 | 亚洲精品1| 亚洲综合色站 | 中文字幕一区二区三 | 波多野结衣一区二区 | 懂色av一区二区三区在线播放 | 国产精品久久久久永久免费观看 | 欧美一级电影免费观看 | 久久大 | 精品久久久久国产免费第一页 | 成人国内精品久久久久一区 | 国产精品1 | 日本91av视频 |