oracle 12C RAC 迁移到单机

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:2138

本帖最后由 lihfe 于 2020-5-9 19:06 编辑

环境说明:
RAC、单机:
操作系统:Redhat Linux6.5
数据库:Oracle 12.1.0.2

操作步骤:
1、对RAC环境进行备份(每周日0级备份,周一到周六累计增量备份),1级备份脚本:
0级备份脚本:
#!/bin/bash
# incremental level 0 backup script
source /home/oracle/.bash_profile
current_day=`date +%Y%m%d`
mkdir /nfsbackup/oracle12c/arch/$current_day
rman target / < startup nomount;
2)、恢复控制文件
RMAN> restore controlfile from '/nfsbackup/oracle12c/arch/incr20200509/PID-c-864600122-20200509-01';
3)、把库启动到mount状态
RMAN> alter database mount;
4)、修改数据文件的路径,并进行restore数据文件
RUN {
SET NEWNAME FOR DATAFILE 1 to '/u01/oracle/oradata/system1.dbf';
SET NEWNAME FOR DATAFILE 2 to '/u01/oracle/oradata/system2.dbf';
SET NEWNAME FOR DATAFILE 3 to '/u01/oracle/oradata/sysaux.dbf';
SET NEWNAME FOR DATAFILE 4 to '/u01/oracle/oradata/sysaux4.dbf';
SET NEWNAME FOR DATAFILE 5 to '/u01/oracle/oradata/ud5.dbf';
SET NEWNAME FOR DATAFILE 6 to '/u01/oracle/oradata/ud2.dbf';
SET NEWNAME FOR DATAFILE 7 to '/u01/oracle/oradata/u72.dbf';
SET NEWNAME FOR DATAFILE 10 to '/u01/oracle/oradata/user_dzzz_licensetest.dbf';
SET NEWNAME FOR DATAFILE 11 to '/u01/oracle/oradata/user_dzzz_platform.dbf';
SET NEWNAME FOR DATAFILE 12 to '/u01/oracle/oradata/users12.dbf';
SET NEWNAME FOR DATAFILE 13 to '/u01/oracle/oradata/zxappmgr.dbf';
SET NEWNAME FOR DATAFILE 14 to '/u01/oracle/oradata/nswork.dbf';
SET NEWNAME FOR DATAFILE 15 to '/u01/oracle/oradata/gtsb.dbf';
SET NEWNAME FOR DATAFILE 16 to '/u01/oracle/oradata/nsyqxxdata.dbf';
SET NEWNAME FOR DATAFILE 17 to '/u01/oracle/oradata/system17.dbf';
SET NEWNAME FOR DATAFILE 18 to '/u01/oracle/oradata/sysaux18.dbf';
SET NEWNAME FOR DATAFILE 19 to '/u01/oracle/oradata/sysaux19.dbf';
SET NEWNAME FOR DATAFILE 20 to '/u01/oracle/oradata/sysaux20.dbf';
SET NEWNAME FOR DATAFILE 21 to '/u01/oracle/oradata/sysaux21.dbf';
SET NEWNAME FOR DATAFILE 22 to '/u01/oracle/oradata/sysaux22.dbf';
SET NEWNAME FOR DATAFILE 23 to '/u01/oracle/oradata/sysaux23.dbf';
SET NEWNAME FOR DATAFILE 24 to '/u01/oracle/oradata/sysaux24.dbf';
SET NEWNAME FOR DATAFILE 25 to '/u01/oracle/oradata/sysaux25.dbf';
SET NEWNAME FOR DATAFILE 26 to '/u01/oracle/oradata/sysaux26.dbf';
SET NEWNAME FOR DATAFILE 27 to '/u01/oracle/oradata/sysaux27.dbf';
SET NEWNAME FOR DATAFILE 28 to '/u01/oracle/oradata/sysaux28.dbf';
SET NEWNAME FOR DATAFILE 29 to '/u01/oracle/oradata/sysaux29.dbf';
SET NEWNAME FOR DATAFILE 30 to '/u01/oracle/oradata/sysaux30.dbf';
SET NEWNAME FOR DATAFILE 31 to '/u01/oracle/oradata/sysaux31.dbf';
SET NEWNAME FOR DATAFILE 32 to '/u01/oracle/oradata/sysaux32.dbf';
SET NEWNAME FOR DATAFILE 33 to '/u01/oracle/oradata/sysaux33.dbf';
SET NEWNAME FOR DATAFILE 34 to '/u01/oracle/oradata/sysaux34.dbf';
SET NEWNAME FOR TEMPFILE 1 to '/u01/oracle/oradata/temp1.dbf';
SET NEWNAME FOR TEMPFILE 2 to '/u01/oracle/oradata/temp2.dbf';
SET NEWNAME FOR TEMPFILE 3 to '/u01/oracle/oradata/temp3.dbf';
SET NEWNAME FOR TEMPFILE 4 to '/u01/oracle/oradata/temp4.dbf';
SET NEWNAME FOR TEMPFILE 5 to '/u01/oracle/oradata/temp5.dbf';
RESTORE DATABASE;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
5)、对库进行基于时间点的恢复
RUN {
set until time "to_date('2020-05-09 16:03:42','yyyy-mm-dd hh24:mi:ss')";
RESTORE DATABASE;
SWITCH DATAFILE ALL;
recover database;
}
6)、修改日志的路径:
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_1.258.1034109449' to '/u01/oracle/oradata/group_1';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_1.257.1034109451' to '/u01/oracle/oradata/group_01';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_2.259.1034109451' to '/u01/oracle/oradata/group_2';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_2.258.1034109453' to '/u01/oracle/oradata/group_02';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_5.260.1034109453' to '/u01/oracle/oradata/group_5';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_5.259.1034109455' to '/u01/oracle/oradata/group_05';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_7.261.1034109455' to '/u01/oracle/oradata/group_7';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_7.260.1034109457' to '/u01/oracle/oradata/group_07';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_3.271.1034113835' to '/u01/oracle/oradata/group_3';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_3.261.1034113837' to '/u01/oracle/oradata/group_03';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_4.272.1034113837' to '/u01/oracle/oradata/group_4';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_4.262.1034113839' to '/u01/oracle/oradata/group_04';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_6.273.1034113841' to '/u01/oracle/oradata/group_6';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_6.263.1034113841' to '/u01/oracle/oradata/group_06';
alter database rename file '+DATA/ORCL12C/ONLINELOG/group_8.274.1034113843' to '/u01/oracle/oradata/group_8';
alter database rename file '+FRA/ORCL12C/ONLINELOG/group_8.264.1034113843' to '/u01/oracle/oradata/group_08';
8)、打开库
alter database open resetlogs;
迁移完成

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】