删除测试表test1
SQL> select to_char(sysdate,'dd-mm-yy hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'
-----------------
22-09-11 08:32:38
SQL> select * from test1;
PK COL1 COL2
---------- ---------- ----------
1 1 1
2 1 1
3 1 1
4 21 1
5 22 102
9 5 5
34 5 90
7 rows selected.
SQL> drop table test1 purge;
Table dropped.
SQL> desc test1;
ERROR:
ORA-04043: object test1 does not exist
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1289700 bytes
Variable Size 176161308 bytes
Database Buffers 20971520 bytes
Redo Buffers 7098368 bytes
Database mounted.
用昨天的备份恢复数据库至删除表test1之前
D:\>set nls_lang=american_america.zhs16gbk
D:\>rman target sys/system@orcl catalog rman/rman@rmancat
Recovery Manager: Release 10.2.0.3.0 - Production on Thu Sep 22 09:24:21 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1286153759, not open)
connected to recovery catalog database
RMAN> run{
2> set until time "to_date('11/09/22 08:00:00','yy/mm/dd hh24:mi:ss')";
3> restore database;
4> recover database;
5> }
executing command: SET until clause
Starting restore at 22-SEP-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoring datafile 00002 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoring datafile 00003 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoring datafile 00004 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
restoring datafile 00005 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
channel ORA_DISK_1: reading from backup piece D:\ORACLE\PRODUCT\10.2.0\FLASH_REC
OVERY_AREA\ORCL\BACKUPSET\2011_09_20\O1_MF_NNNDF_TAG20110920T172002_77JPP3CT_.BK
P
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2011_09
_20\O1_MF_NNNDF_TAG20110920T172002_77JPP3CT_.BKP tag=TAG20110920T172002
channel ORA_DISK_1: restore complete, elapsed time: 00:00:40
Finished restore at 22-SEP-11
Starting recover at 22-SEP-11
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:13
Finished recover at 22-SEP-11
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
SQL> select * from hr.test1;
PK COL1 COL2
---------- ---------- ----------
1 1 1
2 1 1
3 1 1
4 21 1
5 22 102
9 5 5
34 5 90
7 rows selected.
表test1成功恢复。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/36590/viewspace-708065/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/36590/viewspace-708065/