中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap如何處理

發布時間:2021-11-09 14:47:37 來源:億速云 閱讀:165 作者:小新 欄目:關系型數據庫

這篇文章給大家分享的是有關使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap如何處理的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

場景:

備庫執行日志應用出現如下報錯:

Thu Mar 29 11:21:45 2018
FAL[client]: Failed to request gap sequence
 GAP - thread 1 sequence 184-185
 DBID 1484954774 branch 960494131
FAL[client]: All defined FAL servers have been attempted.
------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that's sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.

查詢缺失的歸檔日志:

SQL> select * from v$archive_gap;

THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
  1              183          185

去主庫查看歸檔,發現歸檔已丟失

SQL> archive log list;

Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archivelog
Oldest online log sequence 186
Next log sequence to archive 188
Current log sequence 188

[ Oracle @prim archivelog]$ pwd
/u01/archivelog
[oracle@prim archivelog]$ ls -ltr
total 1964
-rw-r----- 1 oracle oinstall 74752 Mar 29 11:17 1_186_960494131.dbf
-rw-r----- 1 oracle oinstall 1930240 Mar 29 11:17 1_187_960494131.dbf

下面開始使用RMAN進行基于SCN增量備份恢復的方式進行恢復,參考文檔 ID 836986.1

1.取消備庫日志應用

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;

2.在備庫上確定需要開始增量備份的SCN

SQL> SELECT CURRENT_SCN FROM V$DATABASE;

CURRENT_SCN
-----------
 3505254

