########################################################

#编辑pfile文件initspdb.ora

vi /oracle/app/oracle/product/12.2.0/db_1/dbs/initspdb.ora

audit_file_dest='/oracle/app/oracle/admin/spdb/adump'
audit_trail='db'
compatible='12.2.0'
control_files='/oracle/app/oracle/oradata/spdb/control.ctl'
db_block_size=8192
db_name='spdb'
diagnostic_dest='/oracle/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=spdbXDB)'
enable_pluggable_database=true
log_archive_dest_1='LOCATION=/orabak/archivelog'
open_cursors=300
pga_aggregate_target=5120m
processes=400
remote_login_passwordfile='exclusive'
sga_target=10240m
undo_tablespace='UNDOTBS1'
db_file_name_convert='+DATADG/SPDB/DATAFILE','/oracle/app/oracle/oradata/spdb/','+DATADG/SPDB/8E80F930196B6100E053E200A8C0AF9F/DATAFILE','/oracle/app/oracle/oradata/spdb/pdbseed/','+DATADG/SPDB/8E81C7A967C43CB7E053E300A8C06223/DATAFILE','/oracle/app/oracle/oradata/spdb/spdb1pdb/','+DATADG/SPDB/93BFEF75138BC79EE053E300A8C08BA1/DATAFILE','/oracle/app/oracle/oradata/spdb/kdlxpdb

#创建目录

mkdir -p /oracle/app/oracle/admin/spdb/adump

mkdir -p /orabak/archivelog

########################################################

#创建spfile

SQL> create spfile from pfile='/oracle/app/oracle/product/12.2.0/db_1/dbs/initspdb.ora'

#进到nomount状态

SQL> startup nomount

--#恢复spfile文件

--RMAN> restore spfile from '/orabak/spfile_ORCL_1026474723_1096_1';

SQL> shutdown abort

cd /oracle/app/oracle/product/12.2.0/db_1/dbs/

rm initspdb.ora

$strings spfilespdb.ora

SQL> startup nomount

########################################################

#恢复control文件

RMAN> restore controlfile from '/orabak/control_ORCL_1026474721_1095_1';

#进到mount状态

SQL> alter database mount;

#删除backup

RMAN> list backup;

RMAN> crosscheck backup;

RMAN> delete backup;

RMAN> list backup;

########################################################

#恢复dbfile全备文件

RMAN> catalog start with '/orabak/backup/';

RMAN> list backup;

rman target /
run{
allocate channel ch1 type disk;
allocate channel ch2 type disk;
set newname for datafile 1 to '/oracle/app/oracle/oradata/spdb/system.dbf';
set newname for datafile 3 to '/oracle/app/oracle/oradata/spdb/sysaux.dbf';
set newname for datafile 5 to '/oracle/app/oracle/oradata/spdb/undotbs1.dbf';
set newname for datafile 7 to '/oracle/app/oracle/oradata/spdb/undotbs2.dbf';
set newname for datafile 8 to '/oracle/app/oracle/oradata/spdb/users.dbf';
set newname for datafile 2 to '/oracle/app/oracle/oradata/spdb/pdbseed/system.dbf';
set newname for datafile 4 to '/oracle/app/oracle/oradata/spdb/pdbseed/sysaux.dbf';
set newname for datafile 6 to '/oracle/app/oracle/oradata/spdb/pdbseed/undotbs1.dbf';
set newname for datafile 9 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/system.dbf';
set newname for datafile 10 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/sysaux.dbf';
set newname for datafile 11 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/undotbs1.dbf';
set newname for datafile 12 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/undo_2.dbf';
set newname for datafile 13 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/users.dbf';
set newname for datafile 14 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/spdata1.dbf';
set newname for datafile 15 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/spdata2.dbf';
set newname for datafile 16 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/managedata1.dbf';
set newname for datafile 18 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/managedata2.dbf';
set newname for datafile 17 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/clouddata1.dbf';
set newname for datafile 19 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/clouddata2.dbf';
set newname for datafile 20 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/cloudtestdata1.dbf';
set newname for datafile 21 to '/oracle/app/oracle/oradata/spdb/spdb1pdb/cloudtestdata2.dbf';
set newname for datafile 28 to '/oracle/app/oracle/oradata/spdb/kdlxpdb/system.dbf';
set newname for datafile 29 to '/oracle/app/oracle/oradata/spdb/kdlxpdb/sysaux.dbf';
set newname for datafile 30 to '/oracle/app/oracle/oradata/spdb/kdlxpdb/undotbs1.dbf';
restore database;
switch datafile all;
switch tempfile all;
release channel ch1;
release channel ch2;
}

