基于时间点的恢复

做实验前做过全备。

SQL> insert into ttest values(4);
 
1 row created.
 
SQL> insert into ttest values(3);
 
1 row created.
 
SQL> commit;
 
Commit complete.
 
SQL> alter system switch logfile;
 
System altered.
 
SQL> insert into ttest values(2);
 
1 row created.
 
SQL> insert into ttest values(1);
 
1 row created.
 
SQL> commit;
 
Commit complete.
 
SQL> alter system switch logfile;
 
System altered.
 
SQL> commit;
 
Commit complete.
 
SQL> alter system switch logfile;
System altered.
 
SQL> alter system switch logfile;
 
System altered.
 
SQL> host date
Wed Aug 29 21:56:08 CST 2012
 
SQL> truncate table ttest;
 
Table truncated.
 
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
 
Total System Global Area 1241513984 bytes
Fixed Size                   1219136 bytes
Variable Size              318768576 bytes
Database Buffers           905969664 bytes
Redo Buffers                15556608 bytes
Database mounted.
 
SQL> ho cp -f /home/oracle/backup/* /opt/app/oracle/oradata/orcl/ ;
 
SQL> select file#,to_char(time,'yyyy-mm-dd hh24:mi:ss') from v$recover_file; ----备份时间
 
     FILE# TO_CHAR(TIME,'YYYY-
---------- -------------------
         1 2012-08-29 21:39:37
         2 2012-08-29 21:39:37
         3 2012-08-29 21:39:37
         4 2012-08-29 21:39:37
         5 2012-08-29 21:39:37
         6 2012-08-29 21:39:37
 
6 rows selected.
 
SQL> recover database until time '2012-08-29 21:56:08';
ORA-00279: change 1177160 generated at 08/29/2012 21:39:37 needed for thread 1
ORA-00289: suggestion :
/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_3_%u_.arc
ORA-00280: change 1177160 for thread 1 is in sequence #3
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 1178006 generated at 08/29/2012 21:42:36 needed for thread 1
ORA-00289: suggestion :
/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_4_%u_.arc
ORA-00280: change 1178006 for thread 1 is in sequence #4
ORA-00278: log file
'/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_3_83w72d
7q_.arc' no longer needed for this recovery
 
 
ORA-00279: change 1178013 generated at 08/29/2012 21:42:52 needed for thread 1
ORA-00289: suggestion :
/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_5_%u_.arc
ORA-00280: change 1178013 for thread 1 is in sequence #5
ORA-00278: log file
'/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_4_83w72w
29_.arc' no longer needed for this recovery
 
 
ORA-00279: change 1178040 generated at 08/29/2012 21:54:05 needed for thread 1
ORA-00289: suggestion :
/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_1_%u_.arc
ORA-00280: change 1178040 for thread 1 is in sequence #1
ORA-00278: log file
'/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_5_83w7qx
k7_.arc' no longer needed for this recovery
 
 
ORA-00279: change 1178243 generated at 08/29/2012 21:55:06 needed for thread 1
ORA-00289: suggestion :
/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_2_%u_.arc
ORA-00280: change 1178243 for thread 1 is in sequence #2
ORA-00278: log file
'/opt/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_29/o1_mf_1_1_83w7st
oq_.arc' no longer needed for this recovery
 
 
Log applied.
Media recovery complete.
 
SQL> alter database open resetlogs;
 
Database altered.
 
SQL> select * from ttest;
 
        ID
----------
         4
         3
         2
         1
 
SQL>

你可能感兴趣的:(基于时间点的恢复)