基于时间不完全恢复之rman篇(六)
但删除用户与表能找回来
SQL> startup mount;
ORACLE instance started.
Total System Global Area 517763072 bytes
Fixed Size 2214896 bytes
Variable Size 394265616 bytes
Database Buffers 117440512 bytes
Redo Buffers 3842048 bytes
Database mounted.
SQL> restore database; --注意这是SQLPLUS下面的环境,回到RMAN命令行操作
SP2-0734: unknown command beginning "restore da..." - rest of line ignored.
SQL> alert session nls_date_format='yyyy-mm-dd hh24:mi:ss';
SP2-0734: unknown command beginning "alert sess..." - rest of line ignored.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@node1 2013_07_31]$ export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
[oracle@node1 2013_07_31]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jul 31 23:01:09 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: MDNSS (DBID=3864238845, not open)
--为了安全不会出差错,第二次进行设置时间格式
RMAN> sql 'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"';
sql statement: alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"
RMAN> restore database;
Starting restore at 2013-07-31 23:02:48
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/mdnss/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/mdnss/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/mdnss/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/mdnss/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/mdnss/jf_data01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/mdnss/jf_data02.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/mdnss/t2a.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/MDNSS/backupset/2013_07_31/o1_mf_nnndf_TAG20130731T223917_8zl8dpg6_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/MDNSS/backupset/2013_07_31/o1_mf_nnndf_TAG20130731T223917_8zl8dpg6_.bkp tag=TAG20130731T223917
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 2013-07-31 23:04:15
--一定理解时间点的概念,因为上面2013-07-31 22:36:51是我建立二个用户,以及在u1建立一张表后的动作,由于不太熟练,所以
--时间老以为可以恢复到记录这个时间之前是不对的,因为备份完全后起码在十分种左右,这一次是一致性关闭数据库,所以在这个时间上加十分钟就刚好了
RMAN> recover database until time '2013-07-31 22:36:51';
Starting recover at 2013-07-31 23:05:31
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/31/2013 23:05:32
RMAN-06555: datafile 1