利用增量備份恢復因歸檔丟失造成的DG gap
利用增量備份恢復因歸檔丟失造成的DG gap
data guard歸檔出現gap,悲劇的是丟失的歸檔在主庫上被rman備份時刪除了,丟失的歸檔大約有20幾個,資料庫大小約2T,如果重建DG將非常耗時間,因此決定利用增量備份的方式恢復DG,主要步驟如下:
0、檢視備份庫歸檔應用
SQL> select sequence#,applied from v$archived_log;
1.備份備庫spfile檔案
SQL> create pfile='/home/ora/pfileRdg.ora' from spfile;
2、檢視當前備庫scn
SQL> select to_char(current_scn) from v$database;
TO_CHAR(CURRENT_SCN)
----------------------------------------
19652214434
3、檢視缺失的archivelog
SQL> select * from v$archive_gap;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
1 160163 160170
2 151303 151309
4、在主庫執增量備份
[ora@jzhRAC1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 18:10:52 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265)
RMAN> run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
backup as compressed backupset incremental from SCN 19652214434 database format '/home/ora/full_db_%d_%T_%s.bak' include current controlfile for standby filesperset=5 tag 'FOR STANDBY';
release channel d1;
release channel d2;
release channel d3;
}
5、將備份傳至備庫
scp full_db_JZH_20150523_*.bak 192.168.110.115:~/20150523_recover/
6、恢復備庫
[ora@jzhDG ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 20:17:59 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265, not open)
RMAN> catalog start with '/home/ora/20150523_recover';
[ora@jzhDG ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 20:25:44 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265, not open)
RMAN> run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
restore standby controlfile to '/home/ora/control01.ctl';
recover database noredo;
release channel d1;
release channel d2;
release channel d3;
}
如果報下面的錯誤。(只擷取了部分錯誤),我們可以重啟資料庫解決。
restore not done; all files readonly, offline, or already restored
Finished restore at 01-APR-12
Starting recover at 01-APR-12
released channel: dsk0
released channel: dsk1
released channel: dsk2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/01/2012 23:14:12
ORA-01219: database not open: queries allowed on fixed tables/views only
7、關閉備庫,將恢復出來的control01.ctl覆蓋備庫控制檔案
[ora@jzhDG ~]$ cp control01.ctl /oradata/JZH/standby.ctl
8、啟動備庫至mount狀態
SQL> startup mount
ORACLE instance started.
Total System Global Area 1795162112 bytes
Fixed Size 2084648 bytes
Variable Size 301990104 bytes
Database Buffers 1476395008 bytes
Redo Buffers 14692352 bytes
Database mounted.
9、檢視gap
SQL> select * from v$archive_gap;
no rows selected
10、開啟備庫recover模式
SQL> recover managed standby database disconnect from session;
Media recovery complete.
11、Alter database recover managed standby database cancel;
12、alter database open;
13、SQL> recover managed standby database disconnect from session;
檢視備庫的歸檔應用狀態。
Select sequence#,applied from v$archived_log;
data guard歸檔出現gap,悲劇的是丟失的歸檔在主庫上被rman備份時刪除了,丟失的歸檔大約有20幾個,資料庫大小約2T,如果重建DG將非常耗時間,因此決定利用增量備份的方式恢復DG,主要步驟如下:
0、檢視備份庫歸檔應用
SQL> select sequence#,applied from v$archived_log;
1.備份備庫spfile檔案
SQL> create pfile='/home/ora/pfileRdg.ora' from spfile;
2、檢視當前備庫scn
SQL> select to_char(current_scn) from v$database;
TO_CHAR(CURRENT_SCN)
----------------------------------------
19652214434
3、檢視缺失的archivelog
SQL> select * from v$archive_gap;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
1 160163 160170
2 151303 151309
4、在主庫執增量備份
[ora@jzhRAC1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 18:10:52 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265)
RMAN> run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
backup as compressed backupset incremental from SCN 19652214434 database format '/home/ora/full_db_%d_%T_%s.bak' include current controlfile for standby filesperset=5 tag 'FOR STANDBY';
release channel d1;
release channel d2;
release channel d3;
}
5、將備份傳至備庫
scp full_db_JZH_20150523_*.bak 192.168.110.115:~/20150523_recover/
6、恢復備庫
[ora@jzhDG ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 20:17:59 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265, not open)
RMAN> catalog start with '/home/ora/20150523_recover';
[ora@jzhDG ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat May 23 20:25:44 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JZH (DBID=2072634265, not open)
RMAN> run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
restore standby controlfile to '/home/ora/control01.ctl';
recover database noredo;
release channel d1;
release channel d2;
release channel d3;
}
如果報下面的錯誤。(只擷取了部分錯誤),我們可以重啟資料庫解決。
restore not done; all files readonly, offline, or already restored
Finished restore at 01-APR-12
Starting recover at 01-APR-12
released channel: dsk0
released channel: dsk1
released channel: dsk2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/01/2012 23:14:12
ORA-01219: database not open: queries allowed on fixed tables/views only
7、關閉備庫,將恢復出來的control01.ctl覆蓋備庫控制檔案
[ora@jzhDG ~]$ cp control01.ctl /oradata/JZH/standby.ctl
8、啟動備庫至mount狀態
SQL> startup mount
ORACLE instance started.
Total System Global Area 1795162112 bytes
Fixed Size 2084648 bytes
Variable Size 301990104 bytes
Database Buffers 1476395008 bytes
Redo Buffers 14692352 bytes
Database mounted.
9、檢視gap
SQL> select * from v$archive_gap;
no rows selected
10、開啟備庫recover模式
SQL> recover managed standby database disconnect from session;
Media recovery complete.
11、Alter database recover managed standby database cancel;
12、alter database open;
13、SQL> recover managed standby database disconnect from session;
檢視備庫的歸檔應用狀態。
Select sequence#,applied from v$archived_log;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-2139811/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用增量備份恢復gap歸檔丟失DG
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- dg丟失歸檔,使用rman增量備份恢復
- 運用incremental backup(增量備份)恢復歸檔GAP的DGREM
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- 【備份恢復】恢復 丟失已歸檔重做日誌檔案
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- 非歸檔無備份下控制檔案丟失的恢復
- 歸檔模式無備份丟失資料檔案後恢復模式
- 歸檔模式有備份丟失資料檔案後恢復模式
- 【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作模式
- 【備份恢復】所有控制檔案丟失後 利用trace中的控制檔案備份執行恢復
- 沒備份,歸檔日誌存在,丟失資料檔案的恢復
- TSM備份時因歸檔日誌丟失而導致備份失敗
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- 恢復之利用備份在所有控制檔案丟失情況下恢復(四)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(三)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(二)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(一)
- 備份恢復之資料檔案丟失
- dataguard 歸檔丟失,備庫基於SCN恢復
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- mysql 利用binlog增量備份、恢復MySql
- Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)Oracle
- 【備份恢復】 丟失一個控制檔案 之恢復操作
- 只有rman備份集,控制檔案丟失的恢復
- DG 主庫丟失歸檔
- 備份與恢復--利用備份的控制檔案恢復
- Oracle主庫歸檔丟失,備庫日誌有gap,在不重建備庫的情況下,恢復備庫Oracle
- 【BBED】丟失歸檔檔案情況下的恢復
- 非歸檔丟失日誌檔案的恢復
- 備份恢復實驗(1)丟失部分控制檔案
- 【DATAGUARD】物理dg在主庫丟失歸檔檔案的情況下的恢復(七)
- 【備份恢復】丟失所有控制檔案,利用RMAN進行恢復操作
- 備份&恢復之五:歸檔模式下丟失或損壞一個資料檔案模式
- 恢復案例:歸檔模式下丟失全部資料檔案的恢復模式
- 歸檔模式下資料檔案丟失的恢復模式