ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11gR2 RAC out-of-place 滚动升级(1)

11gR2 RAC out-of-place 滚动升级(1)

原创 Linux操作系统 作者:westzq1984 时间:2013-08-02 23:44:22 0 删除 编辑
本周给一套AIX下RAC库打PSU
正常情况下,AIX平台,2个节点打PSU就需要2小时,而且还老出一点文件无法拷贝的错
报错一会滚,OPatch自己的备份又要备份很久
而且经常发生前面的PSU报告有争用的问题,无法自动回滚掉
要是心里素质不好,决定要被弄的手忙脚乱

当天升级的时候,客户都不敢在边上看了。最后总算是有惊无险完成升级

回来思索grid能否 out-of-place 打PSU,总算找到了一篇文档
Minimal downtime patching via cloning 11gR2 ORACLE_HOME directories (Doc ID 1136544.1)

文档是基于EXADATA的,但是文档中明确说明,适用于其他平台

安装可以提前进行,到了计划时间点,只需要做switch即可,测试1个节点切换10分钟即可

-------------------------------------------
1.首先,准备新的grid和database的安装目录
-------------------------------------------
我的环境是:
当前:/u01/app/11.2.0/grid   /u01/app1/oracle/product/11.2/db_1  11.2.0.3.3
目标:/u01/app/11.2.0/grid_2 /u01/app1/oracle/product/11.2/db_2  11.2.0.3.6

[oracle@database1 11.2]$ pwd
/u01/app/oracle/product/11.2
[oracle@database1 11.2]$ ls -l
total 4
drwxr-xr-x 76 oracle oinstall 4096 Aug  2 11:08 db_1
lrwxrwxrwx  1 oracle oinstall   34 Aug  2 10:44 db_2 -> /u01/app1/oracle/product/11.2/db_2
[oracle@database1 11.2]$ ls -ld  /u01/app1/oracle/product/11.2/db_2
drwxr-xr-x 2 oracle oinstall 4096 Aug  2 10:16 /u01/app1/oracle/product/11.2/db_2

[grid@database1 11.2.0]$ pwd
/u01/app/11.2.0
[grid@database1 11.2.0]$ ls -tlr
total 4
drwxr-xr-x 69 root oinstall 4096 Sep 26  2012 grid
lrwxrwxrwx  1 root root       23 Aug  2 10:46 grid_2 -> /u01/app1/11.2.0/grid_2
[grid@database1 11.2.0]$ ls -ld /u01/app1/11.2.0/grid_2
drwxr-xr-x 2 root oinstall 4096 Aug  2 10:15 /u01/app1/11.2.0/grid_2

-------------------------------------------
2.克隆GRID,两个节点分别运行
-------------------------------------------
拷贝
# export ORACLE_HOME=/u01/app/11.2.0/grid_2
# cd /u01/app/11.2.0/grid;
# tar cfp - . | ( cd $ORACLE_HOME ; tar xf - )

解锁
# /usr/bin/perl $ORACLE_HOME/OPatch/crs/patch112.pl -unlock -desthome=$ORACLE_HOME

注意权限,免得影响
chmod 775 /u01/app/oracle/
chmod 775 /u01/app/11.2.0/grid_2
cd /u01/app/11.2.0/grid_2
ls -l |grep root|awk '{print $9}'|xargs chmod 775

克隆
database1
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ /usr/bin/perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE=/u01/app/oracle \
ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=Ora11g_gridinfrahome1_2 \
INVENTORY_LOCATION=/u01/app/oraInventory \
-O'"CLUSTER_NODES={database1,database2}"' \
-O'"LOCAL_NODE=database1"' CRS=false -O"SHOW_ROOTSH_CONFIRMATION=false"

database2
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ /usr/bin/perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE=/u01/app/oracle \
ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=Ora11g_gridinfrahome1_2 \
INVENTORY_LOCATION=/u01/app/oraInventory \
-O'"CLUSTER_NODES={database1,database2}"' \
-O'"LOCAL_NODE=database2"' CRS=false -O"SHOW_ROOTSH_CONFIRMATION=false"

可能报告JAVA找不到
Checking swap space: must be greater than 500 MB.   Actual 4971 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-08-02_01-45-01PM. Please wait ...The Java RunTime Environment was not found at /tmp/OraInstall2013-08-02_01-45-01PM/jre/bin/java. Hence, the Oracle Universal Installer cannot be run.
Please visit http://www.javasoft.com and install JRE version 1.3.1 or higher and try again.
: No such file or directory
修改  /u01/app1/11.2.0/grid_2/oui/oraparam.ini 中 JRE_LOCATION=/u01/app/11.2.0/grid_2/jdk/jre

可能报告NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError: %JRE_MEMORY_OPTIONS%
修改 /u01/app1/11.2.0/grid_2/oui/oraparam.ini 中 JRE_MEMORY_OPTIONS=" -mx150m"

