一、准备工作
1,数据库环境
操作系统版本 : Redhat x64
数据库版本 : Oracle x64
Oracle database:
2,准备内容
OPatch : p6880880_122010_Linux-x86-
DB PSU : p24006101_121020_Linux-x86- 仅oracle12c单机使用。
二、更新OPatch
说明:更新database OPatch版本。
1. 更新OPatch版本,OPatch直接压缩替换就可以了。
(1) 上传p6880880_122010_Linux-x86-到/u01/software目录下,/u01/software给777权限。
(2) root用户下将原OPatch目录改名。
mv /u01/app/oracle/product//db_1/OPatch /u01/app/oracle/product//db_1/OPatchBK
2. oracle目录OPatch替换
(1) root用户
cd /u01/software/;chown oracle:oinstall p6880880_122010_Linux-x86-
(2) oracle用户
su - oracle
cd /u01/software/ ; unzip p6880880_122010_Linux-x86-
(3) root用户
cd /u01/software/; mv OPatch /u01/app/oracle/product//db_1/
(4) oracle用户测试
su - oracle
/u01/app/oracle/product//db_1/OPatch/opatch version
OPatch Version:
OPatch succeeded.
三、开始升级PSU
说明:
(1) 升级过程会自动关闭和启动集群。
(2) 先升级节点1 grid,再升级节点2 grid。
1. oracle用户下解压PSU补丁包
(1) root用户操作
cd /u01/software/;chown oracle:oinstall p24006101_121020_Linux-x86-
(2) oracle用户操作
# su - oracle
$ cd /u01/software/;unzip p24006101_121020_Linux-x86-
2. 测试兼容性,之前没有打过,这步也可以忽略。
su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/software/24006101 -oh $ORACLE_HOME
----------------------------------------------------
Oracle Interim Patch Installer version
Copyright (c) 2016,Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product//db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product//db_1/
OPatch version :
OUI version :
Log file location : /u01/app/oracle/product//db_1/cfgtoollogs/opatch/opatch2016-12-14_00-49-41AM_
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
----------------------------------------------------
四、打database PSU补丁
1. 关闭数据库
[oracle@test ~]$ sqlplus /nolog
sql*Plus: Release Production on Wed Dec 14 00:54:26 2016
Copyright (c) 1982,2014,Oracle. All rights reserved.
sql> conn / as sysdba;
Connected.
sql> show con_name
CON_NAME
------------------------------
CDB$ROOT
sql>
sql> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
sql>
sql> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sql> quit
2. oracle database打补丁
$ /u01/app/oracle/product//db_1/OPatch/opatch napply -oh $ORACLE_HOME -local /u01/software/24006101
--------------------------------------------------------------
Oracle Interim Patch Installer version
Copyright (c) 2016,Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product//db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product//db_1/
OPatch version :
OUI version :
Log file location : /u01/app/oracle/product//db_1/cfgtoollogs/opatch/opatch2016-12-14_00-57-47AM_
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 19769480 20299023 20831110 21359755 21948354 22291127 23054246 24006101
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//db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '19769480' to OH '/u01/app/oracle/product//db_1'
Patching component,...
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/crs/install/tfa_setup" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/crs/install/tfa_setup"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/rdbms/mesg/" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/rdbms/mesg/"
Skip copying to "/u01/app/oracle/product//db_1/rdbms/mesg/" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/rdbms/mesg/"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/lib/" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/lib/"
Skip copying to "/u01/app/oracle/product//db_1/lib/libccme_" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/lib/libccme_"
Skip copying to "/u01/app/oracle/product//db_1/lib/libccme_" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/lib/libccme_"
Skip copying to "/u01/app/oracle/product//db_1/lib/libccme_ecc_accel_" because it is the same as
the file in incoming patch "/u01/software/24006101/19769480/files/lib/libccme_ecc_accel_"
Patching component,...
Applying sub-patch '20299023' to OH '/u01/app/oracle/product//db_1'
ApplySession: Optional component(s) [,] not present in the Oracle Home or a higher version is found.
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/crs/install/tfa_setup" because it is the same as
the file in incoming patch "/u01/software/24006101/20299023/files/crs/install/tfa_setup"
Patching component,...
Applying sub-patch '20831110' to OH '/u01/app/oracle/product//db_1'
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/lib/libccme_ecc_accel_non_" because it is the same as
the file in incoming patch "/u01/software/24006101/20831110/files/lib/libccme_ecc_accel_non_"
Skip copying to "/u01/app/oracle/product//db_1/lib/libccme_ecc_non_" because it is the same as
the file in incoming patch "/u01/software/24006101/20831110/files/lib/libccme_ecc_non_"
Patching component,...
Applying sub-patch '21359755' to OH '/u01/app/oracle/product//db_1'
Patching component,...
Applying sub-patch '21948354' to OH '/u01/app/oracle/product//db_1'
Patching component,...
Applying sub-patch '22291127' to OH '/u01/app/oracle/product//db_1'
ApplySession: Optional component(s) [,...
Skip copying to "/u01/app/oracle/product//db_1/rdbms/admin/" because it is the same as
the file in incoming patch "/u01/software/24006101/22291127/files/rdbms/admin/"
Skip copying to "/u01/app/oracle/product//db_1/rdbms/admin/" because it is the same as
the file in incoming patch "/u01/software/24006101/22291127/files/rdbms/admin/"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/rdbms/admin/" because it is the same as
the file in incoming patch "/u01/software/24006101/22291127/files/rdbms/admin/"
Applying sub-patch '23054246' to OH '/u01/app/oracle/product//db_1'
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/lib/" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/lib/"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/bin/xmldiff" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xmldiff"
Skip copying to "/u01/app/oracle/product//db_1/bin/xvm" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xvm"
Skip copying to "/u01/app/oracle/product//db_1/bin/xmlpatch" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xmlpatch"
Skip copying to "/u01/app/oracle/product//db_1/bin/xsl" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xsl"
Skip copying to "/u01/app/oracle/product//db_1/bin/xmlcg" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xmlcg"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/bin/lxegen" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/lxegen"
Skip copying to "/u01/app/oracle/product//db_1/bin/lcsscan" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/lcsscan"
Skip copying to "/u01/app/oracle/product//db_1/bin/lxchknlb" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/lxchknlb"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/bin/xml" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/bin/xml"
Patching component,...
Skip copying to "/u01/app/oracle/product//db_1/lib/" because it is the same as
the file in incoming patch "/u01/software/24006101/23054246/files/lib/"
Applying sub-patch '24006101' to OH '/u01/app/oracle/product//db_1'
Patching component,...
OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
/bin/ld: warning: libstdc++,needed by /u01/app/oracle/product//db_1/ctx/lib//libsc_,not found (try using -rpath or -rpath-link)
Composite patch 24006101 successfully applied.
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product//db_1/cfgtoollogs/opatch/opatch2016-12-14_00-57-47AM_
OPatch completed with warnings.
--------------------------------------------------------------
注:上面/bin/ld: warning: libstdc++.so.报错,缺少compat-libstdc++-33包,并且安装光盘中没有,需要采用yum方式安装。
3. 检查打补丁情况
[root@test ~]# su - oracle
[oracle@test ~]$ $ORACLE_HOME/OPatch/opatch lsinv
Oracle Interim Patch Installer version
Copyright (c) 2016,Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product//db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product//db_1/
OPatch version :
OUI version :
Log file location : /u01/app/oracle/product//db_1/cfgtoollogs/opatch/opatch2016-12-14_01-13-15AM_
Lsinventory Output file location : /u01/app/oracle/product//db_1/cfgtoollogs/opatch/lsinv/lsinventory2016-12-14_01-13-
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: test
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch 24006101 : applied on Wed Dec 14 00:58:42 CST 2016
Unique Patch ID: 20683584
Patch description: "Database Patch Set Update : (24006101)"
Created on 1 Oct 2016,12:33:50 hrs PST8PDT
Sub-patch 23054246; "Database Patch Set Update : (23054246)"
Sub-patch 22291127; "Database Patch Set Update : (22291127)"
Sub-patch 21948354; "Database Patch Set Update : (21948354)"
Sub-patch 21359755; "Database Patch Set Update : (21359755)"
Sub-patch 20831110; "Database Patch Set Update : (20831110)"
Sub-patch 20299023; "Database Patch Set Update : (20299023)"
Sub-patch 19769480; "Database Patch Set Update : (19769480)"
Bugs fixed:
21099555,22175564,19141838,22083366,20842388,20117253,19865345
19791273,19243521,20951038,19908836,21281532,19238590,24577566
21184223,19134173,20387265,19149990,21263635,18886413,17551063
22160989,22507210,19703301,19366375,19001390,18202441,20267166
19358317,19706965,18549238,19068970,18797519,22148226,20825533
19649152,19670108,18940497,18948177,18964978,19035573,19176326
20413820,19176223,20904530,20134339,19074147,20868862,18411216
21322887,22507234,20425790,18966843,21329301,19333670,19468991
20124446,19883092,19658708,19591608,19402853,20618595,21787056
22380919,21266085,17835294,19721304,19791377,19068610,22178855
22173980,20746251,20048359,20898391,19185876,20281121,20907061
6599380,19577410,22092979,20603378,19001359,19490948,21387964
20832516,17532734,19309466,19081128,20627866,20844426,21188532
18791688,21442094,20890311,20596234,18973548,21296029,19303936
19461270,21479753,20936905,20235511,21220620,18964939,19430401
22296366,21153266,19409212,22657942,20657441,19879746,19684504
20528052,19024808,20977794,18799993,20466322,18740837,19662635
20228093,19065556,20212067,19524384,17722075,20446883,18952989
16870214,19928926,19835133,21629064,20466628,24386767,19931709
19730508,18819908,23124895,19188927,20074391,20356733,14643995
19547370,19065677,21960504,21225209,20397490,18967382,19174430
21241829,19536415,19171086,22465352,22168163,19335438,20447445
18856999,20471920,19869255,21620471,18990693,17890099,18990023
20101006,21300341,20848335,21744290,20897759,21668627,19304354
19052488,20794034,23260854,18681056,20952966,19896336,18618122
20328248,20440930,18456643,19699191,19201867,22865673,18743542
20798891,20347562,22551446,19777862,19687159,21373076,19174942
20424899,21899588,18899974,20598042,19032777,19058490,22815955
19399918,19434529,21273804,19018447,22757364,18851894,19284031
19022470,18043064,20173897,22062026,20475845,17274537,19440586
16887946,22374754,17319928,20708701,17655240,16439813,19805359
19155797,20859910,19393542,22024071,17210525,21847223,19189525
21649497,19075256,22762046,22075064,19280225,18845653,20560611
19248799,21756699,18988834,20245930,18921743,18799063,20373598
20476175,19571367,20925795,19018206,20509482,20711718,20588502
18849537,19183343,21917884,19189317,19644859,19390567,19279273
20669434,16863642,22528741,19619732,18607546,20348653,19315691
19676905,20165574,17867700,20558005,20734332,19532017,20922010
19450314,22353346,20361671,20009833,22366558,20294666,18191823
19307662,19371175,19195895,20043616,19154375,18914624,20139391
21291274,19174521,19520602,19382851,21875360,19676012,19326908
20217801,20093776,21097043,21246723,21665897,19143550,20428621
19627012,14283239,19518079,18610915,18674024,18306996,19524158
19915271,20122715,20284155,20017509,19363645,19597439,21239530
19888853,20880215,21756677,19534363,19354335,19044962,19639483
22353199,22243719,22916353,20378086,21756661,21260431,22923409
20877664,19028800,20879889,19723336,19077215,21421886,19604659
19308965,19048007,18288842,19689979,21526048,19180770,19197175
19902195,20318889,19013183,19012119,20464614,19067244,21632821
19512341,19841800,20331945,19587324,24316947,19578350,19637186
18674047,19054077,20898997,19708632,21091431,19289642,20869721
19258504,17365043,19468347,21373473,16359751,19439759,19769480
19272708,19978542,20402832,19329654,19873610,23229229,21517440
13542050,19291380,21915719,19076343,19561643,19990037,19487147
18909599,20831538,18250893,19016730,16619249,18354830,21188584
19989009,17414008,20688221,20704450,20441797,19157754,18885870
21785691,21450666,18893947,18705806,22223463,16923858,18417036
20919320,20474192,22046677,19385656,19501299,20920911,20899461
21387128,21315084,18122373,20581111,19606174,18436647,19023822
19178851,19124589,19597583,18499088,19050649
--------------------------------------------------------------------------------
OPatch succeeded.
[oracle@test ~]$ $ORACLE_HOME/OPatch/opatch lspatches
24006101;Database Patch Set Update : (24006101)
OPatch succeeded.
五、注册PSU信息到数据库
1. 启动oracle数据库
sql> conn / as sysdba;
Connected to an idle instance.
sql> startup;
ORACLE instance started.
Total System Global Area 2499805184 bytes
Fixed Size 2927480 bytes
Variable Size 738198664 bytes
Database Buffers 1744830464 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
sql>
sql> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
sql>
sql>
如查没有配置pdb数据库开机自启动,可以执行如下命令启动pdb数据库。
sql> alter pluggable database all open;
Pluggable database altered.
sql>
2. 注册PSU到数据库
[root@db1 ~]# su - oracle
[oracle@test ~]$ cd /u01/app/oracle/product//db_1/OPatch
[oracle@test OPatch]$ ./datapatch -verbose
sql Patching tool version on Wed Dec 14 01:30:22 2016
Copyright (c) 2016,Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_9041_2016_12_14_01_30_22/sqlpatch_
Connecting to
Note: Datapatch will only apply or rollback sql fixes for PDBs
that are in an open state,no patches will be applied to closed PDBs.
Please refer to Note: Datapatch: Database 12c Post Patch sql Automation
(Doc ID )
Bootstrapping registry and package to current
Determining current
Current state of sql patches:
Bundle series PSU:
ID 161018 in the binary registry and not installed in any PDB
Adding patches to installation queue and performing prereq checks...
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED PDB1
Nothing to roll back
The following patches will be applied:
24006101 (Database Patch Set Update : (24006101))
Installing patches...
Patch installation complete. Total patches installed: 3
Validating logfiles...
Patch 24006101 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/24006101/20683584/24006101_apply_ORCL_CDBROOT_2016Dec14_01_31_ (no errors)
Patch 24006101 apply (pdb PDB$SEED): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/24006101/20683584/24006101_apply_ORCL_PDBSEED_2016Dec14_01_31_ (no errors)
Patch 24006101 apply (pdb PDB1): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/24006101/20683584/24006101_apply_ORCL_PDB1_2016Dec14_01_31_ (no errors)
sql Patching tool complete on Wed Dec 14 01:31:53 2016
[oracle@test OPatch]$
3. 查看数据库补丁记录
oracle12c(起采用dba_registry_sqlpatch如下方式查看数据库补丁记录)
$ sqlplus / as sysdba;
sql> set linesize 300
sql> col DESCRIPTION for a30
sql> col ACTION_TIME for a30
sql> select PATCH_ID,PATCH_UID,VERSION,ACTION,STATUS,ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch;
PATCH_ID PATCH_UID VERSION ACTION STATUS ACTION_TIME DESCRIPTION ---------- ---------- -------------------- --------------- --------------- ------------------------------ ------------------------------ 24006101 20683584 APPLY SUCCESS 14-DEC-16 AM Database Patch Set Update : (24006101) sql>