数据库
首页 > 数据库> > Oracle-GIRU补丁升级

Oracle-GIRU补丁升级

作者:互联网

1. 环境信息

key value
操作系统

RHEL7.2

数据库版本12.2.0.1
GIRU26610291
实例数量4

2. 实施流程

1)检查当前数据库服务状态

2)上传补丁工具包

3)冲突检测

4)应用补丁

5) 更新数据字典

6)检查确认

3. 实施过程

3.1 检查数据库状态

su - grid
crsctl status res -t -init
crsctl status res -t

tail -100f $(orabase)/diag/asm/+ASM/trace/alert*.log

# 运行CVU检查
cd /ups/oracle/12.2/grid/ ./runcluvfy.sh stage -pre crsinst -n orc1,orc2 -fixup -verbose
su - oracle
tail -100f $(orabase)/diag/rdbms/$DB_NAME/$SID/trace/alert*.log

3.2 更新补丁工具--所有节点

# 更新OPatch工具
su - root
mv /ups/oracle/12.2/grid/OPatch /ups/oracle/12.2/grid/OPatch_20171010

cd /ups/soft
unzip p6880880_122010_Linux-x86-64.zip -d /ups/oracle/12.2/grid
chown -R grid:oinstall /ups/oracle/12.2/grid/OPatch
chmod -R +x /ups/oracle/12.2/grid/OPatch


su - oracle
cd /ups/soft
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_$(date +%Y%m%d)
unzip p6880880_122010_Linux-x86-64.zip -d /ups/oracle/database/product/12.2/db_1/

3.3 补丁冲突检测--所有节点

# 1. 解压RU补丁
su - grid
unzip p26610291_122010_Linux-x86-64.zip -d /ups/soft/

# 2. For Grid Infrastructure Home, as home user:
su - grid
 
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /ups/soft/26610291/26609817
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /ups/soft/26610291/26609966
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /ups/soft/26610291/25586399
 
# 3.For Database home, as home user:
su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /ups/soft/26610291/26609817
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /ups/soft/26610291/26609966

# 4. For Grid Infrastructure Home, as home user:
su - grid
cat >> /tmp/patch_list_gihome.txt << EOF
/ups/soft/26610291/25586399
/ups/soft/26610291/26609966
/ups/soft/26610291/26609817
EOF
 
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
 
# 5. For Database home, as home user:
su - oracle
cat >> /tmp/patch_list_dbhome.txt << EOF
/ups/soft/26610291/26609966
/ups/soft/26610291/26609817
EOF

# 6. 补丁应用分析-并不进行软件更新
su - root
. /home/grid/.bash_profile && export GI_HOME=${ORACLE_HOME} && export UNZIPPED_PATCH_LOCATION=/ups/soft
${GI_HOME}/OPatch/opatchauto apply ${UNZIPPED_PATCH_LOCATION}/26610291 -analyze
OR
${GI_HOME}/OPatch/opatchauto rollback ${UNZIPPED_PATCH_LOCATION}/26610291 -analyze


3.4 应用补丁--每个节点依次执行

su - root
# 1. Add the directory containing the opatchauto to the $PATH environment variable. For example:
export PATH=$PATH:/ups/oracle/12.2/grid/OPatch
# 2. To patch the GI home and all Oracle RAC database homes of the same version:
/ups/oracle/12.2/grid/OPatch/opatchauto apply /ups/soft/26610291
# 3. To patch only the GI home:
opatchauto apply <UNZIPPED_PATCH_LOCATION>/26610291 -oh <GI_HOME>
# 4. To patch one or more Oracle RAC database homes:
opatchauto apply <UNZIPPED_PATCH_LOCATION>/26610291 -oh <oracle_home1_path>,<oracle_home2_path>
# 5. To roll back the patch from the GI home and each Oracle RAC database home:
# opatchauto rollback <UNZIPPED_PATCH_LOCATION>/26610291
# 6. To roll back the patch from the GI home:
# opatchauto rollback <UNZIPPED_PATCH_LOCATION>/26610291 -oh <path to GI home>
# 7. To roll back the patch from the Oracle RAC database home:
# opatchauto rollback <UNZIPPED_PATCH_LOCATION>/26610291 -oh <oracle_home1_path>,<oracle_home2_path>

3.5 更新数据字典(待所有节点补丁更新完成后选一实例执行)

su - oracle
srvctl start instance -d orcl -i orcl1
sqlplus /nolog
connect / as sysdba
alter pluggable database all open instances=all; 
quit;

cd $ORACLE_HOME/OPatch
./datapatch -verbose

3.6 检查确认

# 检测字典更新情况
su - oracle
cd $ORACLE_BASE/cfgtoollogs/sqlpatch/26610291/<unique patch ID>
26610291_apply_<database SID>_<CDB name>_<timestamp>.log

# 检查数据库服务
su - grid
crsctl status res -t

# 检查补丁应用情况
su - grid
opatch lspatches

su - oracle
opatch lspatches


# 检查视图

sqlplus "/ as sysdba"
 set lines 168 pages 999
 col DESCRIPTION for a40
 col status for a10
 col version for a10
 select patch_id,PATCH_UID,STATUS,VERSION,BUNDLE_ID,to_char(ACTION_TIME,'yyyy-mm-dd hh24:mi:ss') ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch;
   PATCH_ID  PATCH_UID STATUS     VERSION       BUNDLE_ID ACTION_TIME         DESCRIPTION
 ---------- ---------- ---------- ------------ ---------- ------------------- ----------------------------------------
   26609817   21483023 SUCCESS    12.2.0.1         170814 2017-10-11 09:37:18 DATABASE RELEASE UPDATE 12.2.0.1.170814
  
 SQL>


4. 回滚步骤

# 回退软件补丁
su - root
<GI_HOME>/OPatch/opatchauto rollback <UNZIPPED_PATCH_LOCATION>/26610291

# 回退数据字典更新
su - oracle
sqlplus /nolog
connect / as sysdba
startup
alter pluggable database all open; 
quit;

cd $(orabasehome)/OPatch
./datapatch -verbose

# 若存在失效对象,执行脚本修复

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @?/rdbms/admin/utlrp.sql

标签:GIRU,补丁,OPatch,su,oracle,grid,Oracle,ups,26610291
来源: https://www.cnblogs.com/binliubiao/p/12607798.html