重建Oracle表空間專業(yè)技術(shù)指導(dǎo)
之前介紹過Oracle表空間恢復(fù),這里在向大家詳細(xì)介紹重建Oracle表空間之前,首先讓大家了解下用戶表空間的錯(cuò)誤,然后全面介紹重建Oracle表空間。
錯(cuò)誤:
在啟動(dòng)數(shù)據(jù)庫時(shí)出現(xiàn)ORA-01157,ORA-01110或操作系統(tǒng)級(jí)錯(cuò)誤例如ORA-07360,在關(guān)閉數(shù)據(jù)庫(使用shutdown normal或shutdown immediate) 時(shí)將導(dǎo)致錯(cuò)誤ORA-01116,ORA-01110以及操作系統(tǒng)級(jí)錯(cuò)誤ORA-07368
以下有兩種解決方案:
1.用戶的表空間可以被輕易地重建
即最近導(dǎo)出的對(duì)象是可用的或表空間中的對(duì)象可以被輕易地重建等.在這種情況下,最簡(jiǎn)單的方法是offline并刪除該數(shù)據(jù)文件,刪除表空間并重建Oracle表空間以及所有的對(duì)象.
svrmgrl> startup mount
svrmgrl> alter database datafile 'filename' offline drop;
svrmgrl> alter database open;
svrmgrl> drop tablespace tablespace_name including contents;
重建Oracle表空間及所有對(duì)象.
2.用戶的表空間不能夠被輕易地重建
在大多數(shù)情況下,重建Oracle表空間是不可能及太辛苦的工作.方法是倒備份及做介質(zhì)恢復(fù).如果您的系統(tǒng)運(yùn)行在NOARCHIVELOG模式下,則只有丟失的數(shù)據(jù)在online redo log中方可被恢復(fù)。步驟如下:
1)Restore the lost datafile from a backup
2)svrmgrl> startup mount
3)svrmgrl> select v1.group#,member,sequence#,first_change#
◆from v$log v1,v$logfile v2
◆where v1.group#=v2.group#;
4)如果數(shù)據(jù)庫運(yùn)行在NOARCHIVELOG模式下則:
svrmgrl> select file#,change# from v$recover_file;
如果 CHANGE# 大于最小的FIRST_CHANGE#則數(shù)據(jù)文件可以被恢復(fù)。
如果 CHANGE# 小于最小的FIRST_CHANGE#則數(shù)據(jù)文件不可恢復(fù)。 恢復(fù)最近一次的全備份或采用方案一.
5)svrmgrl> recover datafile filename;
6)確認(rèn)恢復(fù)成功
7)svrmgrl> alter database open resetlogs;
3.只讀表空間無需做介質(zhì)恢復(fù),只要將備份恢復(fù)即可.唯一的例外是:
◆表空間在***一次備份后被改為read-write 模式
◆表空間在***一次備份后被改為read-only 模式
◆在這種情況下,均需進(jìn)行介質(zhì)恢復(fù)
【編輯推薦】