Oracle Rman cross-resetlogs version recovery

Source: Internet
Author: User

RMAN> startup nomount;

RMAN> SQL 'alter session set nls_date_format = ''yyyy-mm-dd hh24: mi: s ''";
-- Because rman reads the time format using environment variables by default, which is different from the fixed format of sqlplus, you must set the time format variable here.
RMAN> restore controlfile from autobackup until time '2017-03-10 18:15:00 ';
Note that you still need to restore the control file properly.
RMAN> alter database mount;
RMAN> restore database;
RMAN> SQL "alter session set nls_date_format = ''yyyy-mm-dd hh24: mi: s ''";
RMAN> recover database until time '2017-03-10 18:15:00 ';

 

The following error occurs:

RMAN-03002: recover command (on 19:21:19) failed
RMAN-20207: until time or recovery window before RESETLOGS TIME

 

20207 error: the default until time or recovery window time cannot be earlier than the resetlogs time. Since resetlogs is used, you do not know the archived log information. Exclude the previously archived logs from the options available for recovery. This is only the default behavior and may be considered to save system resources. After all, data reuse before resetlogs may be small.

 

The solution can be handled as follows:

1. Find the current incarnation Number of the database:

RMAN> list incarnation of database "test ";

Database prototype list
DB keyword Inc keyword DB name db id status reset SCN reset time
-------------------------------------------------------------
1 1 TEST 1978860036 PARENT 1 308-month-05
2 2 TEST 1978860036 PARENT 534907-09
3 3 TEST 1978860036 PARENT 762990-3-09
4 4 TEST 1978860036 PARENT 764885-3-09
5 5 TEST 1978860036 PARENT 765443-3-09
6 6 TEST 1978860036 PARENT 767488-3 months-09
7 7 TEST 1978860036 PARENT 771807-3-09
8 8 TEST 1978860036 PARENT 774320-3-09
9 9 TEST 1978860036 PARENT 779541-3-09
10 10 TEST 1978860036 PARENT 782000-3 months-09
11 11 TEST 1978860036 PARENT 783792-3-09
12 12 TEST 1978860036 CURRENT 801599-3-09 -- this line prototype (incarnation) number status is current, that is, the CURRENT

 
Therefore, the prototype of the previous database (before resetlogs) is 11.

We restart the database to the mount state (because we need to know which database is reset, so we need to mount it)

 

2. Reset the database to the previous prototype (note: the control file has been restored to an appropriate time point in the previous step. In fact, we should restore the control file before nomount)

RMAN> reset database to incarnation 11;

Reset database to prototype 11

RMAN> SQL "alter session set nls_date_format = ''yyyy-mm-dd hh24: mi: s ''";
RMAN> restore database;
RMAN> recover database until time '2017-03-10 18:15:00 ';
RMAN> alter database open resetlogs; (at this time, the database incarnation number will rise again)

The database is opened normally.

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.