RMAN> recover database;

#recover报错,需要指定SCN

RMAN> recover database until scn 233086903;      #全量备份的SCN

#将归档日志及增量备份数据文件拷贝至/orabak/backup/目录并追加

RMAN> catalog start with '/orabak/backup/';

RMAN> list backup;

#找到对应增量备份节点的SCN进行恢复,建议根据备份策略依次恢复(优先读取增量文件其次归档日志)。

RMAN> recover database until scn 234809384;      #归档日志恢复第一天增量

RMAN> recover database until scn 237672420;    #增量文件及归档日志恢复第二天增量

#第二天增量恢复完成,接着恢复第三天增量报错。备份期间生成过数据文件,可通过恢复单独数据文件恢复,因隔天忘记恢复第三天增量数据。

RMAN> recover database until scn 241710899;      #第三天增量恢复

RMAN> restore datafile 31;

########################################################

#数据库open

SQL> alter database open;

SQL> alter database open resetlogs;

#ASM磁盘和集群报错,需要调整控制文件

SQL> alter database backup controlfile to trace as '/home/oracle/ctl.control';

SQL> shutdown abort;

vi /home/oracle/ctl.control

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "SPDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 584
LOGFILE
GROUP 1 '/oracle/app/oracle/oradata/spdb/redo1.log' SIZE 200M BLOCKSIZE 512,
GROUP 2 '/oracle/app/oracle/oradata/spdb/redo2.log' SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/oracle/app/oracle/oradata/spdb/system.dbf',
'/oracle/app/oracle/oradata/spdb/pdbseed/system.dbf',
'/oracle/app/oracle/oradata/spdb/sysaux.dbf',
'/oracle/app/oracle/oradata/spdb/pdbseed/sysaux.dbf',
'/oracle/app/oracle/oradata/spdb/undotbs1.dbf',
'/oracle/app/oracle/oradata/spdb/pdbseed/undotbs1.dbf',
'/oracle/app/oracle/oradata/spdb/undotbs2.dbf',
'/oracle/app/oracle/oradata/spdb/users.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/system.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/sysaux.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/undotbs1.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/undo_2.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/users.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/spdata1.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/spdata2.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/managedata1.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/clouddata1.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/managedata2.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/clouddata2.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/cloudtestdata1.dbf',
'/oracle/app/oracle/oradata/spdb/spdb1pdb/cloudtestdata2.dbf',
'/oracle/app/oracle/oradata/spdb/kdlxpdb/system.dbf',
'/oracle/app/oracle/oradata/spdb/kdlxpdb/sysaux.dbf',
'/oracle/app/oracle/oradata/spdb/kdlxpdb/undotbs1.dbf'
CHARACTER SET AL32UTF8
;
--RECOVER DATABASE --All logs need archiving and a log switch is needed.
--ALTER SYSTEM ARCHIVE LOG ALL; -- Database can now be opened normally.
--ALTER DATABASE OPEN; -- Open all the PDBs.
--ALTER PLUGGABLE DATABASE ALL OPEN;

#编辑控制文件,重新生成控制文件

SQL> @/home/oracle/ctl.control

SQL> alter database open RESETLOGS;

#生成thread 2 redo日志文件

SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 3 '/oracle/app/oracle/oradata/spdb/redo03.log' SIZE 50M,GROUP 4 '/oracle/app/oracle/oradata/spdb/redo04.log' SIZE 50M;

SQL> alter database open RESETLOGS;

SQL> alter database open;

SQL> alter pluggable database all open;

至此RAC的RMAN异机恢复就完成了。恢复过程中遇到问题就针对解决吧,Good Luck!!!

########################################################

注常用命令:

RMAN> list backup;

RMAN> crosscheck backupset;

RMAN> delete backupset;

RMAN> delete backup;

RMAN> restore database;

RMAN> restore datafile 31;

RMAN> recover database until SCN XXX;

RMAN> list archivelog all;

RMAN> list copy;

RMAN> catalog start with '/orabak/backup';

