Oracle12c RAC RMAN异机恢复

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

#编辑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‘;

原文地址:https://www.cnblogs.com/sonnyBag/p/12002521.html

时间: 2024-10-13 07:02:48

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

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

Oracle 官网有关单实例迁移到RAC的一个步骤说明: How to Convert 10g Single-Instance database to 10g RAC using Manual Conversion procedure [ID 747457.1] http://blog.csdn.net/tianlesoftware/archive/2010/12/09/6065903.aspx   RMAN 备份异机恢复 并创建新DBID http://blog.csdn.net/tianle

rman异机恢复

rman异机恢复 注意事项: 1.源数据库与目标数据库的目录结构相同 2.目标数据库只需要安装ORACLE软件(但是参数文件中指定的目录要创建) 3.要将源数据库的数据文件,参数文件,控制文件,密码文件,归档日志统统备份 1.源数据库备份 参数文件与控制文件自动备份 CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/r

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

一.RMAN异机恢复实验 2011年3月23日00:44 1.环境介绍: 主机1: 操作系统 REDHAT5.5 IP地址 172.16.1.120 主机名 sigle 数据库版本 10.2.0.4 数据库名 orcl DBID 1305151947 catalog win_yjr catalog用户 sigle/sigle 主机2: 操作系统 REDHAT5.5 IP地址 172.16.1.121 主机名 clone_sigle 数据库版本 10.2.0.4     2.本次恢复实验目的: 主

Linux平台下RMAN异机恢复总结

下面总结.整理一下RMAN异机恢复这方面的知识点,这篇笔记在个人笔记里面躺了几年了,直到最近偶然被翻看到,遂整理.总结一下.如下所示,个人将整个RMAN异机恢复分为准备工作和操作步骤两大部分.当然,准备工作里面,有些步骤不是必须的,可以跳过或忽略的.这个取决于你的实际环境和你对RMAN异机恢复的熟悉程度. 准备工作 1:了解一下目标服务器与源服务器的操作系统版本信息 需要对比一下目标服务器与源服务器的操作系统版本是否一致,具体来说,操作系统版本信息.内核信息(例如Oracle Linux是否使用

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

一.测试机安装OS+Oracle Software,包括配置oracle用户组和环境变量(略) 二.开始异机恢复 1. 复制源库最新备份集.初始化参数.密码文件到测试机 [[email protected] backupsets]$ scp *20141012* 192.168.1.213:/tmp The authenticity of host '192.168.1.213 (192.168.1.213)' can't be established. RSA key fingerprint

oracle rman异机恢复

  Oracle源主机 Oracle目标主机 主机平台 CentOS6.2(final) CentOs6.2(FInal) 主机名 vick rman IP地址 192.168.1.11 192.168.1.10 实例名字 orcl orcl Oracle版本 11.2.0.4 11.2.0.4 Oracle数据文件存储 filesystem filesystem 控制文件路径 /u01/app/oracle/oradata /u01/app/oracle/oradata 数据文件路径 /u01

如何使用 RMAN 异机恢复部分表空间

在oracle 数据库的日常维护和使用期间难免会遇到误删数据(drop,delete, truncate)当我们使用常规手段(flashback query ,flashback drop)也无法恢复数据时,我们可以使用最近的逻辑备份,在异机使用dmp 来恢复相应的表,但是如果没有这些逻辑备份,但是有一个最近的rman 全备,那么我们就可以利用这个备份来恢复被误删的表空间,从而实现数据的恢复,这里我以NBU 的备份环境为例简单描述下如何来回复部分 表空间: -------在nomount 状态

RMAN异机恢复到不同的路劲下

1.全库备份,scp到异机目录下  查询源库的DBID:   SQL> select dbid,name from v$database; DBID NAME ---------- ---------  439840715 YIJI SQL>    异机建立dump目录.oradata下建立SID名对应目录  2.恢复spfile,启动到nomount:       export ORACLE_SID=yiji    rman target /    set dbid=439840715   

NBU7.0 RMAN 异机恢复 not found in NetBackup catalog

问题描述: RMAN>  run { 2>  allocate channel t1 type 'sbt_tape'; 3>  send 'NB_ORA_SERV=netbackup,NB_ORA_CLIENT=hz1'; 4>  restore controlfile to '/oracle11/oradata/control01.ctl' from '/c-3201563006-20141026-02'; 5>  release channel t1 ; 6>  }