Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using RMAN incremental backup to deal with Dataguard how to deal with gap caused by Archive loss

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to use RMAN incremental backup to deal with gap caused by archive loss in Dataguard. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Scene:

The following error occurred in the application of database execution log:

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.

Query missing archive logs:

SQL > select * from v$archive_gap

THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#

1 183 185

Check the archive in the main library and find that the archive has been lost

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

Let's start using RMAN for SCN-based incremental backup recovery, refer to the document ID 836986.1

1. Cancel the application of preparing database log

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel

two。 Identify the SCN on the repository that needs to start incremental backups

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#)

(if the result is empty, restart the library to mount state)

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

Select the smallest SCN of the above results as the starting point for the incremental backup (350524 here).

3. Perform SCN-based incremental backups on the main library

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

4. Copy the backup you just made to the standby database

Scp / tmp/ForStandby_* 192.168.211.162:/tmp

5. Register the copied backup in the control file of the repository

[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. Restore a standby library using an incremental backup

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. Back up the control files for the standby library in the main library, and scp to the standby library

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. Prepare the library restore control file:

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. Restart the standby library to mount

RMAN > SHUTDOWN

RMAN > STARTUP MOUNT

10. If the database manages the data file in OMF mode, you need to re-register the data file in the control file of the slave database. The example is as follows:

(skip this step if the data file is stored on the file system and OMF is not used)

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

Make sure that no new data files are added to the main library after this SCN. If so, backup and restore need to be done separately. Refer to the documentation 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. If flashback is enabled in the backup database, you need to re-enable flashback.

SQL > ALTER DATABASE FLASHBACK OFF

SQL > ALTER DATABASE FLASHBACK ON

twelve。 Reserve library 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. Prepare the database to open the log application, and the whole process is over.

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION

Thank you for reading! This is the end of this article on "using RMAN incremental backup to deal with gap caused by the loss of archives in Dataguard". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report