亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
1234下一頁
最近訪問板塊 發(fā)新帖
查看: 18236 | 回復: 34
打印 上一主題 下一主題

急!如何恢復數(shù)據(jù)庫,大蝦指教 [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-06-19 16:08 |只看該作者 |倒序瀏覽
我用restore恢復數(shù)據(jù)庫:
$ db2 restore db cisfedb from /db2_backup taken at 20070617020002
SQL2523W  Warning!  Restoring to an existing database that is different from the database on the backup image, but have matching names. The target database will be overwritten by the backup version.  The Roll-forward recovery logs associate
d with the target database will be deleted.
Do you want to continue ? (y/n) y
SQL0294N  The container is already in use.  SQLSTATE=42730

這個時候我連接數(shù)據(jù)庫db2 connect to cisfedb
SQL1119N  A connection to or activation of database "CISFEDB" cannot be made because a previous restore is incomplete.  SQLSTATE=57019

用db2 get db cfg for cisfedb 看一下數(shù)據(jù)庫的狀態(tài)。
看參數(shù) Rollforward pending          =YES
Restore pending                     =Database
請教如何恢復數(shù)據(jù)庫,本人剛開始學習,請大家說得詳細點,謝謝了!

論壇徽章:
0
2 [報告]
發(fā)表于 2007-06-19 17:03 |只看該作者
怎么沒有人回復我呀,幫幫忙吧,急呀!謝謝了!

論壇徽章:
0
3 [報告]
發(fā)表于 2007-06-19 22:48 |只看該作者
數(shù)據(jù)庫cisfedb原來就存在嗎?你的restore是在原來的主機上直接做的嗎?
如果是用原來的備份文件取創(chuàng)建一個新的數(shù)據(jù)庫,要用direct
restore db AAA from /db2_backup taken at 20070617020002 into cisfedb redirect
set tablespace containers for 0 using (path 'your path')
...
set tablespace containers for n using (path 'your path')
這個n根據(jù)你數(shù)據(jù)庫表空間的個數(shù)來定
restore db AAA continue

論壇徽章:
0
4 [報告]
發(fā)表于 2007-06-20 08:05 |只看該作者
cisfedb是已經(jīng)創(chuàng)建好的數(shù)據(jù)庫,我是把主機上的備份文件傳到備機上做的restore,想讓備機和主機同步,現(xiàn)在我需要怎么做?   先謝謝你的幫助!

論壇徽章:
0
5 [報告]
發(fā)表于 2007-06-20 08:20 |只看該作者
能留一下您的QQ或者MSN嗎?這樣不太方便,我想直接向您說明白,謝謝!

論壇徽章:
0
6 [報告]
發(fā)表于 2007-06-20 09:31 |只看該作者
在備份機器上做restore,需要redirect,按照前面的方法可以實現(xiàn)。

論壇徽章:
0
7 [報告]
發(fā)表于 2007-06-20 11:19 |只看該作者
以下幾個space的路徑我是從執(zhí)行的腳本找到的
tablespace TBS_IDX4K
'/dev/rdb2_idx01'
tablespace TBS_LOB1
'/db2_large/tbs_lob1.dat'
tablespace TBS_LOB2
'/db2_large/tbs_lob2.dat'
tablespace TBS_8K
'/dev/rdb2_dta02'
TEMPORARY TABLESPACE TBS_systmp
'/db2_systmp'
TABLESPACE TBS_IDX_CISA_E
'/dev/rdb2_jf_dta01'
TABLESPACE TBS_TABLE_CISA_E
'/dev/rbdb2_jf_idx01'
tablespace userspace1
'/dev/rdb2_dta01'
還有2個space
syscatspace和systoolspace怎么找到路徑
還有就是我的數(shù)據(jù)庫表空間的n應該是9把,從0到9
set tablespace containers for 0 using (path 'your path')
'your path'  就是上邊引號里的路徑吧?

論壇徽章:
0
8 [報告]
發(fā)表于 2007-06-20 11:30 |只看該作者
方便的話能幫我做個完整的腳本嗎,處理這個問題的

論壇徽章:
0
9 [報告]
發(fā)表于 2007-06-20 13:50 |只看該作者
下面是一個關(guān)于重定向恢復的實例,在理解了整個過程之后,你可以應用到你的項目中去,如果使用裸設(shè)備的話,使用之前要untag的。具體每個命令的用法可以參考IBM的信息中心:http://publib.boulder.ibm.com/infocenter/db2luw/v8/

創(chuàng)建TESTDB數(shù)據(jù)庫:db2 "create database testdb"
連接數(shù)據(jù)庫:db2 "connect to testdb"
列出當前數(shù)據(jù)庫表空間的信息:db2 "list tablespaces show detail"
重點需要明確下面的內(nèi)容

表空間ID         表空間名稱 表空間類型
0        SYSCATSPACE        System managed space
1        TEMPSPACE1        System managed space
2        USERSPACE1        System managed space
根據(jù)上面收集到的表空間信息,確定每個表空間容器的的詳細信息。
逐個執(zhí)行下面命令
db2 "list tablespace containers for 0"
db2 "list tablespace containers for 1"
db2 "list tablespace containers for 2"

表空間ID         容器ID 容器名稱 容器類型
0        0        /opt/db2inst1/db2inst1/NODE0000/SQL00001/SQLT0000.0        Path
1        0        /opt/db2inst1/db2inst1/NODE0000/SQL00001/SQLT0001.0        Path
2        0        /opt/db2inst1/db2inst1/NODE0000/SQL00001/SQLT0002.0        Path

假如我們把TESTDB的三個表空間重定向到下面三個目錄:
/TESTDB/ tbs1
/TESTDB/ tbs2
/TESTDB/ tbs3
下面開始用前面得到的TESTDB的備份文件(時間戳是20070608223731)做重定向恢復。
db2 "restore db testdb from /TESTDB taken at 20070608223731 redirect"
db2 "set tablespace containers for 0 using (path '/TESTDB/tbs1')"
db2 "set tablespace containers for 1 using (path '/TESTDB/tbs2')"
db2 "set tablespace containers for 2 using (path '/TESTDB/tbs3')"
db2 "restore db testdb continue"

是否真的重定向了呢?做下面的檢查。
連接數(shù)據(jù)庫:db2 "connect to testdb"
檢查表空間ID是2的容器信息:db2 "list tablespace containers for 2"
容器的路徑現(xiàn)在已經(jīng)改成/TESTDB/tbs3,成功的完成了重定向。

我們也可以利用重定向的方法來克隆一個新的數(shù)據(jù)庫?聪旅娴睦。
先把TESTDB恢復原樣
db2 "restore db testdb from /TESTDB taken at 20070608223731"
在用同樣的備份文件新建一個TESTNEW的數(shù)據(jù)庫
db2 "restore db testdb from /TESTDB taken at 20070608223731 into testnew redirect"
db2 "set tablespace containers for 0 using (path '/TESTDB/tbs1')"
db2 "set tablespace containers for 1 using (path '/TESTDB/tbs2')"
db2 "set tablespace containers for 2 using (path '/TESTDB/tbs3')"
db2 "restore db testdb continue"
我們來驗證結(jié)果。
db2 connect to TESTNEW
db2 "list tablespace containers for 2"
新的數(shù)據(jù)庫TESTNEW已經(jīng)成功創(chuàng)建,它的表空間容器的路徑就是我們預先指定的。

論壇徽章:
0
10 [報告]
發(fā)表于 2007-06-20 15:39 |只看該作者
謝謝,但是還有點地方不明白!
假如我們把TESTDB的三個表空間重定向到下面三個目錄:
/TESTDB/ tbs1
/TESTDB/ tbs2
/TESTDB/ tbs3
這個重定向是怎么操作的,tbs1、tbs2、tbs3是什么意思?自己定義的?
還有我用的主機跟備機是以墨一樣的,只是主機先安裝好,每天晚上2點自動做備份,我把主機上的備份文件拷貝到備機上做restroe,數(shù)據(jù)庫是本來就有的
還有我用的是SUSE LINUX 9操作系統(tǒng),上邊的方法適合嗎?
另外,我照上邊的方法db2 list tablespace containers for 0   到 9
其中type 有三種形式,分別是 path  、  disk  、  file
那我做  db2 "set tablespace containers for 0 using  
set命令的是不是都作呀,期待答復
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP