您好,登錄后才能下訂單哦!
這篇文章給大家介紹Oracle 12cR1 rac怎么恢復到單機文件系統測試,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
對從12cR1 RAC到單機文件系統的還原做個簡單的示例。
1、參數文件的修改
SQL> create pfile='/home/oracle/init.ora' from spfile;
通過上述命令轉儲pfile出來進行參數的修改。
2、將備份出的控制文件在單機上進行還原
RMAN> restore controlfile from '/recovert_area/tmp/controlfile_db_p5sb7rbl_1_1.bak;
3、還原數據庫
將備份集放入recovery_area/bak/目錄下,執行以下命令:
RMAN> catalog start with '/recovery_area/bak/';
這里的數據文件文件和臨時文件的路徑需要更改下,因為是還原到文件系統,這里給出示例腳本沒有給出最終的數據文件名稱,所以只供參考:
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、恢復數據庫
這里做不完全恢復。
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 的分析,確認恢復到scn號為40190122。
以下給出恢復的腳本,供參考
run {
set archivelog destination to '/recovery_area/tmp/';
recover database until scn 40190122;
}
5、打開數據庫
RMAN> alter database open resetlogs;
如果打不開,要求介質恢復,可以繼續追加歸檔日志進行恢復。
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 命令確認要保留的undo,這里刪除UNDOTBS2和UNDOTBS3表空間
SQL> drop tablespace UNDOTBS2 including contents and datafiles;
Tablespace dropped.
SQL> drop tablespace UNDOTBS3 including contents and datafiles;
Tablespace dropped.
關于Oracle 12cR1 rac怎么恢復到單機文件系統測試就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。