这篇文章给大家分享的是有关使用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.11.取消备库日志应用SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;2.在备库上确定需要开始增量备份的SCNSQL> SELECT CURRENT_SCN FROM V$DATABASE;CURRENT_SCN
———–
3505254SQL> 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 byt免费主机域名es
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:/tmp5.将拷贝过来的备份注册到备库的控制文件中[oracle@stand ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 – Production on Thu Mar 29 11:37:52 2018Copyright (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/ForStandbyList of Files Unknown to the Database
=====================================
File Name: /tmp/ForStandby_08sv0bdj_1_1
File Name: /tmp/ForStandby_07sv0bcg_1_1Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files…
cataloging doneList of Cataloged Files
=======================
File Name: /tmp/ForStandby_08sv0bdj_1_1
File Name: /tmp/ForStandby_07sv0bcg_1_16.使用增量备份恢复备库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:01Finished recover at 29-MAR-187.在主库为备库重新备份控制文件,并scp到备库RMAN> BACKUP C免费主机域名URRENT 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:008.备库还原控制文件:RMAN> shutdown immediate;database dismountedOracle instance shut downRMAN> startup nomount;connected to target database (not started)
Oracle instance startedTotal System Global Area 1002127360 bytesFixed Size 2259440 bytes
Variable Size 285214224 bytes
Database Buffers 708837376 bytes
Redo Buffers 5816320 bytesRMAN> 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=DISKchannel 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-189.重启备库到mountRMAN> 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.688213335Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files…
cataloging doneList 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.1SQL> select file#,name from v$datafile where creation_change# > 3505254;no rows selectedRMAN> 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 groupSQL> 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如何处理”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
相关推荐: windows和linux环境下10g升级到11.2.0.4 并安装11.2.0.4.19补丁的示例分析
小编给大家分享一下windows和linux环境下10g升级到11.2.0.4 并安装11.2.0.4.19补丁的示例分析,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!一 、备份 升级数据库是一个十分危险的事情,在生产库上,升级之前最好做一个…