千家信息网

11.2.0.4 PSU安装操作模版

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,补丁安装是一件常态化的事情,针对11.2.0.4的PSU补丁,整理了一套标准安装流程,补丁版本为每季度的PSU补丁以及OJVM补丁。 26636028 = 26635745 + 26635834###
千家信息网最后更新 2025年01月20日11.2.0.4 PSU安装操作模版
    补丁安装是一件常态化的事情,针对11.2.0.4的PSU补丁,整理了一套标准安装流程,补丁版本为每季度的PSU补丁以及OJVM补丁。 26636028 = 26635745 + 26635834###########################################################################################################################一 参考下面的步骤在一个节点上安装补丁26635745 (PSU),数据库完全停止后,可以在两个节点同时安装#########################################################################################################################    -------------------------------------------------------------------------------------------------------------------------0.为了避免安装补丁运行数据字典脚本时与系统后台作业冲突,查看AutoTask,如果有Enabled的,先Disable,打完补丁后再Enable.-------------------------------------------------------------------------------------------------------------------------su - oraclesqlplus "/as sysdba"set lin 180 pages 10000COL CLIENT_NAME FORMAT A40COL CONSUMER_GROUP FORMAT A30COL WINDOW_GROUP FORMAT A30select CLIENT_NAME,STATUS,CONSUMER_GROUP,WINDOW_GROUP from dba_autotask_client;CLIENT_NAME                              STATUS   CONSUMER_GROUP                 WINDOW_GROUP---------------------------------------- -------- ------------------------------ ------------------------------auto optimizer stats collection          ENABLED  ORA$AUTOTASK_STATS_GROUP       ORA$AT_WGRP_OSauto space advisor                       DISABLED ORA$AUTOTASK_SPACE_GROUP       ORA$AT_WGRP_SAsql tuning advisor                       DISABLED ORA$AUTOTASK_SQL_GROUP         ORA$AT_WGRP_SQBEGINDBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'auto optimizer stats collection', operation => NULL, window_name => NULL);END;/BEGINDBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'auto space advisor', operation => NULL, window_name => NULL);END;/BEGINDBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'sql tuning advisor', operation => NULL, window_name => NULL);END;/再确认当前的数据库组件状态是否都正常,并记录当前状态:set lin 170 pages 10000select comp_id,status,version from dba_registry;COMP_ID                        STATUS                 VERSION------------------------------ ---------------------- ------------------------------OWB                            VALID                  11.2.0.4.0APEX                           VALID                  3.2.1.00.12EM                             VALID                  11.2.0.4.0AMD                            VALID                  11.2.0.4.0SDO                            VALID                  11.2.0.4.0ORDIM                          VALID                  11.2.0.4.0XDB                            VALID                  11.2.0.4.0CONTEXT                        VALID                  11.2.0.4.0EXF                            VALID                  11.2.0.4.0RUL                            VALID                  11.2.0.4.0OWM                            VALID                  11.2.0.4.0CATALOG                        VALID                  11.2.0.4.0CATPROC                        VALID                  11.2.0.4.0JAVAVM                         VALID                  11.2.0.4.0XML                            VALID                  11.2.0.4.0CATJAVA                        VALID                  11.2.0.4.0APS                            VALID                  11.2.0.4.0XOQ                            VALID                  11.2.0.4.0RAC                            VALID                  11.2.0.4.019 rows selected.-------------------------------------------------------------------------------------------------------------------------1.以grid用户停止listener,并kill数据库会话进程-------------------------------------------------------------------------------------------------------------------------su - gridsrvctl stop listenersrvctl stop scan_listenerkill -9 `ps -ef|grep LOCAL=NO|grep -v grep|grep -iv ASM|awk '{print $2}'`-------------------------------------------------------------------------------------------------------------------------2.以oracle用户禁用db自动启动,然后停止db-------------------------------------------------------------------------------------------------------------------------su - oraclesrvctl disable db -d plandbsrvctl stop db -d plandb-------------------------------------------------------------------------------------------------------------------------3.(该步骤已经提前执行完成)以root用户替换opatch工具到最新版本-------------------------------------------------------------------------------------------------------------------------su - rootcat /home/oracle/.profile | grep HOMEexport PATCH_DIR=/oracle/softwareexport PATCH_GRID_HOME=/grid/app/11.2.0.4/gridexport PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1mv $PATCH_GRID_HOME/OPatch $PATCH_GRID_HOME/Opatch.orig`date +%Y%m%d`mv $PATCH_ORACLE_HOME/OPatch $PATCH_ORACLE_HOME/OPatch.orig`date +%Y%m%d`cd $PATCH_DIRunzip p6880880_112000_Linux-x86-64.zipcp -r ./OPatch $PATCH_GRID_HOME/cp -r ./OPatch $PATCH_ORACLE_HOME/cd $PATCH_GRID_HOME/; chown -R grid:oinstall ./OPatchcd $PATCH_ORACLE_HOME/; chown -R oracle:oinstall ./OPatch###########################################################################################################################二 参考下面的步骤在一个节点上安装补丁26635745 (GI+DB),数据库完全停止后,可以在两个节点同时安装#########################################################################################################################-------------------------------------------------------------------------------------------------------------------------1.生成OCM.RSP 文件-------------------------------------------------------------------------------------------------------------------------su - oracleexport PATCH_DIR=/oracle/softwarecd $ORACLE_HOME/OPatch/ocm/bin./emocmrsp -output /tmp/ocm.rsp-------------------------------------------------------------------------------------------------------------------------2.减压补丁集,确认文件宿主和权限-------------------------------------------------------------------------------------------------------------------------su - grid
