Oracle RMAN recovers databases to different hosts (ii)

Source: Internet
Author: User

We have an error in the Recover database times:

Rman-06054:media recovery requesting unknown archived log for thread 1 with sequence 149 and starting SCN of 3507749

here is a reminder to revert to an unknown SCN number.  we have only 148th in the backup archive, 149th or online redo, so there is no copy come over, if we do not specify the end time of recover, we will prompt the above information: RMAN-06054. Therefore , you can avoid this error after the ALTER DATABASE mount, by setting the until SCN or the set until time command to revert to the SCN number or times. such as:

Rman>run{set until sequence 149;     Recover database;  }executing command:set until clausestarting recover at .- to- A  at: -: theusingchannel ora_disk_1starting Media recoverymedia recovery complete, elapsed time:xx:xx:xxfinished recover at .- to- A  at: -: the

L, after the restoration, there is a very important work to do, that is, to restore redo log files. If the source library's directory structure is the same as the directory structure of the new library, the online redo log is recreated when the open resetlogs. but now the location of the redo log file has changed, and the Open resetlogs Times has the following error:

Rman> ALTER DATABASE open resetlogs; RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE, STACK follows ===============RMAN-00571: ===========================================================RMAN-03002: Failure of SQL statement command at to/ A/ .  at:Panax Notoginseng: $ORA-00344: Unable to re-create online log'/u01/app/oracle/oradata/scp/redo01.log'ORA-27040: File Create error, unable to create Filelinux-x86_64 Error:2: No Such file or directoryadditional information:1

Because the path to the source and target libraries is different, Oracle tries to create the redo log file in its old location, but discovers that the path does not exist on the target library. The workaround is to reset the path of the old file to the new path, but how do we know the Source Library redo log Where are the file files located? Because the database is already on Mount, execute the query directly:

Select Group#,type,member from V$logfile;

group# type MEMBER ---------------------------------------------------------------------- ---------- 3 online /u01/app/oracle/oradata/scp/redo03.log 2 online /u01/ app/oracle/oradata/scp/redo02.log 1 online /u01/app/oracle/oradata/scp/redo01.log

Next we assign these redo log file to the new file location:

RMAN>run{ALTER DATABASE RENAME file'/u01/app/oracle/oradata/scp/redo01.log'To'/home/oracledata/scp/redo01.log'; ALTER DATABASE RENAME File'/u01/app/oracle/oradata/scp/redo02.log'To'/home/oracledata/scp/redo02.log'; ALTER DATABASE RENAME File'/u01/app/oracle/oradata/scp/redo03.log'To'/home/oracledata/scp/redo03.log'; }statement processedstatement processedstatement processed

This time we opened the database in Resetlogs mode, Oracle reported ora-00392 error,

Rman> ALTER DATABASE open resetlogs; RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE, STACK follows ===============RMAN-00571: ===========================================================RMAN-03002: Failure of SQL statement command at to/ -/ . xx: -:Panax NotoginsengORA-00392: Log2of thread1  isbeing cleared, operation not Allowedora-00312: Online Log2Thread1:'/home/oracledata/scp/redo02.log'

Let's check the status of redo log file at this time:

Rman>SelectGroup#,sequence#,bytes,members,status fromV$log; group# sequence# BYTES Members STATUS---------- ---------- ---------- ---------- ----------------1          0   52428800          1Clearing3          0   52428800          1Clearing2          0   52428800          1Clearing_current

The following are the official documents of Oracle:

(1) Clearing----log is being re-created as a empty Log after an ALTER DATABASE CLEAR LOGFILE statement. After the log are cleared, the status changes to UNUSED.

(2) clearing_current----Current log is being cleared of a closed thread. The log can stay in this status if there are some failure in the switch such as an I/O error writing the new log header.

Workaround:

Rman>ALTER DATABASE clear logfile Group 2; Statement Processedrman>SelectGroup#,sequence#,bytes,members,status fromV$log; group# sequence# BYTES Members STATUS---------- ---------- ---------- ---------- ----------------1          0   52428800          1Clearing3          0   52428800          1Clearing2          0   52428800          1Current

M, finally opened the database with open resetlogs, and performed some log switching.

Rman>ALTER DATABASE open resetlogs; Statement Processedrman> Alter systemSwitchlogfile; Statement Processedrman> Alter systemSwitchlogfile; Statement Processedrman>SelectGroup#,sequence#,bytes,members,status fromV$log; group# sequence# BYTES Members STATUS---------- ---------- ---------- ---------- ----------------1          1   52428800          1ACTIVE2          2   52428800          1ACTIVE3          3   52428800          1Current

N, this is not finished, we need to create a spfile file, a temporary tablespace, and a password file:

Alter tablespace temp add tempfile '/home/oracledata/scp/temp01.dbf '  size 29m reuse autoextend on next 640k maxsize 32767m; Statement processed

create SPFile from Pfile; RMAN>orapwd file= ' $ORACLE _home/dbs/pwdscp.ora ' password= ' [email protected]# ' entries=3

At this point, the use of Rman to recover the database to different host operation is complete, remember to do a full preparation of Rman!!!

Oracle RMAN recovers databases to different hosts (ii)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.