1) Loss of system DATAFILE
2) Loss of non-system DATAFILE
3) Loss of a DATAFILE without Backup
4) Loss of a CONTROLFILE
5) Loss of all the CONTROLFILE
6) Loss of REDOLOGs
7) Loss of CONTROLFILE, SPFILE, DATAFILEs and REDOLOGs
8) Loss of Tempfile
9) Block corruption of datafiles
1) Loss of system DATAFILE
rm -rf /u01/app/oracle/oradata/PROD1/system01.dbf
$rman target /
rman>validate database;
rman>shutdown abort
rman>startup mount
rman>restore datafile 1;
rman>recover datailfe 1;
rman>alter database open;
rman>validate database;
 
2) Loss of non-system DATAFILE
$rman target /
rman>validate database;
rman>list failure;
rman>advise failure;
rman>repair failure preview;
rman>repair failure;
rman>validate database;
 
3) Loss of a DATAFILE without Backup
$rman target /
rman>validate database;
rman>list failure;
rman>advise failure;
rman>repair failure preview;
rman>repair failure;
rman>validate database;
 
4) Loss of a CONTROLFILE
rm -rf /u01/app/oracle/oradata/PROD1/control01.ctl
sql>shutdown immediate
cp -r /u01/app/oracle/fast_recovery_area/PROD1/control02.ctl /u01/app/oracle/oradata/PROD1/control01.ctl 
sql>startup nomount
sql>alter system set control_files='/u01/app/oracle/oradata/PROD1/control01.ctl','/u01/app/oracle/fast_recovery_area/PROD1/control02.ctl' scope=spfile;
sql>startup force
sql>select name from v$instance;
 
5) Loss of all the CONTROLFILE

rm /u01/app/oracle/oradata/PROD1/control01.ctl

rm /u01/app/oracle/fast_recovery_area/PROD1/control02.ctl

alter system switch logfile;
shutdown abort
-- Run the following script from RMAN
sqlplus rman/rman@emrep
SQL> select * from rc_database; --获取该 DB 的 dbid(例如: 1583199105)
rman target / catalog rman/rman@emrep
RMAN> set dbid = 1583199105;
RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> sql 'alter database mount';
RMAN> restore database;
RMAN> recover database;
RMAN> sql 'alter database open resetlogs';
new incarnation of database registered in recovery catalog
RMAN> list incarnation;
 
6) Loss of REDOLOGs

shutdown immediate;

startup

sqlplus / as sysdba
startup mount;

-- Clear all the redo logfiles
alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 2;
alter database clear unarchived logfile gorup 3;
alter database open;

 
7) Loss of CONTROLFILE, SPFILE, DATAFILEs and REDOLOGs
shutdown abort
sqlplus rman/rman@emrep
select * from rc_database;
RMAN>SET DBID=*****
RMAN>STARTUP NOMOUNT
 
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=4G;
ALTER  SYSTEM  SET  DB_RECOVERY_FILE_DEST='/u01/app/oracle/fast_recovery_area'; 
 
RMAN>RESTORE SPFILE FROM AUTOBACKUP;
RMAN>SHUTDOWN IMMEDIATE
RMAN>STARTUP NOMOUNT
RMAN>RESTORE CONTROLFILE FROM AUTOBACKUP;
RMAN>ALTER DATABASE MOUNT;
 
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
select thread#, resetlogs_change#, archived, sequence#, completion_time from v$archived_log
where archived='YES' AND COMPLETION_TIME = (SELECT MAX(COMPLETION_TIME)
FROM V$ARCHIVED_LOG WHERE ARCHIVED='YES');
 

-- In RMAN, recovered until the last ARCHIVE LOG (n+1) and open with RESETLOGS

-- If the last created archived redo log has sequence n,

-- then specify UNTIL SEQUENCE n+1 so that RMAN applies n and then stops.

 
restore database until sequence 3 thread 1;
recover database until sequence 3 thread 1;
alter database open resetlogs;
 
8) Loss of Tempfile
sql>shutdown immediate
sql>startup
oracle 11g丢失临时表空间文件,重启后会自动创建临时表空间文件
 
9) Block corruption of datafiles
$rman target / catalog rman/rman@emrep
RMAN> list failure;
RMAN> advise failure;
RMAN> repair failure;
-- Check the result
RMAN> list failure all;

