如何保证10g CRS和11g GI并存在同一节点
FROM:http://t.askmaclean.com/thread-3057-1-1.html
从 10.2.0.4 rac 升级到 11.2.0.3, 从网上看到,有两种升级方式:
1,直接在原来的安装用户oracle下面安装GI, 升级旧的crs, asm;
2,新建一个grid用户,屏蔽到10g crs信息,全新安装GI,再导入asm disk, 导入10g db, 然后再升级10g DB 都11g;
如果要求回退 ,那么一般使用方案2:
具体实施如下:
如何保证10g CRS和11g GI并存在同一节点 , 即保持10g CRS和11g Grid Infrastructure 同时安装在一套cluster上,通过脚本切换实现 2者之间的切换,互不冲突
一、在安装11g GI 之前备份10g CRS环境配置文件的操作步骤 1、disable服务器自动启动CRS 以root用户执行: $CRS_HOME/bin/crsctl disable crs
2、在/etc目录下新建/etc/10gcrs_bak目录作为备份文件存放的目录 以root用户登录 cd /etc mkdir 10gcrs_bak
3、将以下需要备份的文件和文件夹进行备份 以root用户登录,备份文件: cp -p /etc/inittab /etc/10gcrs_bak/inittab cp -p /etc/init.crs /etc/10gcrs_bak/init.crs cp -p /etc/init.crsd /etc/10gcrs_bak/init.crsd cp -p /etc/init.cssd /etc/10gcrs_bak/init.cssd cp -p /etc/init.evmd /etc/10gcrs_bak/init.evmd cp -p /etc/oratab /etc/10gcrs_bak/oratab cp -p /etc/oraInst.loc /etc/10gcrs_bak/oraInst.loc cp -p /usr/local/bin/dbhome /etc/10gcrs_bak/dbhome cp -p /usr/local/bin/coraenv/etc/10gcrs_bak/coraenv cp -p /usr/local/bin/oraenv /etc/10gcrs_bak/oraenv
备份目录: rm -rf /etc/10gcrs_bak/oracle cp -pr /etc/oracle /etc/10gcrs_bak
查看/etc/rc.d/rc2.d下链接:
ls -lrt /etc/rc.d/rc2.d/*init.crs 结果应该返回2个文件名: lrwxrwxrwx 1 root system 13 Apr 25 14:17 S96init.crs -> /etc/init.crs lrwxrwxrwx 1 root system 13 Apr 25 14:17 K96init.crs -> /etc/init.crs
4、enable服务器自动启动CRS 以root用户执行: $CRS_HOME/bin/crsctl enable crs
二、安装完11g GI环境之后,备份11g GI环境的操作步骤 1、disable服务器启动GI自动启动 以root用户执行: $GRID_HOME/bin/crsctl disable crs
2、在/etc目录下新建/etc/11ggi_bak目录作为备份文件存放的目录 以root用户登录: cd /etc mkdir 11ggi_bak
3、将以下需要备份的文件和文件夹进行备份 以root用户登录,备份文件: cp -p /etc/inittab /etc/11ggi_bak/inittab cp -p /etc/init.ohasd /etc/11ggi_bak/init.ohasd cp -p /etc/ohasd /etc/11ggi_bak/ohasd cp -p /etc/oratab /etc/11ggi_bak/oratab cp -p /etc/oraInst.loc /etc/11ggi_bak/oraInst.loc cp -p /usr/local/bin/dbhome /etc/11ggi_bak/dbhome cp -p /usr/local/bin/coraenv/etc/11ggi_bak/coraenv cp -p /usr/local/bin/oraenv /etc/11ggi_bak/oraenv 备份目录: rm-rf /etc/11ggi_bak/oracle cp -pr /etc/oracle /etc/11ggi_bak/
查看/etc/rc.d/rc2.d下链接:
ls -lrt /etc/rc.d/rc2.d/*init.crs 结果应该返回2个文件名:
lrwxrwxrwx 1 root system 10 Apr 12 14:50 K19ohasd -> /etc/ohasd lrwxrwxrwx 1 root system 10 Apr 12 14:50 S96ohasd -> /etc/ohasd
4、enable服务器自动启动GI $GRID_HOME/bin/crsctl enable crs
三、10g CRS切换到11g GI环境的操作步骤 1、停止10g crs $CRS_HOME/bin/crsctl stop crs
2、检查10g crs剩余进程 ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID' 结果应该会返回以下4个进程列表: UID PID PPID C STIME TTYTIME CMD root 1 0 0 12:07:31 -0:00 /etc/init root 139314 1 0 15:32:40 -0:00 /bin/sh /etc/init.cssd fatal root 364692 1 0 15:32:40 -0:00 /bin/sh /etc/init.crsd run root 630962 1 0 15:32:39 -0:00 /bin/sh /etc/init.evmd run
3、删除/tmp/.oracle目录下的socket文件 rm -rf /tmp/.oracle/*
4、从11ggi_bak目录恢复11g环境 恢复目录: rm -rf /etc/oracle cp -pr /etc/11ggi_bak/oracle /etc/ 恢复文件: cp -p/etc/11ggi_bak/init.ohasd /etc/init.ohasd cp -p/etc/11ggi_bak/ohasd /etc/ohasd cp -p/etc/11ggi_bak/oratab /etc/oratab cp -p/etc/11ggi_bak/oraInst.loc /etc/oraInst.loc cp -p/etc/11ggi_bak/dbhome /usr/local/bin/dbhome cp -p/etc/11ggi_bak/coraenv /usr/local/bin/coraenv cp -p/etc/11ggi_bak/oraenv /usr/local/bin/oraenv cp -p/etc/11ggi_bak/inittab /etc/inittab
删除10g crs链接,恢复11g GI链接 rm -rf/etc/rc.d/rc2.d/S96init.crs rm -rf/etc/rc.d/rc2.d/K96init.crs ln -s -f/etc/ohasd /etc/rc.d/rc2.d/K19ohasd ln -s -f/etc/ohasd /etc/rc.d/rc2.d/S96ohasd
5、再次检查10g crs剩余进程 ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID'
结果应该会返回以下2个进程列表: UID PID PPID C STIME TTYTIME CMD root 1 0 0 12:07:31 -0:00 /etc/init root 630962 1 0 15:32:39 -0:00 /bin/sh /etc/init.evmd run
进程/etc/init.evmd run ,无法通过命令直接停止,需要kill它:
kill -9 [init.evmd 进程号]
再次查看进程 ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID' 此时,应该可以观察到如下2个进程,其中init.ohasd进程:属于11g GI, 如果没有init.ohasd进程,那么可以等待几秒钟,再使用 ps命令查看进程情况, 直到看到此进程,才能进入下一步。 UID PID PPID C STIME TTYTIME CMD root 1 0 0 12:07:31 -0:00 /etc/init root 270354 1 0 15:42:00 -0:00 /bin/sh /etc/init.ohasd run
6、启动11g gi 集群软件 $GRID_HOME/bin/crsctl start crs
7、检查11g gi init进程启动状态 $GRID_HOME/bin/crsctl stat res -t -init
结果中,除了"ora.diskmon"(AIX默认是offline)资源外,其它的"TARGET"和"STATE"必须为ONLINE: -------------------------------------------------------------------------------- NAME TARGETSTATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.asm 1 ONLINEONLINE maclean07 Started ora.cluster_interconnect.haip 1 ONLINEONLINE maclean07 ora.crf 1 ONLINEONLINE maclean07 ora.crsd 1 ONLINEONLINE maclean07 ora.cssd 1 ONLINEONLINE maclean07 ora.cssdmonitor 1 ONLINEONLINE maclean07 ora.ctssd 1 ONLINEONLINE maclean07 OBSERVER ora.diskmon 1 OFFLINE OFFLINE ora.evmd 1 ONLINEONLINE maclean07 ora.gipcd 1 ONLINEONLINE maclean07 ora.gpnpd 1 ONLINEONLINE maclean07 ora.mdnsd 1 ONLINEONLINE maclean07
8、检查11g cluster 资源状态 $GRID_HOME/bin/crsctl stat res -t
结果中,除了"ora.gsd" 资源外,其它的"TARGET"和"STATE"必须为ONLINE
-------------------------------------------------------------------------------- NAME TARGETSTATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.OCRVOTE.dg ONLINEONLINE maclean07 ora.asm ONLINEONLINE maclean07 Started ora.gsd OFFLINE OFFLINE maclean07 ora.net1.network ONLINEONLINE maclean07 ora.ons ONLINEONLINE maclean07 ora.LISTENER_SCAN1.lsnr 1 ONLINEONLINE maclean07 ora.cvu 1 ONLINEONLINE maclean07 ora.oc4j 1 ONLINEONLINE maclean07 ora.scan1.vip 1 ONLINEONLINE maclean07 ora.maclean07.vip 1 ONLINEONLINE maclean07
9、enable服务器自动启动GI $GRID_HOME/bin/crsctl enable crs
此时,10g集群环境已经成功切换到11g集群。
四、11g GI环境切换(恢复)到10g CRS环境的操作步骤 1、停止11g GI $grid_home/bin/crsctl stop crs -f
2、检查11g GI剩余进程 ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID' 结果应该会返回以下2个进程列表: UID PID PPID C STIME TTYTIME CMD root 1 0 0 12:07:31 -0:00 /etc/init root 270354 1 0 15:42:00 -0:00 /bin/sh /etc/init.ohasd run
为了保证10g crs后台进程能正常启动,需要停止init.ohasd进程。 修改inittab文件,删除ohasd的入口: vi /etc/inittab 删除行 "h1:2:respawn:/etc/init.ohasd run >/dev/null 2>&1 </dev/null"。 kill -9 [init.ohasd 进程号]
3、删除/tmp/.oracle目录下的socket文件 rm -rf /tmp/.oracle/*
4、从10gcrs_bak目录恢复10g环境 恢复目录: rm -rf /etc/oracle cp -pr /etc/10gcrs_bak/oracle /etc/ 恢复文件: cp -p/etc/10gcrs_bak/init.ohasd /etc/init.ohasd cp -p/etc/10gcrs_bak/ohasd /etc/ohasd cp -p/etc/10gcrs_bak/oratab /etc/oratab cp -p/etc/10gcrs_bak/oraInst.loc /etc/oraInst.loc cp -p/etc/10gcrs_bak/dbhome /usr/local/bin/dbhome cp -p/etc/10gcrs_bak/coraenv /usr/local/bin/coraenv cp -p/etc/10gcrs_bak/oraenv /usr/local/bin/oraenv cp -p/etc/10gcrs_bak/inittab /etc/inittab
删除11g GI链接,恢复10g CRS链接 rm -rf /etc/rc.d/rc2.d/K19ohasd /etc/rc.d/rc2.d/S96ohasd ln -s -f/etc/init.crs /etc/rc.d/rc2.d/S96init.crs ln -s -f/etc/init.crs /etc/rc.d/rc2.d/K96init.crs
4、检查当前启动的进程 ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID' 结果应该会返回以下4个进程列表,如果没有,那么可以等待几秒钟,再使用 ps命令 查看进程情况,直到看到4个进程,才能进入下一步。 UID PID PPID C STIME TTYTIME CMD root 1 0 0 17:17:53 -0:00 /etc/init root 323746 1 0 17:19:27 -0:00 /bin/sh /etc/init.evmd run root 332030 1 0 17:19:27 -0:00 /bin/sh /etc/init.crsd run root 393246 1 0 17:19:27 -0:00 /bin/sh /etc/init.cssd fatal
5、启动10g CRS $CRS_HOME/bin/crsctl start crs
6、检查10g crs daemon状态 $CRS_HOME/bin/crsctl check crs
7、检查10g cluster资源状态,此节点资源“Target”,“State”应该均为ONLINE. 其它节点的资源“Target”,“State”的状态在同步完成以上步骤后,也均为ONLINE. $CRS_HOME/bin/crs_stat -t
Name Type Target State Host ------------------------------------------------------------ ora....a07.gsd application ONLINE ONLINE maclean07 ora....a07.ons application ONLINE ONLINE maclean07 ora....a07.vip application ONLINE ONLINE maclean07 ora....a08.gsd application ONLINE OFFLINE ora....a08.ons application ONLINE OFFLINE ora....a08.vip application ONLINE ONLINE maclean07
8、enable服务器自动启动CRS $CRS_HOME/bin/crsctl enable crs
此时,11g集群环境成功切换到10g集群环境。 参考文档: MOS:879905.1 239998.1 942166.1 556976.1 755643.1 |