4、创建密码文件

oracle@2go-devDB01uv:~> cd $ORACLE_HOME/dbs
oracle@2go-devDB01uv:~/OraHome10g/dbs> orapwd file=orapwSY5221 password=oracle force=y entries=10
# Author : Robinson
# Blog : http://blog.csdn.net/robinson_061

  5、使用pfile启动实例到nomount状态

oracle@2go-devDB01uv:~> cp /u02/database/SY5221_RMAN/20121013/initSY5221.ora $ORACLE_HOME/dbs
oracle@2go-devDB01uv:~> export ORACLE_SID=SY5221
oracle@2go-devDB01uv:~> sqlplus / as sysdba
SQL> startup nomount;

  6、恢复控制文件并切换到mount状态

#再开一个session
oracle@2go-devDB01uv:~> export ORACLE_SID=SY5221
oracle@2go-devDB01uv:~> $ORACLE_HOME/bin/rman target /
RMAN> restore controlfile from '/u02/database/SY5221_RMAN/20121013/SY5221_lev0_cntl.bak_c-1468911009-20121013-01';
RMAN> alter database mount;

  7、指定备份文件所在目录

RMAN> catalog start with '/u02/database/SY5221_RMAN/20121013'; #此命令用于扫描整个目录的备份片或者归档日志文件等

  8、还原数据库

RMAN> restore database;

  9、恢复数据库

RMAN> recover database;

unable to find archive log
archive log thread=1 sequence=143388
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/16/2012 11:32:54
RMAN-06054: media recovery requesting unknown log: thread 1 seq 143388 lowscn 608805162
#由于未复制联机日志文件,此时提示需要seqence 143388,scn 608805162

#在sqlplus提示符下继续介质恢复
SQL> conn / as sysdba
Connected.
idle> recover database until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 608805162 generated at 10/13/2012 06:31:44 needed for thread 1
ORA-00289: suggestion : /u02/database/SY5221/archive/arch_668881377_1_143388.arc
ORA-00280: change 608805162 for thread 1 is in sequence #143388

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel      #输入cancel,完成介质恢复
Media recovery cancelled.

  10、open 数据库

  #如果open 不成功,请尝试shutdown 之后再次open,如果仍然不成功使用隐藏参数_allow_resetlogs_corruption打开数据库

SQL> alter database open resetlogs;

Database altered.

  11、一致性关闭数据库并重启数据库

SQL> shutdown immediate;

SQL> startup