SQL> select min(checkpoint_change#) from v$datafile_header 
 where file# not in (select file# from v$datafile where enabled = 'READ ONLY');

MIN(CHECKPOINT_CHANGE#)
-----------------------

(如果結果為空,重啟備庫到mount狀態)
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1002127360 bytes
Fixed Size 2259440 bytes
Variable Size 285214224 bytes
Database Buffers 708837376 bytes
Redo Buffers 5816320 bytes
Database mounted.
SQL> select min(checkpoint_change#) from v$datafile_header 
where file# not in (select file# from v$datafile where enabled = 'READ ONLY');

MIN(CHECKPOINT_CHANGE#)
-----------------------
 3505255

選擇以上結果中最小SCN作為增量備份的起點(此處是350524)。

3.在主庫上進行基于SCN的增量備份

RMAN> BACKUP INCREMENTAL FROM SCN 3505254 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';

4.拷貝剛才的備份到備庫

scp /tmp/ForStandby_* 192.168.211.162:/tmp

5.將拷貝過來的備份注冊到備庫的控制文件中

[oracle@stand ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Mar 29 11:37:52 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1484954774, not open)

RMAN> CATALOG START WITH '/tmp/ForStandby';

using target database control file instead of recovery catalog
searching for all files that match the pattern /tmp/ForStandby

List of Files Unknown to the Database
=====================================
File Name: /tmp/ForStandby_08sv0bdj_1_1
File Name: /tmp/ForStandby_07sv0bcg_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /tmp/ForStandby_08sv0bdj_1_1
File Name: /tmp/ForStandby_07sv0bcg_1_1

6.使用增量備份恢復備庫

RMAN> RECOVER DATABASE NOREDO;

Starting recover at 29-MAR-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/rzorcl/system01.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/rzorcl/sysaux01.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/rzorcl/undotbs01.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/rzorcl/users01.dbf
destination for restore of datafile 00005: /u01/app/oracle/oradata/rzorcl/example01.dbf
destination for restore of datafile 00006: /u01/app/oracle/oradata/rzorcl/odc_tps01.dbf
destination for restore of datafile 00007: /u01/app/oracle/oradata/rzorcl/test01.dbf
destination for restore of datafile 00008: /u01/app/oracle/oradata/rzorcl/big01.dbf
destination for restore of datafile 00009: /u01/app/oracle/oradata/rzorcl/big02.dbf
channel ORA_DISK_1: reading from backup piece /tmp/ForStandby_07sv0bcg_1_1
channel ORA_DISK_1: piece handle=/tmp/ForStandby_07sv0bcg_1_1 tag=FORSTANDBY
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished recover at 29-MAR-18

7.在主庫為備庫重新備份控制文件,并scp到備庫

RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ForStandbyCTRL.bck';

Starting backup at 29-MAR-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 29-MAR-18
channel ORA_DISK_1: finished piece 1 at 29-MAR-18
piece handle=/tmp/ForStandbyCTRL.bck tag=TAG20180329T114413 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-MAR-18

[oracle@prim tmp]$ scp ForStandbyCTRL.bck 192.168.211.162:/tmp
oracle@192.168.211.162's  password: 
ForStandbyCTRL.bck 100% 9856KB 9.6MB/s 00:00

8.備庫還原控制文件:

RMAN> shutdown immediate;

database dismounted

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area 1002127360 bytes

Fixed Size 2259440 bytes
Variable Size 285214224 bytes
Database Buffers 708837376 bytes
Redo Buffers 5816320 bytes

RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck';

Starting restore at 29-MAR-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/rzorcl/control01.ctl
output file name=/u01/app/oracle/oradata/rzorcl/control02.ctl
Finished restore at 29-MAR-18

9.重啟備庫到mount

RMAN> SHUTDOWN; 
RMAN> STARTUP MOUNT;

10.如果數據庫是用OMF方式管理數據文件的,則需要在備庫的控制文件中重新注冊下數據文件,示例如下:

(如果數據文件存放在文件系統,沒有使用OMF,則跳過此步驟)

RMAN> CATALOG START WITH '+DATA/rzorcl/datafile/';

List of Files Unknown to the Database 
===================================== 
File Name: +data/rzorcl/DATAFILE/SYSTEM.309.685535773 
File Name: +data/rzorcl/DATAFILE/SYSAUX.301.685535773 
File Name: +data/rzorcl/DATAFILE/UNDOTBS1.302.685535775 
File Name: +data/rzorcl/DATAFILE/SYSTEM.297.688213333 
File Name: +data/rzorcl/DATAFILE/SYSAUX.267.688213333 
File Name: +data/rzorcl/DATAFILE/UNDOTBS1.268.688213335

Do you really want to catalog the above files (enter YES or NO)? YES 
cataloging files... 
cataloging done

List of Cataloged Files 
======================= 
File Name: +data/rzorcl/DATAFILE/SYSTEM.297.688213333 
File Name: +data/rzorcl/DATAFILE/SYSAUX.267.688213333 
File Name: +data/rzorcl/DATAFILE/UNDOTBS1.268.688213335

確保主庫在這個SCN之后沒有添加新的數據文件,如果有則需要單獨進行備份和還原,參考文檔文檔 ID 836986.1

SQL> select file#,name from v$datafile where creation_change# > 3505254;

no rows selected

RMAN> SWITCH DATABASE TO COPY;

datafile 1 switched to datafile copy "+DATA/rzorcl/datafile/system.297.688213333" 
datafile 2 switched to datafile copy "+DATA/rzorcl/datafile/undotbs1.268.688213335" 
datafile 3 switched to datafile copy "+DATA/rzorcl/datafile/sysaux.267.688213333"

11. 若備庫開啟了閃回,需要重新開啟閃回

SQL> ALTER DATABASE FLASHBACK OFF; 
SQL> ALTER DATABASE FLASHBACK ON;

12. 備庫clear standby log group

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 4; 
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 5; 
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 6;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 7;

13. 備庫開啟日志應用,至此整個過程結束

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

感謝各位的閱讀!關于“使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap如何處理”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

凌云县| 舞阳县| 溆浦县| 蒙阴县| 济南市| 清涧县| 宜阳县| 兴化市| 建宁县| 新源县| 弥渡县| 湄潭县| 鄂尔多斯市| 股票| 昌图县| 宁蒗| 集安市| 确山县| 营山县| 和田县| 会昌县| 襄城县| 简阳市| 诏安县| 徐汇区| 镇雄县| 博野县| 阳新县| 万安县| 太原市| 丰原市| 若尔盖县| 博乐市| 镇坪县| 黎平县| 上栗县| 秀山| 固始县| 汉阴县| 余干县| 普安县|