這篇文章給大家介紹Oracle 12cR1 rac怎么恢復(fù)到單機(jī)文件系統(tǒng)測試,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
創(chuàng)新互聯(lián)公司專注于潞州企業(yè)網(wǎng)站建設(shè),自適應(yīng)網(wǎng)站建設(shè),成都做商城網(wǎng)站。潞州網(wǎng)站建設(shè)公司,為潞州等地區(qū)提供建站服務(wù)。全流程定制網(wǎng)站設(shè)計,專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
對從12cR1 RAC到單機(jī)文件系統(tǒng)的還原做個簡單的示例。
1、參數(shù)文件的修改
SQL> create pfile='/home/oracle/init.ora' from spfile;
通過上述命令轉(zhuǎn)儲pfile出來進(jìn)行參數(shù)的修改。
2、將備份出的控制文件在單機(jī)上進(jìn)行還原
RMAN> restore controlfile from '/recovert_area/tmp/controlfile_db_p5sb7rbl_1_1.bak;
3、還原數(shù)據(jù)庫
將備份集放入recovery_area/bak/目錄下,執(zhí)行以下命令:
RMAN> catalog start with '/recovery_area/bak/';
這里的數(shù)據(jù)文件文件和臨時文件的路徑需要更改下,因為是還原到文件系統(tǒng),這里給出示例腳本沒有給出最終的數(shù)據(jù)文件名稱,所以只供參考:
select 'set newname for tempfile '||file#|| ' to ''/ora12c/oradata/cdb/'';' from v$tempfile where con_id=1;
select 'set newname for tempfile '||file#|| ' to ''/ora12c/oradata/seed/'';' from v$tempfile where con_id=2;
select 'set newname for tempfile '||file#|| ' to ''/ora12c/oradata/pdb/pdb1/'';' from v$tempfile where con_id=3;
select 'set newname for datafile '||file#|| ' to ''/ora12c/oradata/cdb/'';' from v$datafile where con_id=1;
select 'set newname for datafile '||file#|| ' to ''/ora12c/oradata/seed/'';' from v$datafile where con_id=2;
select 'set newname for datafile '||file#|| ' to ''/ora12c/oradata/pdb/pdb1/'';' from v$datafile where con_id=3;
下面給出還原的腳本,供參考
run
{
set newname for datafile 1 to '/ora12c/oradata/cdb/system01.dbf';
set newname for datafile 3 to '/ora12c/oradata/cdb/sysaux01.dbf';
set newname for datafile 4 to '/ora12c/oradata/cdb/undotbs01.dbf';
set newname for datafile 6 to '/ora12c/oradata/cdb/users01.dbf';
set newname for datafile 8 to '/ora12c/oradata/cdb/undotbs02.dbf';
set newname for datafile 9 to '/ora12c/oradata/cdb/undotbs03.dbf';
set newname for datafile 5 to '/ora12c/oradata/seed/system01.dbf';
set newname for datafile 7 to '/ora12c/oradata/seed/sysaux01.dbf';
set newname for datafile 10 to '/ora12c/oradata/pdb/pdb1/clsprm_system.dbf';
set newname for datafile 11 to '/ora12c/oradata/pdb/pdb1/clsprm_sysaux.dbf';
set newname for datafile 12 to '/ora12c/oradata/pdb/pdb1/clsprm_users01.dbf';
set newname for datafile 14 to '/ora12c/oradata/pdb/pdb1/test2_01.dbf';
set newname for datafile 16 to '/ora12c/oradata/pdb/pdb1/test021.dbf';
set newname for tempfile 1 to '/ora12c/oradata/cdb/temp01.dbf';
set newname for tempfile 2 to '/ora12c/oradata/seed/temp01.dbf';
set newname for tempfile 3 to '/ora12c/oradata/pdb/pdb1/temp01.dbf';
restore database;
switch datafile all;
switch tempfile all;
}
4、恢復(fù)數(shù)據(jù)庫
這里做不完全恢復(fù)。
RMAN> list backup of database;
省略部分。。。。。
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 40189418 06-AUG-17 /ora12c/oradata/cdb/system01.dbf
3 Full 40189418 06-AUG-17 /ora12c/oradata/cdb/sysaux01.dbf
4 Full 40189418 06-AUG-17 /ora12c/oradata/cdb/undotbs01.dbf
6 Full 40189418 06-AUG-17 /ora12c/oradata/cdb/users01.dbf
省略部分。。。。。
==》通過上述部分可以看到Ckp SCN 為40189418、
RMAN> list backup of archivelog all;
省略部分。。。
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 664 40186320 06-AUG-17 40188631 06-AUG-17
1 665 40188631 06-AUG-17 40190128 06-AUG-17
2 634 40186323 06-AUG-17 40188634 06-AUG-17
2 635 40188634 06-AUG-17 40190122 06-AUG-17
3 582 40186334 06-AUG-17 40188628 06-AUG-17
3 583 40188628 06-AUG-17 40190125 06-AUG-17
省略部分。。。
==》通過對歸檔的Low SCN和Next SCN以及Ckp SCN 的分析,確認(rèn)恢復(fù)到scn號為40190122。
以下給出恢復(fù)的腳本,供參考
run {
set archivelog destination to '/recovery_area/tmp/';
recover database until scn 40190122;
}
5、打開數(shù)據(jù)庫
RMAN> alter database open resetlogs;
如果打不開,要求介質(zhì)恢復(fù),可以繼續(xù)追加歸檔日志進(jìn)行恢復(fù)。
6、刪除多余的日志組和undo表空間
(1)清理日志組
SELECT b.member, a.group#,thread#, a.status
FROM v$log a, v$logfile b
WHERE a.group# = b.group#
ORDER BY a.thread#,b.group#;
MEMBER GROUP# THREAD# STATUS
------------------------------ ---------- ---------- -------------
+CDB/cdb/redo01.log 1 1 CURRENT
+CDB/cdb/redo02.log 2 1 UNUSED
+CDB/cdb/redo03.log 3 2 INACTIVE
+CDB/cdb/redo04.log 4 2 UNUSED
+CDB/cdb/redo05.log 5 3 INACTIVE
+CDB/cdb/redo06.log 6 3 UNUSED
==》這里刪除組3,4,5,6
SQL> alter database disable thread 2;
Database altered.
SQL> alter database disable thread 3;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter database drop logfile group 4;
Database altered.
SQL> alter database drop logfile group 5;
Database altered.
SQL> alter database drop logfile group 6;
Database altered.
(2)清理unod表空間
SQL> select name from v$tablespace where name like 'UNDO%';
NAME
-------------------------
UNDOTBS1
UNDOTBS2
UNDOTBS3
==》通過show parameter undo_tablespace 命令確認(rèn)要保留的undo,這里刪除UNDOTBS2和UNDOTBS3表空間
SQL> drop tablespace UNDOTBS2 including contents and datafiles;
Tablespace dropped.
SQL> drop tablespace UNDOTBS3 including contents and datafiles;
Tablespace dropped.
關(guān)于Oracle 12cR1 rac怎么恢復(fù)到單機(jī)文件系統(tǒng)測試就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
當(dāng)前名稱:Oracle12cR1rac怎么恢復(fù)到單機(jī)文件系統(tǒng)測試
文章分享:http://jinyejixie.com/article24/iiedje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、微信小程序、微信公眾號、全網(wǎng)營銷推廣、電子商務(wù)、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)