cd $PATCH_DIRunzip p p26636028_112040_Linux-x86-64.zipchown -R grid:oinstall 26636028chmod -R 775 26636028注意:确认解压文件权限是否满足当前-------------------------------------------------------------------------------------------------------------------------3.开始打补丁--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------a.检查root用户的环境变量,如果有ORACLE_HOME,ORA_GRID_HOME,GRID_HOME等设置,需要注销这些环境变量,然后重新登录系统;b.检查安装crs和db的文件系统空间是否足够,打补丁前至少要保证50G空闲空间;c.检查root/grid/oracle用户的crontab作业,打补丁前先注销访问$ORACLE_HOME和$GRID_HOME的作业,打完补丁后再启用d.查看是否有未注册到OCR里的grid/oracle独立进程,例如其他的listener,通过kill -9 杀掉这些进程;如果不确定哪些进程是独立的  ,可以考虑先停止CRS后再重新拉起来,然后执行后续的步骤-------------------------------------------------------------------------------------------------------------------------su - rootexport PATCH_DIR=/oracle/softwareexport PATCH_GRID_HOME=/grid/app/11.2.0.4/gridexport PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1exportPSU_PATCH_ID=26636028/26635745# $PATCH_GRID_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -oh $PATCH_GRID_HOME -ocmrf /tmp/ocm.rsp# $PATCH_ORACLE_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -oh $PATCH_ORACLE_HOME -ocmrf /tmp/ocm.rsp----------以下脚本用于补丁回滚操作----------######### $PATCH_GRID_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -rollback -oh $PATCH_GRID_HOME -ocmrf /tmp/ocm.rsp######### $PATCH_ORACLE_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -rollback -oh $PATCH_ORACLE_HOME -ocmrf /tmp/ocm.rspsu - grid$ORACLE_HOME/OPatch/opatch lsinvsu - oracle$ORACLE_HOME/OPatch/opatch lsinv###########################################################################################################################三 参考下面的步骤在一个节点上安装补丁26635834 (OJVM),数据库完全停止后,可以在两个节点同时安装(可以不打次补丁)#########################################################################################################################1.以oracle用户为$PATCH_ORACLE_HOME安装该补丁:su - oracle     export PATCH_DIR=/oracle/softwaresrvctl stop db -d plandbcd $PATCH_DIR/ 26636028/26635834$ORACLE_HOME/OPatch/opatch apply -local$ORACLE_HOME/OPatch/opatch lsinv###########################################################################################################################四 以下步骤必须在所有节点都完成上面的补丁的安装后再执行#########################################################################################################################1.补丁安装完后,以grid用户停止监听,然后以oracle用户登录其中一个节点启动数据库,运行数据字典脚本su - gridsrvctl disable listenersrvctl disable scan_listenersrvctl stop listenersrvctl stop scan_listenerlsnrctl stopsrvctl enable database -d plandbsu - oracle$GRID_HOME/bin/srvctl start instance -d plandb -n plandb01The following steps load RDBMSPSUmodified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.export ORACLE_SID=sqlplus /nologSQL> CONNECT / AS SYSDBASQL> STARTUPSQL> @?/rdbms/admin/catbundle.sqlpsuapplySQL> SELECT * FROM dba_registry_history;SQL> QUITIf the OJVMPSUwas applied for a previous GIPSUpatch, you may see invalid Java classes after execution of the catbundle.sql script in the previous step. If this is the case, run utlrp.sql to re-validate these Java classes.sqlplus /nologSQL> CONNECT / AS SYSDBASQL> @?/rdbms/admin/utlprp.sql 4Check the following log files in $ORACLE_BASE/cfgtoollogs/catbundle for any errors:catbundle_PSU__APPLY_.logcatbundle_PSU__GENERATE_.log###This patch now includes the OJVM Mitigation patch (Patch:19721304). ###If an OJVMPSUis installed or planned to be installed, no further actions are necessary. ###Otherwise, the workaround of using the OJVM Mitigation patch can be activated. ###As SYSDBA do the following from the admin directory:###SQL > @dbmsjdev.sql###SQL > exec dbms_java_dev.disable###1.Install the SQL portion of the patch by running the following command for a single instance environment.######sqlplus /nolog###SQL> CONNECT / AS SYSDBA###SQL> shutdown immediate###SQL> startup upgrade###SQL> @?/sqlpatch/26635834/postinstall.sql###SQL> shutdown###SQL> startup###########################################################################################################################五 以下步骤必须在所有节点都完成上面的4个补丁的安装后再执行(如果OJVM 补丁打了,需要执行下列脚本)#########################################################################################################################1.The following steps load modified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.    Install the SQL portion of the patch by running the following command for a single instance environment.    cd $ORACLE_HOME/sqlpatch/26635834    sqlplus /nolog    SQL> CONNECT / AS SYSDBA    SQL> startup upgrade    SQL> @postinstall.sql    SQL> shutdown    SQL> startup    For an Oracle RAC environment, reload the packages on one of the nodes using the following commands. Make sure no other instance of the database is up on the remote nodes.    cd $ORACLE_HOME/sqlpatch/26635834    sqlplus /nolog    SQL> CONNECT / AS SYSDBA    SQL> STARTUP    SQL> alter system set cluster_database=false scope=spfile;    SQL> SHUTDOWN    SQL> STARTUP UPGRADE    SQL> @postinstall.sql    SQL> alter system set cluster_database=true scope=spfile;    SQL> SHUTDOWN    SQL> STARTUP     After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.    cd $ORACLE_HOME/rdbms/admin    sqlplus /nolog    SQL> CONNECT / AS SYSDBA    SQL> @utlrp.sql2.After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.sqlplus /nologSQL> CONNECT / AS SYSDBASQL> @?/rdbms/admin/utlprp.sql 4###########################################################################################################################六 校验DB 补丁是否完成,恢复相关服务自启动属性及相关jobs等#########################################################################################################################SQL> set lin 170 pages 10000SQL> select comp_id,status,version from dba_registry;SQL> SELECT * FROM dba_registry_history;SQL> shutdown immediate;3. 以oracle用户重新enable数据库的自动启动,并启动数据库su - oraclesrvctl enable db -d plandbsrvctl start db -d plandb4. 以oracle用户重新enable之前被disabled的AutoTask,如果某个AutoTask最初的状态就是disabled,则保持最初状态,无需enablesu - oraclesqlplus "/as sysdba"COL CLIENT_NAME FORMAT A40COL CONSUMER_GROUP FORMAT A30COL WINDOW_GROUP FORMAT A30select CLIENT_NAME,STATUS,CONSUMER_GROUP,WINDOW_GROUP from dba_autotask_client;BEGINDBMS_AUTO_TASK_ADMIN.ENABLE('auto optimizer stats collection',null,null);END;/BEGINDBMS_AUTO_TASK_ADMIN.ENABLE('auto space advisor',null,null);END;/BEGINDBMS_AUTO_TASK_ADMIN.ENABLE('sql tuning advisor',null,null);END;/5. 以grid用户重新enable listener/scan_listener的自动启动,并启动这些监听su - gridsrvctl enable listenersrvctl enable scan_listenersrvctl start listenersrvctl start scan_listenerlsnrctl start###########################################################################################################################注意事项#########################################################################################################################如果启动数据库时遇到无法找到spfile,controlfile等读写权限问题,需要确认$RDBMS_HOME/bin/oracle文件的属主是否是oracle:oinstall,如果是,则执行如下步骤:su - rootcrsctl stop crssu - gridcd $ORACLE_HOME/bin./setasmgidwrap o=$PATCH_ORACLE_HOME/bin/oraclegrid@CRMTSTDB:[$PATCH_GRID_HOME/bin]ls -l $PATCH_GRID_HOME/bin/oracle-rwsr-s--x   1 grid       oinstall   222955304 May 11 17:20 $PATCH_GRID_HOME/bin/oracleoracle@CRMTSTDB:[/home/oracle]ls -l /oracle/app/oracle/11.2.0.4/bin/oracle-rwsr-s--x   1 oracle     asmadmin   246247856 May 11 17:47 /oracle/app/oracle/11.2.0.4/bin/oracle                                                参考内容###########################################################################################################################参考下面的步骤在一个节点上安装补丁23727132,数据库完全停止后,可以在两个节点同时安装 gi#########################################################################################################################1.为安装该补丁:su - root$PATCH_GRID_HOME/crs/install/rootcrs.pl -unlock su - gridcd $PATCH_DIRunzip p23727132_112040_Generic.zipcd $PATCH_DIR/23727132$ORACLE_HOME/OPatch/opatch apply -localsu - root$PATCH_GRID_HOME/crs/install/rootcrs.pl -patch  su - grid$ORACLE_HOME/OPatch/opatch lsinv###########################################################################################################################安装单个补丁参考下面的步骤在一个节点上安装补丁13904435,数据库完全停止后,可以在两个节点同时安装 db#########################################################################################################################1.为安装该补丁:su - root$PATCH_GRID_HOME/crs/install/rootcrs.pl -unlock su - gridcd $PATCH_DIRunzip p13904435_112046_HPUX-IA64.zipcd $PATCH_DIR/13904435$ORACLE_HOME/OPatch/opatch apply -localsu - oraclecd $PATCH_DIR/13904435$ORACLE_HOME/OPatch/opatch apply -localsu - root$PATCH_GRID_HOME/crs/install/rootcrs.pl -patch  su - grid$ORACLE_HOME/OPatch/opatch lsinvsu - oracle$ORACLE_HOME/OPatch/opatch lsinv###########################################################################################################################安装GI DB补丁分步骤#########################################################################################################################***********  Configuration Data  ************ It shows only those targets that will be patched in this session *rac_home=/oracle/app/oracle/11.2.0.4/db_1      owner=oracle      opatch_ver=11.2.0.3.17*********** Steps to be executed as owner unless specified as root ***********1: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_12: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_13: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_14: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_15: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl stop dbconsole6: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl stop agent7: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_18: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_19: /oracle/app/oracle/11.2.0.4/db_1/bin/srvctl stop home -o /oracle/app/oracle/11.2.0.4/db_1 -s /oracle/app/oracle/11.2.0.4/db_1/srvm/admin/stophome.txt -n plandb01 -f10: /oracle/software/26636028/26635745/26609929/custom/server/26609929/custom/scripts/prepatch.sh -dbhome /oracle/app/oracle/11.2.0.4/db_111: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch napply /oracle/software/26636028/26635745/26392168 -local -silent -ocmrf /tmp/ocm.rsp -oh /oracle/app/oracle/11.2.0.4/db_1 -invPtrLoc /oracle/app/oracle/11.2.0.4/db_1/oraInst.loc12: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch napply /oracle/software/26636028/26635745/26609929/custom/server/26609929 -local -silent -ocmrf /tmp/ocm.rsp -oh /oracle/app/oracle/11.2.0.4/db_1 -invPtrLoc /oracle/app/oracle/11.2.0.4/db_1/oraInst.loc13: /oracle/software/26636028/26635745/26609929/custom/server/26609929/custom/scripts/postpatch.sh -dbhome /oracle/app/oracle/11.2.0.4/db_114: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl start dbconsole15: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl start agent16: /oracle/app/oracle/11.2.0.4/db_1/bin/srvctl start home -o /oracle/app/oracle/11.2.0.4/db_1 -s /oracle/app/oracle/11.2.0.4/db_1/srvm/admin/stophome.txt -n plandb01***********  Configuration Data  ************ It shows only those targets that will be patched in this session ************ Steps to be executed as owner unless specified as root ***********1: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid2: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid3: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid4: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid5: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid6: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid7: /grid/app/11.2.0.4/grid/crs/install/rootcrs.pl -unlock : run as root8: /grid/app/11.2.0.4/grid/tfa/bin/tfactl stop : run as root9: /sbin/fuser -k /grid/app/11.2.0.4/grid/bin/crsctl.bin : run as root10: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid11: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid12: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid13: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/26392168 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc14: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/26609929 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc15: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/22502505 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc16: /grid/app/11.2.0.4/grid/bin/emctl start dbconsole17: /grid/app/11.2.0.4/grid/rdbms/install/rootadd_rdbms.sh : run as root18: /grid/app/11.2.0.4/grid/crs/install/rootcrs.pl -patch : run as root


0