教您如何恢復(fù)DB2中的刪除表
在使用DB2數(shù)據(jù)庫(kù)的過(guò)程中,如果想要恢復(fù)刪除表。應(yīng)該如何操作呢?本文將為您介紹恢復(fù)DB2中的刪除表的方法步驟,供您參考,希望對(duì)您有所幫助。
這邊轉(zhuǎn)載了一個(gè)恢復(fù)drop后的表的一個(gè)操作,類(lèi)似于oracle 10g中的閃回.
DB2在歷史文件中保存了備份,恢復(fù),裝載數(shù)據(jù),刪除表等操作.
假設(shè)數(shù)據(jù)庫(kù)名為sample, 您可以用下面的命令列出刪除表的記錄: db2 "list history dropped table all for sample"
下一步是從以前的備份中恢復(fù)刪除表所在的表空間, 備份所在的目錄是c:db2backup.
without rolling forward指明不需要前滾.
db2 "restore db sample tablespace(userspace1) from c:db2backup taken at 20041102100931 without rolling forward without prompting"
第三步是把所刪除表的數(shù)據(jù)卸載到某一目錄中
db2 "rollforward db sample to end of logs and complete recover dropped table 00000000000002010002000d to c:db2backup"
第四步是用歷史文件中保留的該表的DDL語(yǔ)句重建該表
第五步是重新裝載數(shù)據(jù)到該表. p(1,2)表明裝載該表的***個(gè)和第二個(gè)字段的內(nèi)容. recoverme是表名
db2 "load from c:db2backupnode0000data OF DEL METHOD p(1,2) insert into recoverme"