Incomplete recovery based on log sequence using rman
sql> select * from test;a-----123456sql>hostramn target/
rman>run{allocate channel c1 type disk;bakup full tag 'dbful' format 'd:\backup\full_%u_%s_%p' databaseinclude current controlfile;sql' alter system archive log current';release channel c1;}rman>exit;sql>insert into test values(16); sql>commit;sql>alter system switch logfile;sql>insert into test values(17);sql>alter system switch logfile;
sql>archive log list;....oldest onlie log sequence 14next log sequence to archive 16current log sequence 16
sql>select group#,sequence#,archived,status from v$loggroup# sequence# archived status-----------------------------------1 16 yes active2 17 no current3 15 yes active
From this we can see that the backup data file contains 14th archive logs. In the online log v $ log, 17 Series logs are being used, and 15 and 16 logs have been archived.
When we do not back up 15 and 16 logs. 15 and 16 contain the table test new data 16 and 17.
Incomplete recovery means that only the log data under the archive log is restored. The instance cannot be recovered, that is, the online log is regarded as missing!
Data in online log 17 cannot be recovered, and logs 15 and 16 have been archived. If no backup is made, logs 15 and 16 can be recovered.
sql> shutdown immediate;sql>startup nomount;sql>alter database monut;sql>hostrman target/rman> run{allocate channel c1 type disk;set until logseq 14 thread 1;restore database;recover database;sql'alter database open resetlogs';}
Time-based Incomplete recovery using rman
sql> insert into test values(100);commit;sql> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';sql> select sysdate from dual;sysdate----------2012-06-15 10:36:14sql> hostrman target /rman>run{allocate channel c1 type disk;bakup full tag 'dbful' format 'd:\backup\full_%u_%s_%p' databaseinclude current controlfile;sql' alter system archive log current';release channel c1;}rman> exitsql> insert into test values(150);sql>commit;sql> select sysdate from dual;sysdate----------2012-06-15 10:46:14sql>alter system switch logfile;sql> insert into test values(250);sql> commit;sql> select sysdate from dual;sysdate----------2012-06-15 10:50:14
sql> shutdown immediate;sql> startup mount;sql> exit;set nls_date_format=yyyy-mm-dd hh24:mi:ssrman target/rman>run{allocate channel c1 type disk;set until time '2012-06-15 10:46:14';restore database;recover database;sql 'alter database open resetlogs';release channel c1;}
-- Recover database until time '2017-04-10 10:36:14 '; you do not need to set until
-- Set until time "to_date ('2014: 00: 00', 'yyyymmdd hh24: mi: ss')" You do not need to set the time format for the operating system.
Incomplete Restoration Based on scn using rman
sqlplus "/as sysda"sql>select dbms_flashback.get_system_change_number from dual;xxxxx345sql>insert into test values(400);sql>commit;sql>select dbms_flashback.get_system_change_number from dual;xxxxx356;sql> host;rman target/rman>run{allocate channel c1 type disk;bakup full tag 'dbful' format 'd:\backup\full_%u_%s_%p' databaseinclude current controlfile;sql' alter system archive log current';release channel c1;}rman>exit;sql>insert into test values(450);sql>commit;sql>select dbms_flashback.get_system_change_number from dual;xxxxx368sql>shutdown immediate;sql>startup mount;sql>exit;rman target/rman> run{allocate channel c1 type disk;restore database;recover database until scn xxxx356;sql 'alter database open resetlogs';release channel c1;}