#ORACLE 12C ADG 之二 (12.2.0.1單實例打PSU+OJVM補丁)
#升级出现的问题(OPatch版本过低)
#步驟1 OPatch替换为最新版本
[oracle@DB196 ~]$ cd $ORACLE_HOME/OPatch
[oracle@DB196 OPatch]$
[oracle@DB196 OPatch]$ id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)
[oracle@DB196 OPatch]$
[oracle@DB196 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.6
[oracle@DB196 OPatch]$
#更新OPatch
[oracle@DB196 OPatch]$ cd ..
[oracle@DB196 db_1]$ pwd
[oracle@DB196 db_1]$ mv OPatch OPatch_BAK20180913
[oracle@DB196 db_1]$ unzip /u01/setup/p6880880_122010_Linux-x86-64.zip
#查询opatch版本
[oracle@DB196 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@DB196 OPatch]$ pwd
/u01/app/oracle/product/12.2.0/db_1/OPatch
[oracle@DB196 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.14
[oracle@DB196 OPatch]$ ./opatch lsinventory
OPatch version : 12.2.0.1.14
[oracle@DB196 OPatch]$
#步驟2 关闭数据库 关闭监听
[oracle@DB196 OPatch]$ lsnrctl stop
[oracle@DB196 OPatch]$
[oracle@DB196 OPatch]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> exit
[oracle@DB196 OPatch]$
#步驟3 解压缩升级包
[oracle@DB196 OPatch]$ cd /u01/setup
[oracle@DB196 setup]$ pwd
/u01/setup
[oracle@DB196 setup]$ unzip p27872031_122010_Linux-x86-64.zip
[oracle@DB196 setup]$ ls
28163133 p27872031_122010_Linux-x86-64.zip p6880880_122010_Linux-x86-64.zip PatchSearch.xml
#步驟4 补丁包检查
[oracle@DB196 setup]$ cd 27872031/
[oracle@DB196 27872031]$ pwd
/u01/setup/27872031
[oracle@DB196 27872031]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
[oracle@DB196 27872031]$
#步驟5 升级补丁
[oracle@DB196 27872031]$ $ORACLE_HOME/OPatch/opatch apply
OPatch continues with these patches: 27872031
Do you want to proceed? [y|n]
y
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
[oracle@DB196 27872031]$
#步驟6 查看Opatch升级版本
[oracle@DB196 27872031]$ cd $ORACLE_HOME/OPatch
[oracle@DB196 OPatch]$ pwd
/u01/app/oracle/product/12.2.0/db_1/OPatch
[oracle@DB196 OPatch]$ ./opatch lsinventory
Bugs fixed:
8480838, 14690846, 15931756, 17027695, 17533661, 17947871, 18521691
...
27502420, 27504770, 27534509, 27611612, 27997875, 28033429, 28099662
28188330
[oracle@DB196 OPatch]$
#步驟7 更新dba_registry_sqlpatch视图信息
[oracle@DB196 OPatch]$ sqlplus / as sysdba
SQL> startup
SQL> alter pluggable database all open;
SQL> exit
[oracle@DB197 OPatch]$
#更新dba_registry_sqlpatch
[oracle@DB196 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@DB196 OPatch]$
[oracle@DB196 OPatch]$ ./datapatch -verbose
查看dba_registry_sqlpatch视图
SQL> select VERSION,STATUS,ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch;
#Oracle 12.2 OJVM安装
#步驟8 查询opatch版本
[oracle@DB196 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@DB196 OPatch]$ pwd
/u01/app/oracle/product/12.2.0/db_1/OPatch
[oracle@DB196 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.14
[oracle@DB196 OPatch]$ ./opatch lspatches
27872031;Database Jan 2018 Release Update Revision : 12.2.0.1.180717 (27872031)
[oracle@DB196 setup]$ ls
27872031 p27872031_122010_Linux-x86-64.zip p27923353_122010_Linux-x86-64.zip p6880880_122010_Linux-x86-64.zip PatchSearch.xml
[oracle@DB196 setup]$ unzip p27923353_122010_Linux-x86-64.zip
[oracle@DB196 setup]$ cd 27923353/
#步驟9 关闭数据库,关闭监听
#安装补丁
[oracle@DB196 27923353]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.14
[oracle@DB196 27923353]$ $ORACLE_HOME/OPatch/opatch apply
OPatch continues with these patches: 27923353
Do you want to proceed? [y|n]
y
Is the local system ready for patching? [y|n]
y
Backing up files...
#步驟10 启动数据库,应用补丁
[oracle@DB196 27923353]$ sqlplus / as sysdba
SQL> startup upgrade
SQL> alter pluggable database all open upgrade;
SQL> exit
#步驟1 1 更新dba_registry_sqlpatch
[oracle@DB196 27923353]$ $ORACLE_HOME/OPatch/datapatch -verbose
Installing patches...
Patch installation complete. Total patches installed: 2
Validating logfiles...
Patch 27923353 apply (pdb CDB$ROOT): SUCCESS
[oracle@DB196 27923353]$
[oracle@DB196 27923353]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL>
SQL> startup
SQL> alter pluggable database all open;
SQL> exit
[oracle@DB196 27923353]$
#步驟1 2 检查补丁情况
[oracle@DB196 27923353]$ $ORACLE_HOME/OPatch/opatch lspatches
27923353;OJVM RELEASE UPDATE: 12.2.0.1.180717 (27923353)
27872031;Database Jan 2018 Release Update Revision : 12.2.0.1.180717 (27872031)
[oracle@DB196 27923353]$ lsnrctl start
SQL> select VERSION,STATUS,ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch;
====================================================
#步驟1 3 附件說明:
ku$_radm_fptm_view 錯誤處理(补丁前如发现此视图报错则如下方法处理)
sys下
alter type ku$_radm_fptm_t compile reuse settings;
alter view SYS.KU$_RADM_FPTM_VIEW compile;
=====================================================
Oracle打Patch报错Prerequisite check “CheckActiveFilesAndExecutables” failed.
ps -ef|grep ora
kill -9 spid
=====================================================
#如下存在如下错误则如下方法处理
[oracle@XAG138 28163133]$ $ORACLE_HOME/OPatch/opatch apply
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
UtilSession failed:
Prerequisite check "CheckSystemCommandAvailable" failed.
OPatch failed with error code 73
--------------------------------------------------------------------------------------------
[root@XAG138 ~]# yum search fuser
psmisc.x86_64 : Utilities for managing processes on your system
[root@XAG138 ~]# yum install -y psmisc
======================================================