rman恢复实践的更多相关文章

  1. RMAN备份与恢复实践(转)

    1   RMAN备份与恢复实践 1.1  备份 1.1.1 对数据库进行全备 使用backup database命令执行备份 RMAN> BACKUP DATABASE; 执行上述命令后将对目标 ...

  2. 在rman恢复中incarnation的概念

    摘要 本文主要介绍incarnation的由来,在rman恢复中的作用,以及相关rman恢复的注意事项. 概念说明 从10g开始,incarnation被引入,用于跨越resetlogs进行恢复,由此 ...

  3. RAC+asm通过rman恢复到单实例+asm

    1.恢复参数文件,并修改参数文件 参数文件指名几个最简单的就行,我的参数文件如下: 2.恢复控制文件,并启动数据库到mount 如果是把备份集从别的服务器拷贝到本地恢复的服务器的目录,使用下面的语句指 ...

  4. oracle rman恢复数据库 方式恢复到异地数据库

    目的:从某个环境中,获取相关文件,放到异地机器使用rman 恢复.   情况说明:XX系统使用的是oracle数据库,现已从服务器拉下来相关文件,依靠这些文件来早本地的测试机上恢复数据库,方便进行数据 ...

  5. Oracle RMAN 恢复控制文件到指定的路径

    Oracle 数据库通过RMAN恢复控制文件到指定的路径 --------------------------------------------------------- 先查询备份集信息,再指定备 ...

  6. RMAN恢复目录

    是否使用RMAN恢复目录(Recovery Catalog 你可能从其他人或书上听过RMAN恢复目录(也有可能是其他名字,RMAN Recovery Catalog的翻译较多较杂,以下简称恢复目录), ...

  7. rman恢复误删除的一张表(不完全恢复)

    恢复误删除的一张表可以使用很多方法,如日志挖掘.闪回等,rman恢复(不完全恢复)肯定不是最好的,也不建议用, 现在我们只是演示一下这种恢复. 1 RMAN备份数据库 2创建测试表 3查看此时的SCN ...

  8. RAC 之 RMAN 恢复

    RAC 下的RMAN 讲究的是备份和还原的策略要一致.备份策略的不同,会导致备份结果的分步不同,进而影响恢复的策略和步骤.一般情况下,恢复策略和备份策略必须是对应的.如果备份策略进行了修改,那么恢复也 ...

  9. RAC之RMAN恢复

    之前整理的RMAN 有关还原的文章: RMAN 系列(五) ---- RMAN 还原 与 恢复 http://blog.csdn.net/tianlesoftware/archive/2010/07/ ...

随机推荐

  1. spring boot和spring cloud版本选择

    SpringBoot版本介绍 官网链接:https://spring.io/projects/spring-boot#learn Spring Boot的版本以数字表示.例如:Spring Boot ...

  2. Java编发编程 - 线程池的认识(一)

    每逢面试都会询问道线程池的概念和使用,但是工作中真正的又有多少场景使用呢?相信大家都会有这样的疑问:面试选拔造汽车,实际进公司就是拧螺丝!但是真正要把这颗螺丝拧紧,拧牢,没有这些最底层的知识做铺垫你可 ...

  3. FairyGUI编辑器的和unity里的Obj对应关系

    1.在FairyGUI官网上下载好unity的工程,用FairyGUI编辑器打开它的官方案例 2.在FairyGUI编辑器和Unity中,从一个最简单的示例"Bag"着手.     ...

  4. curl 超时问题解决

    curl -o /dev/null -s -w %{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total} ...

  5. Nmap详解

    扫描方式 -Pn/-P0:扫描前不用ping测试目标是否可达,默认所有目标端口都可达 -sT:TCP Connect扫描,进行完整的TCP三次握手,该类型扫描已被检测,且会在目标日志中记录大量连接请求 ...

  6. div定时放大缩小

    <!DOCTYPE html> <html> <head> <style> .anim{ width: 100px; height: 100px; ba ...

  7. Python:安装Bio库不成功,出现ModuleNotFoundError: No module named 'Bio'

    Bio库的安装并不是pip install bio,而是biopython. ./anaconda3/bin/pip3 install biopython -i https://pypi.douban ...

  8. NO.A.0010——Windows常用快捷键使用教程

    小娜操作: Win + C: 打开Cortana微软小娜,并开始聆听...... Win + Q: 打开Cortana: Win + S: 打开Cortana:sdfghjkrtgyh XBOX操作: ...

  9. LIS问题$n log_2 n$做法(二分优化)

    #include<bits/stdc++.h> using namespace std; const int inf=1e9+5; const int maxn=1e6+5; int n, ...

  10. 【mq读书笔记】mq事务消息

    关于mq食物以什么样的方式解决了什么样的问题可以参考这里: https://www.jianshu.com/p/cc5c10221aa1 上文中示例基于mq版本较低较新的版本中TransactionL ...