如果以前GRID适用rds协议,那么clone会导致其切换回udp,需要重新修改
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk ipc_rds ioracle

-------------------------------------------
3.对grid_2 安装11.2.0.3.6的PSU,两个节点分别运行
-------------------------------------------
检查
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ $ORACLE_HOME/OPatch/opatch prereq \
CheckConflictAgainstOH -ph  /u01/app/oracle/admin/olm/software/112036/16315641 \
-invPtrLoc $ORACLE_HOME/oraInst.loc -oh $ORACLE_HOME
$ $ORACLE_HOME/OPatch/opatch prereq \
CheckConflictAgainstOH -ph  /u01/app/oracle/admin/olm/software/112036/16056266 \
-invPtrLoc $ORACLE_HOME/oraInst.loc -oh $ORACLE_HOME

生成ocm.rsp
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ cd /u01/app/oracle
$ $ORACLE_HOME/OPatch/ocm/bin/emocmrsp

回滚11.2.0.3.3 PSU,我在安装中遇到报告其有争用
# export ORACLE_HOME=/u01/app/11.2.0/grid_2
# /usr/bin/perl $ORACLE_HOME/OPatch/crs/patch112.pl -unlock -desthome=$ORACLE_HOME
$ export ORACLE_HOME=/u01/app/11.2.0/grid_2
$ opatch rollback -id 13919095 -oh $ORACLE_HOME -local

安装11.2.0.3.6 PSU
# export ORACLE_HOME=/u01/app/11.2.0/grid_2
# $ORACLE_HOME/OPatch/opatch auto /u01/app/oracle/admin/olm/software/112036 -oh $ORACLE_HOME -ocmrf /u01/app/oracle/ocm.rsp

检查
$ /u01/app/11.2.0/grid_2/OPatch/opatch lsinventory -oh /u01/app/11.2.0/grid_2


-------------------------------------------
4.克隆ORACLE,两个节点分别运行
-------------------------------------------
拷贝
# export ORACLE_HOME=/u01/app/oracle/product/11.2/db_2
# cd /u01/app/oracle/product/11.2/db_1
# tar cfp - . | ( cd $ORACLE_HOME ; tar xf - )

克隆
$ export ORACLE_HOME=/u01/app/oracle/product/11.2/db_2
$ cd $ORACLE_HOME/clone/bin
$ ./clone.pl ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=OraDB_home2 ORACLE_BASE=/u01/app/oracle
-- 确保HOME目录权限在755,否则SSH要出问题
$ $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={database1,database2}"

如果以前ORACLE适用rds协议,那么clone会导致其切换回udp,需要重新修改
$ cd $ORACLE_HOME/rdbms/lib;
$ make -f ins_rdbms.mk ipc_rds ioracle

执行root.sh
# export ORACLE_HOME=/u01/app/oracle/product/11.2/db_2
# $ORACLE_HOME/root.sh

安装11.2.0.3.6 PSU
# export ORACLE_HOME=/u01/app/oracle/product/11.2/db_2
# $ORACLE_HOME/OPatch/opatch auto /u01/app/oracle/admin/olm/software/112036 -oh $ORACLE_HOME -ocmrf /u01/app/oracle/ocm.rsp

检查
$ /u01/app1/oracle/product/11.2/db_2/OPatch/opatch lsinventory -oh /u01/app1/oracle/product/11.2/db_2
 
 
-------------------------------------------
5.切换,两个节点分别运行
-------------------------------------------
关闭数据库
$ export ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
$ $ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -n database1 -s /tmp/mygi.stat

切换GRID 
注意,当前数据库的PATCHSET是那个版本,就用那个版本的patch1120x.pl
# export ORACLE_HOME=/u01/app/11.2.0/grid_2
# /usr/bin/perl $ORACLE_HOME/OPatch/crs/patch11203.pl -patch -desthome=$ORACLE_HOME

修改环境变量
root
grid
oracle

切换数据库
srvctl modify database -d orcl -o /u01/app/oracle/product/11.2/db_2

[grid@database1 grid]$ crsctl stat res -t

ora.orcl.db
      1        ONLINE  ONLINE       database1                Open,Running from O
                                                             ld Oracle Home     
      2        ONLINE  ONLINE       database2                Open,Running from O
                                                             ld Oracle Home 
srvctl stop instance -d orcl -i ORCL1
srvctl start instance -d orcl -i ORCL1
srvctl stop instance -d orcl -i ORCL2
srvctl start instance -d orcl -i ORCL2

启动数据库,跑脚本,升级,这个一个节点跑即可

-------------------------------------------
6.如何rollback
-------------------------------------------
DB直接切换配置即可
GRID可以使用脚本,切换回去即可,测试可行
# export ORACLE_HOME=/u01/app/11.2.0/grid
# /usr/bin/perl $ORACLE_HOME/OPatch/crs/patch11203.pl -patch -desthome=$ORACLE_HOME

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8242091/viewspace-767707/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-04-06

  • 博文量
    251
  • 访问量
    957603