数据库恢复

--若选用PROD1为catalog目录库
sqlplus sys/oracle@prod1 as sysdba
create user catalog identified by oracle;
grant connect,recovery_catalog_owner to catalog;
alter user catalog unlimited tablespace onusers;
rman catalog catalog/oracle@prod1
create catalog;

--a、先恢复spfile
vi initPROD2.ora
db_name=PROD2

sqlplus sys/oracle@prod2 as sysdba
startup nomount;

rman target sys/oracle@prod2 catalog catalog/oracle@prod1

RMAN> list backup of spfile;
RMAN>restore spfile from '/u01/app/oracle/FRA/PROD2/backupset/2016_11_19/o1_mf_nnsnf_TAG20161119T220145_d30ptbhz_.bkp';
RMAN> list backup of controlfile;
RMAN>restore controlfile from '/u01/app/oracle/FRA/PROD2/backupset/2016_11_19/o1_mf_ncnnf_TAG20161119T220114_d30psdfq_.bkp';

--可以在rman中执行 by zhuyj
alter database mount;

--恢复数据库,须先恢复controlfile后到mount状态
---或者用(list failure须controlfile存在,然后执行alter database open或alter database open然后执行list failure;)
--list failure;
--advise failure;
--然后执行生成的恢复脚本
restore database;
SQL>recover database using backup controlfile until cancel;
--先输入auto,执行完毕以后。
--再次执行:recover database using backup controlfile until cancel;
--当问你要联机日志文件的日志序列号的时候,输入 cancel

alter database open resetlogs;

posted @ 2019-03-16 23:30  virtual_daemon  阅读(149)  评论(0编辑  收藏  举报