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

[RMAN] different machine recovery experiment

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

Share

Shulou(Shulou.com)06/01 Report--

I. preparatory work

1. Environment setting

Source database: IP 192.168.131.100 SID:orcl

Target library: IP 192.168.131.101 installs the same version of the database software as the source database (no instance is created)

two。 Preparatory work

The source library creates a full backup set (including control files, data files, and archive files).

For simplicity, the directory structure on the source and target side of the database is consistent. If inconsistent, be careful to modify the relevant path during the recovery process.

II. Experimental implementation

1. Back up the main library

RMAN > run {

Sql 'alter system archive log current'

Backup database format'/ backup/dbfull_%d_%u_%s.bak' plus archivelog format'/ archivelog/archfull_%d_%u_%s.bak'

Backup current controlfile format'/ backup/ctl_%d_%T_%s.bak';}

two。 Copy the source library spfile to the same directory on the destination side

(1) copy the source database

$cd $ORACLE_HOME/dbs

$scp spfileorcl.ora oracle@192.168.131.101:$ORACLE_HOME/dbs

(2) the target library modifies spfile

This step is not necessary.

If the target library is consistent with the source library path, no modification is required. If the paths are inconsistent, you need to ensure that the following paths are correct:

N Audit_file_dest: the debug log path of ORACLE audit output

N Control_files: control file path

N db_recovery_file_dest: FRA path (if FRA is specified)

N log_archive_dest_1: log archive path

Note: spfile is a binary file and cannot be edited directly. If you want to modify it, you need to create a pfile through spfile, then modify the pfile, and then create a spfile through pfile.

3. The target library starts nomount

$export $ORACLE_SID=orcl

$sqlplus / as sysdba

SQL > startup nomount

Spfile is required to start the nomount state. If the spfile of the source library is not placed in the $ORACLE_HOME/dbs directory, you need to execute:

SQL > startup nomount from spfile='/url/spfileorcl.ora'

4. Restore controlfile using RMAN

$rman target /

RMAN > restore controlfile from'/ backup/ctl_ORCL_20181022_31.bak'

No matter how many control files there are, they will be restored to the corresponding path.

5. Open the database to mount state

To open the database to mount state, you need to read controlfile.

SQL > alter database mount

6. Repair the database

In this environment, the paths of the source and target libraries are the same, so it can be repaired directly with the original path. If the path of the target library is different from that of the source library, you need to SET NEWNAME FOR DATAFILE the data file through the path command (note that SET NEWNAME must be executed in the run block).

RMAN > restore database

At this point, the data files have been repaired to the corresponding path.

7. Restore the database

RMAN > recover database

Archived log thread=1 sequence=13

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of recover command at 10/22/2018 03:39:24

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 13 and starting SCN of 1052433

The error report here is normal, because the hot backup we created is an inconsistent backup, and the source database is archived, but the redo logs are not set with the backup, so the restored database will not be able to restore its original state. This error indicates that you need the redo log of the sequence13 generated by thread 1 if you want to continue the recovery. If you want to be consistent, you must copy the redo log file of the source database.

At this point, the database has been restored.

8. Open the database

SQL > alter database open resetlogs

-end-

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