利用增量備份恢復因歸檔丟失造成的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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- dg丟失歸檔,使用rman增量備份恢復
- 用增量備份來快速恢復dg
- 【BBED】丟失歸檔檔案情況下的恢復
- rman 增量備份恢復
- DG歸檔日誌缺失恢復
- RMAN-ERROR:因為找不到過期和丟失的歸檔日誌而備份失敗Error
- oracle 增量備份恢復驗證Oracle
- OracleDG備庫恢復–gapOracle
- ORACLE DG從庫 Rman備份恢復Oracle
- 【Xtrabackup】Xtrabackup全備、增量備份及恢復示例
- oracle dg 歸檔日誌恢復情況Oracle
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- 剪下的檔案還能恢復嗎,恢復剪貼丟失的檔案
- 丟失的隨身碟檔案如何恢復?
- Oracle dg歸檔同步失敗Oracle
- 電腦檔案丟失資料恢復資料恢復
- 利用innobackupex備份集恢復指定庫
- 從備份片中恢復某個指定得歸檔或者資料檔案
- 測試在丟失歸檔日誌的情況下,跳過部分歸檔日誌進行資料恢復資料恢復
- RAC備份恢復之Voting備份與恢復
- Sql Server資料庫檔案丟失的恢復方法SQLServer資料庫
- XFS檔案系統的備份、恢復、修復
- 基於percona xtrabackup 2.4.14的增量備份恢復還原mysql 5.6MySql
- 利用docker-compose恢復gitlab備份的資料DockerGitlab
- Oracle Redo丟失恢復方案Oracle
- 伺服器資料丟失了怎麼恢復/分割槽丟失恢復教程伺服器
- DATA GUARD主庫丟失資料檔案的恢復(3)
- DATA GUARD主庫丟失資料檔案的恢復(1)
- DATA GUARD主庫丟失資料檔案的恢復(2)
- 備份與恢復:polardb資料庫備份與恢復資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 硬碟資料丟失如何恢復?硬碟
- 分割槽丟失資料恢復資料恢復
- 【北亞資料恢復】企業如何避免伺服器資料丟失造成重大損失?資料恢復伺服器
- mydumper備份恢復
- Mysql備份恢復MySql
- 備份和恢復
- 12 使用RMAN備份和恢復檔案