先备份一个控制文件
RMAN> backup current controlfile tag=‘bak_ctlfile‘ format=‘/home/oracle/backup/bak_ctl_%U_%T‘;
drop一个表空间
SQL> drop tablespace xds including contents and datafiles;
Tablespace dropped.
删除控制文件
rm /u01/app/oracle/oradata/orcl/control01.ctl
rm /u01/app/oracle/flash_recovery_area/orcl/control02.ctl
shutdown abort
采用rman恢复时报错
MAN> startup nomount;
Oracle instance started
Total System Global Area 835104768 bytes
Fixed Size 2217952 bytes
Variable Size 520095776 bytes
Database Buffers 310378496 bytes
Redo Buffers 2412544 bytes
RMAN> restore controlfile from ‘/home/oracle/backup/bak_ctl_0qr8l6u3_1_1_20160620‘;
Starting restore at 20-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 20-JUN-16
RMAN> mount database;
database mounted
released channel: ORA_DISK_1
RMAN> recover database;
Starting recover at 20-JUN-16
Starting implicit crosscheck backup at 20-JUN-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 13 objects
Finished implicit crosscheck backup at 20-JUN-16
Starting implicit crosscheck copy at 20-JUN-16
using channel ORA_DISK_1
Finished implicit crosscheck copy at 20-JUN-16
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/20/2016 21:53:14
RMAN-06094: datafile 7 must be restored
SQL> alter database datafile 7 offline;
Database altered.
SQL> recover database using backup controlfile;
ORA-00279: change 1106750 generated at 06/20/2016 21:31:26 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc
ORA-00280: change 1106750 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log
‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc‘
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
因为还没有生成archivelog,所以找不到
手工一个个指定redolog文件,直到恢复
SQL> recover database using backup controlfile;
ORA-00279: change 1106750 generated at 06/20/2016 21:31:26 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc
ORA-00280: change 1106750 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo03.log
Log applied.
Media recovery complete.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
/u01/app/oracle/oradata/orcl/test01.dbf
6 rows selected.
SQL> alter database open resetlogs;
Database altered.