ORACLE 11.2.0.4 180116 PSU HP 安騰 11.31 安裝
0.為了避免安裝補丁運行數據字典腳本時與系統後臺作業沖突,查看AutoTask,如果有Enabled的,先Disable,打完補丁後再Enable.
su - oracle sqlplus "/as sysdba" set lin 180 pages 10000 COL CLIENT_NAME FORMAT A40 COL CONSUMER_GROUP FORMAT A30 COL WINDOW_GROUP FORMAT A30 select 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_OS auto space advisor DISABLED ORA$AUTOTASK_SPACE_GROUP ORA$AT_WGRP_SA sql tuning advisor DISABLED ORA$AUTOTASK_SQL_GROUP ORA$AT_WGRP_SQ BEGIN DBMS_AUTO_TASK_ADMIN.DISABLE( client_name => ‘auto optimizer stats collection‘, operation => NULL, window_name => NULL); END; / BEGIN DBMS_AUTO_TASK_ADMIN.DISABLE( client_name => ‘auto space advisor‘, operation => NULL, window_name => NULL); END; / BEGIN DBMS_AUTO_TASK_ADMIN.DISABLE( client_name => ‘sql tuning advisor‘, operation => NULL, window_name => NULL); END; /
再確認當前的數據庫組件狀態是否都正常,並記錄當前狀態:
set lin 170 pages 10000 select comp_id,status,version from dba_registry; COMP_ID STATUS VERSION ------------------------------ ---------------------- ------------------------------ OWB VALID 11.2.0.4.0 APEX VALID 3.2.1.00.12 EM VALID 11.2.0.4.0 AMD VALID 11.2.0.4.0 SDO VALID 11.2.0.4.0 ORDIM VALID 11.2.0.4.0 XDB VALID 11.2.0.4.0 CONTEXT VALID 11.2.0.4.0 EXF VALID 11.2.0.4.0 RUL VALID 11.2.0.4.0 OWM VALID 11.2.0.4.0 CATALOG VALID 11.2.0.4.0 CATPROC VALID 11.2.0.4.0 JAVAVM VALID 11.2.0.4.0 XML VALID 11.2.0.4.0 CATJAVA VALID 11.2.0.4.0 APS VALID 11.2.0.4.0 XOQ VALID 11.2.0.4.0 RAC VALID 11.2.0.4.0 19 rows selected.
1.以grid用戶停止listener,並kill數據庫會話進程
su - grid
srvctl stop listener
srvctl stop scan_listener
kill -9 `ps -ef|grep LOCAL=NO|grep -v grep|grep -iv ASM|awk ‘{print $2}‘`
2.以oracle用戶禁用db自動啟動,然後停止db
su - oracle
srvctl disable db -d pubdb
srvctl stop db -d pubdb
3.(該步驟已經提前執行完成)以root用戶替換opatch工具到最新版本
su - root cat /home/oracle/.profile | grep HOME export PATCH_DIR=/oracle/software export PATCH_GRID_HOME=/grid/app/11.2.0.4/grid export PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1 mv $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_DIR unzip p6880880_112000_HPUX-IA64.zip cp -r ./OPatch $PATCH_GRID_HOME/ cp -r ./OPatch $PATCH_ORACLE_HOME/ cd $PATCH_GRID_HOME/; chown -R grid:oinstall ./OPatch cd $PATCH_ORACLE_HOME/; chown -R oracle:oinstall ./OPatch
4.按照下面的步驟安裝補丁
su - oracle
export PATCH_DIR=/oracle/software
cd $ORACLE_HOME/OPatch/ocm/bin
./emocmrsp -output /tmp/ocm.rsp
cd $PATCH_DIR
unzip p27282436_112040_HPUX-IA64.zip
su - root
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 - root
export PATCH_DIR=/oracle/software
export PATCH_GRID_HOME=/grid/app/11.2.0.4/grid
export PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1
export PSU_PATCH_ID=27282436/27107360
# $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
報錯處理
Opatch version check failed for oracle home /grid/app/11.2.0.4/grid
Opatch version check failed
ERROR: update the opatch version for the failed homes and retry
UtilSession failed: IPMRWServices::verifyPatchStorageDirectory() cannot read or write to /grid/app/11.2.0.4/grid/.patch_storage
OPatch failed with error code 73
CRMAPP3#[/]#cd /grid/app/11.2.0.4/grid/
CRMAPP3#[/grid/app/11.2.0.4/grid]#mkdir .patch_storage
CRMAPP3#[/grid/app/11.2.0.4/grid]#chown grid:oinstall .patch_storage
----------以下腳本用於補丁回滾操作----------
######### $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.rsp
su - grid
$ORACLE_HOME/OPatch/opatch lsinv
su - oracle
$ORACLE_HOME/OPatch/opatch lsinv
ORACLE 11.2.0.4 180116 PSU HP 安騰 11.31 安裝