#Oracle 12.2.0.1单实例打PSU补丁的过程
#升级出现的问题(OPatch版本过低)
#1.OPatch替换为最新版本
[oracle@XAG140 u02]$ cd $ORACLE_HOME/OPatch
[oracle@XAG140 OPatch]$ id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba),1003(oper)
[oracle@XAG140 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.6
#2.更新OPatch
[oracle@XAG140 OPatch]$ cd ..
[oracle@XAG140 db_1]$ pwd
/u02/app/oracle/product/12.2.0/db_1
[oracle@XAG140 db_1]$ mv OPatch OPatch_BAK20180913
[oracle@XAG140 db_1]$ unzip /home/oracle/setup/p6880880_122010_Linux-x86-64.zip
#查询opatch版本
[oracle@XAG140 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@XAG140 OPatch]$ pwd
/u02/app/oracle/product/12.2.0/db_1/OPatch
[oracle@XAG140 OPatch]$
[oracle@XAG140 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.14
[oracle@XAG140 OPatch]$
[oracle@XAG140 OPatch]$ ./opatch lsinventory
[oracle@XAG140 OPatch]$
#关闭数据库 关闭监听
#解压缩升级包
[oracle@XAG140 setup]$ unzip p28163133_122010_Linux-x86-64.zip
#升级补丁
##补丁包检查
[oracle@XAG140 setup]$ cd 28163133/
[oracle@XAG140 28163133]$ pwd
/home/oracle/setup/28163133
[oracle@XAG140 28163133]$
[oracle@XAG140 28163133]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
[oracle@XAG140 28163133]$ $ORACLE_HOME/OPatch/opatch apply
OPatch continues with these patches: 28163133
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
[oracle@XAG140 28163133]$
#查看Opatch升级版本
[oracle@XAG140 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@XAG140 OPatch]$ pwd
/u02/app/oracle/product/12.2.0/db_1/OPatch
[oracle@XAG140 OPatch]$ ./opatch lsinventory
OPatch version : 12.2.0.1.14
--------------------------------------------------------------------------------
Bugs fixed:
8480838, 13554903, 14690846, 15931756, 16002385, 16727454, 16942578
...
28033429, 28040776, 28099662, 28140658, 28184554, 28188330, 28174827
--------------------------------------------------------------------------------
[oracle@XAG140 OPatch]$
#更新dba_registry_sqlpatch视图信息
[oracle@XAG140 OPatch]$ sqlplus / as sysdba
#打开数据库
2)、打开数据库:
SQL> startup
SQL> alter pluggable database all open;
Pluggable database altered.
3)、更新dba_registry_sqlpatch
[oracle@single-instance OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@single-instance OPatch]$ ./datapatch -verbose
27105253 (DATABASE RELEASE UPDATE 12.2.0.1.180116)
Patch installation complete. Total patches installed: 3
Validating logfiles...
Patch 27105253 apply (pdb CDB$ROOT):SUCCESS
logfile:/u01/app/oracle/cfgtoollogs/sqlpatch/27105253/21862470/27105253_apply_ORCL_CDBROOT_2018Apr15_16_54_49.log(no errors)
SQL Patching tool complete on Sun Apr 1516:57:37 2018
查看dba_registry_sqlpatch视图
SQL> select VERSION,STATUS,ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch;
VERSION STATUS ACTION_TIME DESCRIPTION
---------- ---------------------------------------------------------------------------------------
12.2.0.1 SUCCESS 13-SEP-18 10.45.06.831323 PM DATABASE JUL 2018 RELEASE UPDATE 12.2.0.1.180717
=================================================================
#如下存在如下错误则如下方法处理
[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
================================================================
#Oracle 12.2 OJVM安装
#查询opatch版本
[oracle@XAG138 ~]$ cd $ORACLE_HOME/OPatch
[oracle@XAG138 OPatch]$ pwd
/u01/app/oracle/product/12.2.0/db_1/OPatch
[oracle@XAG138 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.14
[oracle@XAG138 OPatch]$
[oracle@XAG138 OPatch]$ ./opatch lspatches
28163133;Database Jul 2018 Release Update : 12.2.0.1.180717 (28163133)
[oracle@XAG138 OPatch]$
[oracle@XAG138 setup]$ unzip p27923353_122010_Linux-x86-64.zip
[oracle@XAG138 setup]$ cd 27923353/
[oracle@XAG138 27923353]$ pwd
/home/oracle/setup/27923353
#关闭数据库,关闭监听
#安装补丁
[oracle@XAG138 27923353]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.14
[oracle@XAG138 27923353]$ $ORACLE_HOME/OPatch/opatch apply
OPatch version : 12.2.0.1.14
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 27923353
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/12.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '27923353' to OH '/u01/app/oracle/product/12.2.0/db_1'
Patch 27923353 successfully applied.
[oracle@XAG138 27923353]$
#启动数据库,应用补丁
[oracle@XAG138 27923353]$ sqlplus / as sysdba
SQL> startup upgrade
SQL> alter pluggable database all open upgrade;
SQL> exit
[oracle@XAG138 27923353]$ $ORACLE_HOME/OPatch/datapatch -verbose
Patch 27923353 (OJVM RELEASE UPDATE: 12.2.0.1.180717 (27923353)):
Validating logfiles...
Patch 27923353 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/27923353/22237223/27923353_apply_XAG12C_CDBROOT_2018Sep14_23_48_38.log (no errors)
SQL Patching tool complete on Fri Sep 14 23:50:09 2018
[oracle@XAG138 27923353]$
[oracle@XAG138 27923353]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup
SQL> alter pluggable database all open;
SQL>
#检查补丁情况
SQL> select patch_id,action,status,BUNDLE_SERIES from dba_registry_sqlpatch;
PATCH_ID ACTION STATUS BUNDLE_SERIES
---------- --------------- -------------------------
28163133 APPLY SUCCESS DBRU
27923353 APPLY SUCCESS
[oracle@XAG138 27923353]$ $ORACLE_HOME/OPatch/opatch lspatches
27923353;OJVM RELEASE UPDATE: 12.2.0.1.180717 (27923353)
28163133;Database Jul 2018 Release Update : 12.2.0.1.180717 (28163133)
OPatch succeeded.
[oracle@XAG138 27923353]$