Oracle RMAN-based Incomplete recovery (incompleterecoverybyRMAN)

Source: Internet
Author: User
Oracle databases can achieve Incomplete recovery and full recovery of databases. Full recovery is to restore the database to the latest time, that is, lossless recovery, to ensure that the database is not lost

Oracle databases can achieve Incomplete recovery and full recovery of databases. Full recovery is to restore the database to the latest time, that is, lossless recovery, to ensure that the database is not lost

Oracle databases can achieve Incomplete recovery and full recovery of databases. Full recovery is to restore the database to the latest time, that is, lossless recovery, to ensure that the database is not lost. Incomplete recovery specifically restores the database to a specific time point or SCN and a specific Sequence as needed. We can implement Incomplete recovery based on user management, or through RMAN. This document describes the Incomplete recovery based on RMAN and provides examples. For the concepts and practices of Database Backup Recovery and RMAN backup recovery, refer to the link at the end of the article.

1. Incomplete recovery steps
A. Shut down the database and back up the database (to prevent recovery failure)
B. Start the database to the mount status.
C. Restore A Database
D. Restore the database to a certain time point, sequence, or system change number.
E. Use the RESETLOGS keyword to open a database

Ii. Incomplete recovery
Type of Recovery Function
-----------------------------------------------
Time-based recovery Recovers the data up to a specified point in time.
Cancel-based recovery Recovers until you issue the CANCEL statement (not available when using Recovery Manager ).
Change-based recovery Recovers until the specified SCN.
Log sequence recovery Recovers until the specified log sequence number (only available when using Recovery Manager ).

Iii. Primary operating commands for Incomplete recovery of RMAN

A. Incomplete recovery based on the TIME Parameter
Run {
Shutdown immediate;
Startup mount;
Set until time "to_date ('2014 10:09:53 ', 'yyyymmdd hh24: mi: ss ')";
Restore database;
Recover database;
Alter database open resetlogs;
}

B. Incomplete Restoration Based on SCN Parameters
Run {
Shutdown immediate;
Startup mount;
Set until scn 3400;
Restore database;
Recover database;
Alter database open resetlogs;
}

C. Incomplete SEQUENCE-based recovery:
Run {
Shutdown immediate;
Startup mount;
Set until sequence 12903;
Restore database;
Recover database;
Alter database open resetlogs;
}

Iv. Demonstration of Incomplete recovery of RMAN

1. Prepare the environment
---> Back up the database first
[Oracle @ node1 ~] $ Export ORACLE_SID = oradb
[Oracle @ node1 ~] $ More rman_full.rcv
Run {
Allocate channel specified device type disk;
Allocate channel ch2 device type disk;
Crosscheck archivelog all;
Delete noprompt expired archivelog all;
Backup database format'/u02/rman/full _ % d _ % U' tag = full_bak
Plus archivelog format'/u02/rman/arch _ % d _ % U' tag = arch;
Release channel identifier;
Release channel ch2;
}
[Oracle @ node1 ~] $ Rman target/destination file =/home/oracle/rman_full.rcv log =/home/oracle/rman_full.log
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11>
-- The following is the generated backup file.
[Oracle @ node1 ~] $ Ls-hltr/u02/rman
Total 1.1 GB
-Rw-r ----- 1 oracle asmadmin 31 M Jul 5 09:44 arch_ORADB_03odvgv2_1_1
-Rw-r ----- 1 oracle asmadmin 595 M Jul 5 09:45 full_ORADB_04odvgv7_1_1
-Rw-r ----- 1 oracle asmadmin 490 M Jul 5 09:45 full_ORADB_05odvgv7_1_1
-Rw-r ----- 1 oracle asmadmin 12 K Jul 5 09:46 arch_ORADB_06odvh30_1_1

-- Demo Environment
SQL> select * from v $ version where rownum <2;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production

SQL> conn scott/tiger;
Connected.

--> The following query shows the generated archived logs.
SQL> SELECT name, sequence # seq #, status, completion_time FROM v $ archived_log;

Name seq # S COMPLETION_TIME
--------------------------------------------------------------------------------
/U02/DB/oradb/arch/2013_07_05/o1_mf_000026_8xd97058 _. arc 26 A 20130705 09:44:01
/U02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0 _. arc 27 A 20130705 09:46:08
/U02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht _. arc 28 A 20130705 10:03:36

--> Create a test table and insert records
10:07:01 SQL> create table t2 (id varchar2 (10), dt varchar2 (20 ));

10:07:57 SQL> insert into t2 select 'robinson ', to_char (sysdate, 'yyyymmdd hh24: mi: ss') from dual;

10:08:15 SQL> commit;

10:08:18 SQL> alter system archive log current; --> archive the current log

--> The following query shows that a new archive log is generated. 29
10:08:28 SQL> SELECT name, sequence # seq #, status, completion_time FROM v $ archived_log where sequence #> = 28;

Name seq # S COMPLETION_TIME
----------------------------------------------------------------------------------
/U02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht _. arc 28 A 20130705 10:03:36
/U02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9 _. arc 29 A 20130705 10:08:23

--> Verify that the archived log contains the Robinson record
10:09:53 SQL> ho strings/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9 _. arc | grep "Robinson"
Robinson

---> Second insert record
10:10:48 SQL> insert into t2 select 'Jackson ', to_char (sysdate, 'yyyymmdd hh24: mi: ss') from dual;

10:11:27 SQL> commit;

10:11:30 SQL> alter system archive log current;

10:11:47 SQL> SELECT name, sequence # seq #, status, completion_time FROM v $ archived_log where sequence #> = 28;

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.