客户环境概览
2结点RAC(旧)
共享存储(旧)
2结点RAC(新)
共享存储(借用,中转数据使用,用完后需归还)
实施方案:
由于只更换服务器不更换共享存储,所以需要先在新服务器+新共享存储上搭建完RAC环境,导入原库中的数据,再将存储更换为老共享存储。
采取该方案的原因如下:
新机器操作系统最低只支持RHEL6.5,而原机器操作系统为RHEL5.5,数据库版本Oracle 10g。新机器6.5的RHEL上无法安装Oracle 10g,最低只能安装Oracle11g,因此排除添加删除节点的方案。而且先将原rac升级到11g然后再增删结点的方案需要更长的回退时间,遂也未采用。
实施流程概览
1、为新服务器安装RHEL 6.5以及Oracle 11g GI和Database(OCR使用借用的临时共享存储);
2、停止应用和旧数据库监听,expdp导出数据;
3、impdp恢复数据到11g rac环境;
4、将应用连接到新数据库环境,进行简单连通性测试以及验证数据完整性;
5、关闭应用,卸载老存储并格式化分为300G一个的LUN,映射到新服务器上;
6、在老共享存储上创建asm磁盘组,迁移OCR以及voting disk至老存储
7、使用rman(backup as copy)将数据库迁移到老存储;
8、启动数据库,并启动应用,进行测试;
2016年7月21日09:34:00
安置新运达的服务器于办公室内,配置交换机、共享存储、以及一些前期准备工作。
2016年7月21日12:34:41
上传安装介质
2016年7月21日12:37:02
Fdisk 分区
for i in b c d e f g h i j k l m; do fdisk /dev/sd$i <<EOF n p 1 w EOF done
udev绑定裸设备
for i in b c d e f g h i j k l m; do echo "KERNEL==\"sd*\",PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\",NAME=\"asm-disk$i\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules done
创建相关用户
/usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba /usr/sbin/groupadd -g 507 asmoper /usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -m grid /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba -d /home/oracle -m oracle passwd oracle passwd grid
启动udev
start_udev
2016年7月21日12:51:44
解压安装介质
ls *.zip | xargs -n1 unzip
等待网络配置。。。。。。。。。。。
2016年7月21日14:04:21
二号结点fdisk -l 发现不到盘,重启后解决。
2016年7月21日14:07:38
配置两台机器hosts文件
2016年7月21日14:33:37
rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" binutils.x86_64 \ compat-libstdc++-33.x86_64 \ glibc.x86_64 \ ksh-*.x86_64 \ libaio.x86_64 \ libaio-devel.x86_64 \ libgcc.x86_64 \ libstdc++.x86_64 \ libstdc++-devel.x86_64 \ make.x86_64 \ compat-libcap1.x86_64 \ gcc.x86_64 \ gcc-c++.x86_64 \ glibc-devel.x86_64 \ sysstat.x86_64 | grep "not installed"
检查缺少的rpm包,用yum打上缺的包
./runInstaller安装grid。
2016年7月21日14:45:08
执行GI root.sh报错
[root@fxs38501 /]# /u01/app/11.2.0/grid/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation Installing Trace File Analyzer Failed to create keys in the OLR,rc = 127,Message: /u01/app/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory Failed to create keys in the OLR at /u01/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 7660. /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl execution Failed
为两节点用yum打上缺的包
yum install -y compat-libcap1
然后删除crs配置
$GRID_HOME/crs/install/rootcrs.pl -verbose -deconfig -force
重新执行root.sh
执行成功。
至此GI安装完成。
2016年7月21日15:04:28
搬运暂存在办公室的服务器以及共享存储至机房。
状况:
发现老RAC挂载新存储后导致磁盘盘符混乱(由最初安装rac时绑定裸盘方法不当导致),无法启动rac,遂采用挂载NFS文件系统的方式存储dump数据。
2016年7月21日18:58:21
安装database软件(具体步骤略)
2016年7月21日19:19:16
opatch为GI和DB软件打补丁:
export PATH=$PATH:$ORACLE_HOME/OPatch
执行$ORACLE_HOME/OPatch/ocm/bin/emocmrsp生成ocm.rsp文件
然后使用opatch auto /tmp/23274134 -ocmrf /tmp/ocm.rsp为GI打补丁
注意:如果已经建库opatch会自动为DB软件打补丁,如果未建库DB的补丁要自己手动打。
GI node1:
[grid@fxs38501 OPatch]$ ./opatch lsinventory Oracle 中间补丁程序安装程序版本 11.2.0.3.14 版权所有 (c) 2016,Oracle Corporation。保留所有权利。 Oracle Home : /u01/app/11.2.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/11.2.0/grid/oraInst.loc OPatch version : 11.2.0.3.14 OUI version : 11.2.0.4.0 Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2016-07-21_20-03-52下午_1.log Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2016-07-21_20-03-52下午.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: fxs38501 ARU platform id: 226 ARU platform description:: Linux x86-64 已安装的顶级产品 (1): Oracle Grid Infrastructure 11g 11.2.0.4.0 此 Oracle 主目录中已安装 1 个产品。 中间补丁程序 (3) : Patch 22502505 : applied on Thu Jul 21 19:46:10 CST 2016 Unique Patch ID: 19880366 Patch description: "ACFS Patch Set Update : 11.2.0.4.160419 (22502505)" Created on 17 Feb 2016,00:12:23 hrs PST8PDT Bugs fixed: 21369858,16318126,19690653,17503605,17203009,17359415,20140148 17611362,17164243,19053182,17696547,17488768,18168684,21519796 18143006,21208140,17428148,17070158,20438706,17510275,17172303 18610307,17376318,17721778,22198405,17699423,18915417,18155334 18321597,19919907,18185024,17636008,17363999,20681968,17475946 Patch 23054319 : applied on Thu Jul 21 19:45:43 CST 2016 Unique Patch ID: 20209287 Patch description: "OCW Patch Set Update : 11.2.0.4.160719 (23054319)" Created on 15 Jul 2016,14:38:17 hrs PST8PDT Bugs fixed: 18328800,19270660,18691572,18508710,20038451,21251192,22162062 20365005,21232394,17387214,17750548,17617807,14497275,20219458 (此处略去若干bug号。) 21442094,20235486,19359787,15869775,17447588,19642566,21152052 16798862,15920201 Patch 23054359 : applied on Thu Jul 21 19:44:57 CST 2016 Unique Patch ID: 20226193 Patch description: "Database Patch Set Update : 11.2.0.4.160719 (23054359)" Created on 15 Jun 2016,16:08:35 hrs PST8PDT Sub-patch 22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)" Sub-patch 21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)" Sub-patch 21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)" Sub-patch 20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)" Sub-patch 20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)" Sub-patch 19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)" Sub-patch 19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)" Sub-patch 18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)" Sub-patch 18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)" Sub-patch 17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)" Bugs fixed: 17184721,21538558,16091637,18092127,17381384,15979965,18441944 13837378,16314254,16731148,17835048,13558557,17201159,17853498 (此处略去若干bug号。) 19680952,18704244,18828868,18273830,17050888,17360606,16992075 17375354,12905058,18362222,17571039,17468141,18436647,17235750 21168487,16220077,16929165 包含多个节点的 RAC 系统 Local node = fxs38501 Remote node = fxs38502 -------------------------------------------------------------------------------- OPatch succeeded.
GI node2:
[grid@fxs38502 OPatch]$ ./opatch lsinventory Oracle 中间补丁程序安装程序版本 11.2.0.3.14 版权所有 (c) 2016,Oracle Corporation。保留所有权利。 Oracle Home : /u01/app/11.2.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/11.2.0/grid/oraInst.loc OPatch version : 11.2.0.3.14 OUI version : 11.2.0.4.0 Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2016-07-21_20-06-28下午_1.log Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2016-07-21_20-06-28下午.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: fxs38502 ARU platform id: 226 ARU platform description:: Linux x86-64 已安装的顶级产品 (1): Oracle Grid Infrastructure 11g 11.2.0.4.0 此 Oracle 主目录中已安装 1 个产品。 中间补丁程序 (3) : Patch 22502505 : applied on Thu Jul 21 20:02:06 CST 2016 Unique Patch ID: 19880366 Patch description: "ACFS Patch Set Update : 11.2.0.4.160419 (22502505)" Created on 17 Feb 2016,17475946 Patch 23054319 : applied on Thu Jul 21 20:01:40 CST 2016 Unique Patch ID: 20209287 Patch description: "OCW Patch Set Update : 11.2.0.4.160719 (23054319)" Created on 15 Jul 2016,20219458 (此处略去若干bug号。) 19319357,20094984,17046460,17059927,18053631,16867761,18774591 21442094,15920201 Patch 23054359 : applied on Thu Jul 21 20:00:50 CST 2016 Unique Patch ID: 20226193 Patch description: "Database Patch Set Update : 11.2.0.4.160719 (23054359)" Created on 15 Jun 2016,16929165 包含多个节点的 RAC 系统 Local node = fxs38502 Remote node = fxs38501 -------------------------------------------------------------------------------- OPatch succeeded.
opatch auto /tmp/23274134 -oh /u01/app/oracle/product/11.2.0/dbhome_1 -ocmrf /tmp/ocm.rsp
DB node1:
[oracle@fxs38501 OPatch]$ ./opatch lsinventory Oracle 中间补丁程序安装程序版本 11.2.0.3.14 版权所有 (c) 2016,Oracle Corporation。保留所有权利。 Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc OPatch version : 11.2.0.3.14 OUI version : 11.2.0.4.0 Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2016-07-21_20-13-24下午_1.log Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2016-07-21_20-13-24下午.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: fxs38501 ARU platform id: 226 ARU platform description:: Linux x86-64 已安装的顶级产品 (1): Oracle Database 11g 11.2.0.4.0 此 Oracle 主目录中已安装 1 个产品。 中间补丁程序 (2) : Patch 23054319 : applied on Thu Jul 21 20:11:50 CST 2016 Unique Patch ID: 20209287 Patch description: "OCW Patch Set Update : 11.2.0.4.160719 (23054319)" Created on 15 Jul 2016,14:38:02 hrs PST8PDT Bugs fixed: 18328800,15920201 Patch 23054359 : applied on Thu Jul 21 20:11:07 CST 2016 Unique Patch ID: 20226193 Patch description: "Database Patch Set Update : 11.2.0.4.160719 (23054359)" Created on 15 Jun 2016,16929165 包含多个节点的 RAC 系统 Local node = fxs38501 Remote node = fxs38502 -------------------------------------------------------------------------------- OPatch succeeded.
DB node2:
[oracle@fxs38502 OPatch]$ ./opatch lsinventory Oracle 中间补丁程序安装程序版本 11.2.0.3.14 版权所有 (c) 2016,Oracle Corporation。保留所有权利。 Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc OPatch version : 11.2.0.3.14 OUI version : 11.2.0.4.0 Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2016-07-21_20-17-42下午_1.log Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2016-07-21_20-17-42下午.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: fxs38502 ARU platform id: 226 ARU platform description:: Linux x86-64 已安装的顶级产品 (1): Oracle Database 11g 11.2.0.4.0 此 Oracle 主目录中已安装 1 个产品。 中间补丁程序 (2) : Patch 23054319 : applied on Thu Jul 21 20:17:01 CST 2016 Unique Patch ID: 20209287 Patch description: "OCW Patch Set Update : 11.2.0.4.160719 (23054319)" Created on 15 Jul 2016,20219458 (此处略去若干bug号。) 17769597,19955755,16429265,18336452,17273003,17209968,16988311 19319357,15920201 Patch 23054359 : applied on Thu Jul 21 20:16:19 CST 2016 Unique Patch ID: 20226193 Patch description: "Database Patch Set Update : 11.2.0.4.160719 (23054359)" Created on 15 Jun 2016,17853498 17246576,18356166,18440047,18681862,16875449,19788842,17296856 21330264,14010183,17648596,17551063,17025461,17267114,22507210 17912217,17889583,18202441,17040764,16524926,17478145,19358317 (此处略去若干bug号。) 19680952,16929165 包含多个节点的 RAC 系统 Local node = fxs38502 Remote node = fxs38501 -------------------------------------------------------------------------------- OPatch succeeded.
2016年7月21日20:18:38
dbca建库
建库过程中警告日志出现如下警告
Thread 1 cannot allocate new log,sequence 21
Checkpoint not complete
Current log# 2 seq# 20 mem# 0: +DATA/centerdb/onlinelog/group_2.264.917814411
Current log# 2 seq# 20 mem# 1: +DATA/centerdb/onlinelog/group_2.265.917814413
Thread 1 advanced to log sequence 21 (LGWR switch)
Current log# 1 seq# 21 mem# 0: +DATA/centerdb/onlinelog/group_1.262.917814411
Current log# 1 seq# 21 mem# 1: +DA...................
后期要添加在线日志组,日志组成员大小为500MB
2016年7月21日21:10:00
expdp DIRECTORY=DMPDIR DUMPFILE=all.dmp LOGFILE=all.log SCHEMAS=TSMSYS,CENTER_MAIL,OUTLN,BENTER_ADMIN,WMSYS,CENTER_ETL,GYAM,DDS
数据泵开始从源库导出数据
2016年7月21日21:53:16
准备添加日志组的脚本:
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 6 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 7 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 8 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 9 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 10 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 11 SIZE 500M; ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 12 SIZE 500M;
删除旧的日志组(删除前要switch logfile以确保删掉的日志组不是current状态):
ALTER DATABASE DROP LOGFILE GROUP 1; ALTER DATABASE DROP LOGFILE GROUP 2; ALTER DATABASE DROP LOGFILE GROUP 3; ALTER DATABASE DROP LOGFILE GROUP 4;
CREATE TABLESPACE CENTERDBT DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE CENTERDBT ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; CREATE TABLESPACE GYDB DATAFILE SIZE 1G AUTOEXTEND ON next 100m; ALTER TABLESPACE GYDB ADD DATAFILE SIZE 1G AUTOEXTEND ON next 100m; CREATE TABLESPACE CENTERMAIL DATAFILE SIZE 1G AUTOEXTEND on next 100m; CREATE TABLESPACE SPACE_INXITEDB DATAFILE SIZE 1G AUTOEXTEND ON next 100m;
运行hugepages_settings.sh得出大内存参数
vm.nr_hugepages = 2052
vm.vfs_cache_pressure=200
vm.swappiness=10
vm.min_free_kbytes=524288
2016年7月22日00:14:12
expdp导出完成
2016年7月22日00:14:26
添加日志组
2016年7月22日01:15:37
导入开始
impdp system/oracle DIRECTORY=dmpdir DUMPFILE=all.dmp LOGFILE=in.log CLUSTER=N &
状况:发现字符集不对,原库用的GBK,新库用的UTF8,遂DBCA删除重建。(耗时大约15分钟)
2016年7月22日02:56:57
再次进行impdp操作
2016年7月22日07:23:58
最终由于导入速度过慢,无法再8点之前完成导入操作(3小时导入100多G),客户要求终止新rac的导入,并重新启用旧rac。暂定于周五继续进行迁移操作。
原文链接:https://www.f2er.com/oracle/213457.html