风哥教程

培训 . 交流 . 分享
Make progress together!

oracle 12C RAC 迁移到单机

[复制链接]
内容发布:lihfe| 发布时间:2020-5-9 19:06:23
本帖最后由 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 / <<EOF
run
{
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/nfsbackup/oracle12c/arch/$current_day/PID-%F';
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 tag='db0'
format '/nfsbackup/oracle12c/arch/$current_day/%n_%T_%U' database;
sql 'alter system archive log current';
backup archivelog all format '/nfsbackup/oracle12c/arch/$current_day/arc_%n_%T_%U' delete all input;
release channel c1;
release channel c2;
}
EOF


1级备份脚本:
#!/bin/bash
# incremental level 1 backup script
source /home/oracle/.bash_profile
current_day=`date +%Y%m%d`
incr_day=incr$current_day
mkdir /nfsbackup/oracle12c/arch/$incr_day
rman target / <<EOF
run
{
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/nfsbackup/oracle12c/arch/$incr_day/PID-%F';
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 cumulative tag='db1'
format '/nfsbackup/oracle12c/arch/$incr_day/%n_%T_%U' database;
sql 'alter system archive log current';
backup archivelog all format '/nfsbackup/oracle12c/arch/$incr_day/arc_%n_%T_%U' delete all input;
release channel c1;
release channel c2;
}
EOF

2、把备份文件从RAC的环境拷贝到单机环境(我是同相同的路径)
3、异机开始恢复
1)、启动到nomount状态(提前修改好了pfile文件,这里不详细说明)
RMAN> 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;
迁移完成






上一篇:oracle 12c RAC 日志频繁切换 checkpoint not complete
下一篇:第一次发帖,大家互相学习
回复

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热门文章教程

  • PostgreSQL数据库中文培训手册
  • Oracle Database 12c 数据库100个新特性与
  • Navicat for MySQL最新版下载地址及注册码
  • oracle 12c RAC 日志频繁切换 checkpoint n
  • 风哥Oracle数据库巡检工具V1.0(附2.6网页
  • MySQL权威指南(第2版)PDF电子书下载
快速回复 返回顶部 返回列表