Oracle12c RAC RMAN异机恢复的更多相关文章

  1. Oracle 单实例 迁移到 RAC 实例 -- 使用RMAN 异机恢复

    Oracle 官网有关单实例迁移到RAC的一个步骤说明: How to Convert 10g Single-Instance database to 10g RAC using Manual Con ...

  2. Linux平台下RMAN异机恢复总结

    下面总结.整理一下RMAN异机恢复这方面的知识点,这篇笔记在个人笔记里面躺了几年了,直到最近偶然被翻看到,遂整理.总结一下.如下所示,个人将整个RMAN异机恢复分为准备工作和操作步骤两大部分.当然,准 ...

  3. RMAN异机恢复实验---转载

    一.RMAN异机恢复实验 2011年3月23日00:44 1.环境介绍: 主机1: 操作系统 REDHAT5.5 IP地址 172.16.1.120 主机名 sigle 数据库版本 10.2.0.4 ...

  4. NBU Rman异机恢复Oracle

    前段时间一个亿级分区表,被分割成历史表和业务表,历史表中保留15天以外的数据,每天都会从业务表中的15天外的数据copy到历史表,并删除业务表15天外的数据,逻辑也很简单,但插入历史表的where 条 ...

  5. RMAN异机恢复遭遇ORA-01547、ORA-01152、ORA-01110错误案例

    测试环境:     操作系统  :  Red Hat Enterprise Linux ES release 4 (Nahant Update 4)   VMWARE     数据库     :  O ...

  6. oracle rman异机恢复

      Oracle源主机 Oracle目标主机 主机平台 CentOS6.2(final) CentOs6.2(FInal) 主机名 vick rman IP地址 192.168.1.11 192.16 ...

  7. rman异机恢复,全部恢复和增量恢复

    1.首先准备工作:hostname 192.168.222.11 ol7.localdomain ol7建立相关目录:mkdir -p /u01/app/oracle/oradata/DB11G/mk ...

  8. RMAN异机恢复步骤及故障处理

    一.測试机安装OS+Oracle Software.包含配置oracle用户.组和环境变量(略) 二.開始异机恢复 1. 复制源库最新备份集.初始化參数.password文件到測试机 [oracle@ ...

  9. Oracle RMAN 异机恢复一例

    背景介绍:本例需求是将NBU备份的oracle数据库恢复到另一主机上. NBU环境配置.异机上的Oracle软件安装配置忽略,下面只介绍OracleDB恢复的过程. ----------------- ...

随机推荐

  1. 3D聚类

    1 3D聚类和普通的二维聚类实质一样,只不过维数太高了,用三维图来表示了. 下面将官网的改成只生成一个图了 #!/usr/bin/python # -*- coding:utf-8 -*- print ...

  2. HTTP学习记录:一、协议基础

    学习资源主要为:@小坦克HTTP相关博客 1.HTTP简介: HTTP协议是Hyper Text Transfer Portocol(超文本传输协议)的缩写,它是一种通信协议,允许将超文本(即:htm ...

  3. nslookup的安装方法

    1.直接使用yum安装,没有找到:yum install nslookup 2.yum provides nslookup查询nslookup在哪个套件里面 3.根据上面的提示,在"*/ns ...

  4. 各种开源许可 license 区别

    copy from http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html

  5. ansible-playbook -l 选项

    -l <SUBSET>, --limit <SUBSET> further limit selected hosts to an additional pattern 限制脚本 ...

  6. base64 换表 解密脚本

    做逆向经常遇到换表的base64 有了py脚本 一切都好说: import base64 import string str1 = "x2dtJEOmyjacxDemx2eczT5cVS9f ...

  7. [BZOJ 3771] Triple(FFT+容斥原理+生成函数)

    [BZOJ 3771] Triple(FFT+生成函数) 题面 给出 n个物品,价值为别为\(w_i\)且各不相同,现在可以取1个.2个或3个,问每种价值和有几种情况? 分析 这种计数问题容易想到生成 ...

  8. Redis哨兵功能与集群搭建

    6.redis哨兵功能 Redis-Sentinel Redis-Sentinel是redis官方推荐的高可用性解决方案,当用redis作master-slave的高可用时,如果master本身宕机, ...

  9. 在centos6.4下安装python3.5

    1.安装依赖包 ./configure --prefix=/usr/local/python3.5 --enable-shared make && make install yum g ...

  10. Scrapy 教程(五)-分页策略

    scrapy 爬取分页网站的策略 1. 检测当前页是否存在“下一页” 2. 如果存在,把“下一页”的链接交给本方法或者其他方法 3. 如果不存在,结束 图示 示例代码 def parse(self, ...