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

How to restore the data on the standby side of dataguard by incremental backup

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly explains "how to restore the standby data in the dataguard by incremental backup". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to incremental backup and restore the standby data in dataguard".

Many customers who are using dataguard will encounter a thorny problem: during the synchronization between the backup side and the primary database, one or more archive logs are lost due to network or disk problems, so that dataguard synchronization cannot continue. Many customers have chosen to restore the full library and rebuild the dataguard. If our source database is very large (more than 100 gigabytes of data), we can choose a more simple and efficient recovery method-to restore the data on the standby side of rman through incremental backups of dataguard.

The specific recovery process is as follows:

1) Stop the managed recovery process (MRP) on the STANDBY database

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL

2) Determine the SCN of the STANDBY database.

SQL > SELECT CURRENT_SCN FROM V$DATABASE

CURRENT_SCN

-

3164433

SQL > select min (checkpoint_change#) from v$datafile_header

Where file# not in (select file# from v$datafile where enabled = 'READ ONLY')

MIN (F.FHSCN)

-

3162298

Comment: the above one is the SCN number recorded in the control file, and the other is the SCN number recorded in the header of the data file. We need to select the smaller SCN number (3162298) to back up.

3) Take an incremental backup of the PRIMARY database

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

4) Transfer all backup sets to STANDBY server

Scp / tmp/ForStandby_* standby:/tmp

5) Catalog the backups in STANDBY controlfile.

RMAN > CATALOG START WITH'/ tmp/ForStandby'

6) Recover the STANDBY database with the cataloged incremental backup:

RMAN > RECOVER DATABASE NOREDO

7) In RMAN, connect to the PRIMARY database and create a standby control file backup:

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

8) Copy the standby control file backup to the STANDBY system.

9) Capture datafile information in STANDBY database.

We now need to refresh the standby controlfile from primary controlfile (for standby) backup. However, since the datafile names are likely different than primary, let's save the name of datafiles on standby first, which we can refer after restoring controlfile from primary backup to verify if there is any discrepancy. Run below query from Standby and save results for further use.

10) From RMAN, connect to STANDBY database and restore the standby control file:

RMAN > SHUTDOWN IMMEDIATE

RMAN > STARTUP NOMOUNT

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

11) Shut down the STANDBY database and startup mount:

RMAN > SHUTDOWN

RMAN > STARTUP MOUNT

Scp / tmp/ForStandbyCTRL.bck standby:/tmp

12) Catalog datafiles in STANDBY if location/name of datafiles is different

Since the controlfile is restored from PRIMARY the datafile locations in STANDBY controlfile will be same as PRIMARY database, if the directory structure is different between the standby and primary or you are using Oracle managed file names, catalog the datafiles in STANDBY will do the necessary rename operations. If the primary and standby have identical structure and datafile names, this step can be skipped.

Perform the below step in STANDBY for each diskgroup where the datafile directory structure between primary and standby are different.

RMAN > CATALOG START WITH'+ DATA/mystd/datafile/'

To determine if any files have been added to Primary since the standby current scn:

SQL > SELECT FILE#, NAME FROM V$DATAFILE WHERE CREATION_CHANGE# > 3162298

If the above query returns with 0 zero rows, you can switch the datafiles. This will rename the datafiles to its correct name at the standby site:

RMAN > SWITCH DATABASE TO COPY

Datafile 1 switched to datafile copy "+ DATA/mystd/datafile/system.297.688213333"

Datafile 2 switched to datafile copy "+ DATA/mystd/datafile/undotbs1.268.688213335"

Datafile 3 switched to datafile copy "+ DATA/mystd/datafile/sysaux.267.688213333"

13) Configure the STANDBY database to use flashback (optional)

SQL > ALTER DATABASE FLASHBACK OFF

SQL > ALTER DATABASE FLASHBACK ON

14) On STANDBY database, clear all standby redo log groups:

SQL > ALTER DATABASE CLEAR LOGFILE GROUP 1

SQL > ALTER DATABASE CLEAR LOGFILE GROUP 2

SQL > ALTER DATABASE CLEAR LOGFILE GROUP 3

....

15) On the STANDBY database, start the MRP

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT

For more detailed info:

Steps to perform for Rolling Forward a Physical Standby Database using RMAN Incremental Backup. (Doc ID 836986.1)

Thank you for your reading, the above is the content of "how to incrementally backup and restore the standby data in dataguard". After the study of this article, I believe you have a deeper understanding of how to incremental backup and restore the standby data in dataguard, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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