DB2數(shù)據(jù)庫(kù)備份與恢復(fù)命令的總結(jié)描述
以下的文章主要是介紹DB2數(shù)據(jù)庫(kù)備份與恢復(fù)命令的總結(jié),假如你對(duì)DB2數(shù)據(jù)庫(kù)備份與恢復(fù)命令的總結(jié)心存好奇的話(huà),此文章將會(huì)揭開(kāi)它的神秘面紗。以下就是文章的詳細(xì)內(nèi)容介紹,望大家借鑒。
數(shù)據(jù)庫(kù), 命令數(shù)據(jù)庫(kù), 命令
1、運(yùn)行-->db2cmd
2、命令行中輸入db2cmd
輸入命令 db2 create db 數(shù)據(jù)庫(kù)名稱(chēng) on d:
在 d盤(pán)建立數(shù)據(jù)庫(kù)。假設(shè)在d盤(pán)生成目錄:D:\DB2\NODE0000\SQL00006
3、cd\
4、保證D:\db_bak\目錄下存在要恢復(fù)的數(shù)據(jù)庫(kù)文件。確保目錄結(jié)構(gòu)為db2系統(tǒng)備份目錄
如 目錄結(jié)構(gòu):D:\db_bak\GXDB.0\DB2\NODE0000\CATN0000\
執(zhí)行下面命令,
db2 restore db [ DB2數(shù)據(jù)庫(kù)備份數(shù)據(jù)庫(kù)名稱(chēng)] from D:\db_bak\ taken at 20070302160117 into [上面創(chuàng)建數(shù)據(jù)庫(kù)名稱(chēng)] redirect
執(zhí)行后,系統(tǒng)提示:
--------------------------------------------------------
SQL1277N 復(fù)原已檢測(cè)到一個(gè)或多個(gè)表空間容器是不可訪問(wèn)的,或者已將它們的狀態(tài)設(shè)置為
“必須定義存儲(chǔ)器”。
DB20000I RESTORE DATABASE 命令成功完成。
--------------------------------------------------------
5、根據(jù)步驟2中數(shù)據(jù)庫(kù)生成的目錄結(jié)構(gòu)
- db2 set tablespace containers for 0 using (path "D:\DB2\NODE0000\SQLxxxx\SQLT0000.0")
修改為:
- db2 set tablespace containers for 0 using (path "D:\DB2\NODE0000\SQL00006\SQLT0000.0")
下面2條修改方式相同
- db2 set tablespace containers for 1 using (path "D:\DB2\NODE0000\SQL00005\SQLT0001.0")
- db2 set tablespace containers for 2 using (path "D:\DB2\NODE0000\SQL00005\SQLT0002.0")
下面的語(yǔ)句中把 mam311修改為創(chuàng)建數(shù)據(jù)庫(kù)名稱(chēng).dbf
- db2 set tablespace containers for 3 using (file "D:\tbs\mam311.DBF" 12500)
下面的語(yǔ)句中把mam311修改為創(chuàng)建數(shù)據(jù)庫(kù)名稱(chēng)_Temp.dbf
- db2 set tablespace containers for 4 using (file "D:\tbs\mam311_Temp.DBF" 12500)
6、
db2 restore db DB2數(shù)據(jù)庫(kù)備份數(shù)據(jù)庫(kù)名稱(chēng) continue
對(duì)于廣西的數(shù)據(jù)庫(kù)為:
- db2 restore db gxdb continue
7、把日至文件拷貝到D:\DB2\NODE0000\SQL00006\SQLOGDIR目錄下執(zhí)行下面語(yǔ)句
db2 rollforward db 創(chuàng)建數(shù)據(jù)庫(kù)名稱(chēng) to end of logs and complete
以下是一個(gè)相關(guān)的例子:
- db2 create db JMAMGX31 on d:
cd\
- db2 restore db gxdb from D:\db_bak\ taken at 20070718115305 into JMAMGX redirect
- db2 set tablespace containers for 0 using (path "D:\DB2\NODE0000\SQL00005\SQLT0000.0")
- db2 set tablespace containers for 1 using (path "D:\DB2\NODE0000\SQL00005\SQLT0001.0")
- db2 set tablespace containers for 2 using (path "D:\DB2\NODE0000\SQL00005\SQLT0002.0")
- db2 set tablespace containers for 3 using (file "D:\tbs\JMAMGX.DBF" 12500)
- db2 set tablespace containers for 4 using (file "D:\tbs\JMAMGX_Temp.DBF" 12500)
- db2 restore db GXDB continue
- db2 rollforward db JMAMGX to end of logs and complete
以上的相關(guān)內(nèi)容就是對(duì) DB2數(shù)據(jù)庫(kù)備份及恢復(fù)命令總結(jié)的介紹,望你能有所收獲。
【編輯推薦】