数据库升级&打补丁
1、数据库环境
操作系统版本:Centos Linux 7.6.1810
数据库版本:Oracle 11.2.0.3.0 x86_64 Sigle Instance
目标版本 :Oracle 11.2.0.4.8
2、环境准备
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
Opatch p6880880_112000_Linux-x86-64.zip
PSU p21352635_112040_Linux-x86-64.zip
3、数据库升级准备
A、在原环境安装11204软件————略
B、关闭数据库
sqlplus / as sysdba
Shu immediate;
C、修改oracle环境变量 ORACLE_BASE
、ORACLE_HOME
D、修改/etc/oratab
中ORACLE_HOME
E、复制原$ORACLE_HOME/dbs
下所有东西到新的$ORACLE_HOME/dbs
下
F、拷贝监听文件到新路径
4、升级前检查
sqlplus / as sysdba
startup upgrade;
@?/rdbms/admin/utlu112i.sql
5、修改第四步不满足项(如果没有此处略)
6、重启到mount阶段,创建回滚点
shu immediate;
startup mount;
alter database flashback on;
create restore point maclean_rollback guarantee flashback database;
7、再次升级模式打开数据库,执行升级前检查
sqlplus / as sysdba
startup upgrade;
@?/rdbms/admin/utlu112i.sql
8、执行升级操作
set echo on
spool /tmp/upgrade.log
set time on
@?/rdbms/admin/catupgrd.sql
以上脚本会执行一段时间 ,测试环境 执行了大概半个小时,之后会shu immediate
数据库 ,需要DBA
手动重启数据库。
9、运行utlrp.sql编译无效对象
sqlplus / as sysdba
startup;
@?/rdbms/admin/utlrp.sql
10、至此数据库升级完成,查看各组件版本号
select comp_name,status,version from dba_server_registry;
11、检查无效对象
select * from dba_objects where status !=‘VALID’;
no rows selected
12、根据补丁readme
You must use the OPatch utility version 11.2.0.3.6 or later to apply this patch. Oracle recommends that you use the latest released OPatch version for 11.2, which is available for download from My Oracle Support patch 6880880 by selecting the 11.2.0.0.0 release. For information about OPatch documentation, including any known issues, see My Oracle Support Document 293369.1 OPatch documentation list. 首先确认当前Opatch 版本
$ORACLE_HOME/OPatch/opatch version
Opatch version :11.2.0.3.4
Opatch succeeded.
需要先升级Opatch
unzip p6880880_112000_Linux-x86-64.zip $ORACLE_HOME
Archive:p6880880_112000_Linux-x86-64.zip
replace $ORACLE_HOME/OPatch/jlib/oracle.opatch.classpath.jar? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
再次查看Opatch版本
$ORACLE_HOME/OPatch/opatch version
Opatch version :11.2.0.3.25
Opatch succeeded.
13、解压PSU到指定路径,
unzip p21352635_112040_Linux-x86-64.zip -d /home/oracle
14、检查PSU是否与当前环境冲突
cd /home/oracle/21352635
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2020, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /home/11204/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oracle/product/11.2.0/dbhome_1/inventory
from : /home/11204/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /home/11204/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-09-09_11-12-05AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
15、关闭数据库各组件
lsnrctl stop
shu immediate;
emctl stop dbconsole(如果没装EM忽略此步骤)
16、开始升级
cd /home/oracle/21352635 —————补丁目录
$ORACLE_HOME/OPatch/opatch apply
下面是遇到的报错信息:百度后是因为缺少psmisc包 执行yum install -y psmisc 之后解决
[oracle@ccola 21352635]$ /home/11204/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch apply
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2020, Oracle Corporation. All rights reserved.
Oracle Home : /home/11204/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oracle/product/11.2.0/dbhome_1/inventory
from : /home/11204/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /home/11204/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-09-09_08-44-35AM_1.log
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
UtilSession failed:
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Log file location: /home/11204/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-09-09_08-44-35AM_1.log
OPatch failed with error code 73
17、应用补丁成功之后,执行catbundle.sql
将补丁信息反射到数据库中,使数据库知道你最后一次打了什么补丁或者回滚了哪些补丁
sqlplus / as sysdba
startup;
@?/rdbms/admin/catbundle.sql psu apply
18、完成后启动监听【EM】
lsnrctl start
emctl start dbconsole
19、查看升级后的版本
SQL>select action, comments from registry$history;
ACTION COMMENTS
-------------- ----------------
APPLY Patchset 11.2.0.2.0
APPLY Patchset 11.2.0.2.0
APPLY PSU 11.2.0.4.8
20、执行$ORACLE_HOME/OPatch/opatch lsinv
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2020, Oracle Corporation. All rights reserved.
Oracle Home : /home/11204/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oracle/product/11.2.0/dbhome_1/inventory
from : /home/11204/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /home/11204/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-09-09_11-41-47AM_1.log
Lsinventory Output file location : /home/11204/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2020-09-09_11-41-47AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: ccola
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch 21352635 : applied on Wed Sep 09 08:55:02 CST 2020
Unique Patch ID: 19227862
Patch description: "Database Patch Set Update : 11.2.0.4.8 (21352635)"
Created on 1 Sep 2015, 07:49:44 hrs
Sub-patch 20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"
Sub-patch 20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"
Sub-patch 19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)"
Sub-patch 19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Sub-patch 18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch 18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch 17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
Bugs fixed:
18619917, 19309466, 18384391, 16992075, 18189036, 13609098, 16285691
17025461, 18430495, 17323222, 16472716, 19289642, 19915271, 14458214
18331850, 17945983, 13498382, 16494615, 16901385, 21352646, 18673304
17610798, 18456514, 8322815, 18996843, 17313525, 20334344, 17050888
17174582, 18317531, 11733603, 17798953, 18260550, 14015842, 18031668
17390160, 18316692, 19458377, 14368995, 16065166, 12905058, 16855292
16579084, 21179898, 15990359, 13364795, 18235390, 18293054, 18673325
19393542, 20142975, 14657740, 17393683, 17389192, 16315398, 17783588
17852463, 17037130, 19358317, 17441661, 17284817, 14034426, 20631274
17891946, 17588480, 16731148, 17165204, 17891943, 18282562, 17265217
17465741, 18191164, 16721594, 18614015, 17348614, 19827973, 19769489
17346671, 18482502, 16043574, 17360606, 19211724, 19463893, 17477958
17040764, 18362222, 19463897, 17853456, 13853126, 18273830, 17816865
13558557, 17951233, 18180390, 17040527, 14692762, 17027426, 17851160
16870214, 18009564, 18202441, 20803583, 17622427, 16903536, 19006849
20506699, 17865671, 17883081, 16228604, 17761775, 16306373, 17325413
17082359, 12747740, 16091637, 19680952, 16850630, 17694209, 17468141
17877323, 18230522, 17446237, 17889549, 16042673, 17437634, 17571039
19049453, 19972570, 17016369, 16833527, 17297939, 16069901, 18522509
14285317, 19972569, 18436647, 19972568, 17716305, 19972566, 19972564
17394950, 17853498, 20657441, 16542886, 17006570, 17752995, 17296856
18051556, 12364061, 17546973, 18262334, 18783224, 19699191, 17227277
18018515, 16180763, 16943711, 17982555, 18098207, 18436307, 19584068
18339044, 17282229, 14054676, 18228645, 19013183, 18856999, 17721717
17239687, 18471685, 17258090, 16344544, 17344412, 17011832, 18135678
18704244, 17786518, 17242746, 19197175, 17390431, 17835627, 17672719
17393915, 16777840, 17811456, 18765602, 19730508, 17385178, 10136473
20296213, 13955826, 18193833, 17545847, 16837842, 18964939, 17811447
18554763, 20004087, 17889583, 12816846, 19544839, 18868646, 18747196
17042658, 17824637, 14106803, 16524926, 13951456, 17343514, 18139690
18277454, 19271443, 18681862, 17186905, 17811438, 18554871, 17215560
16875449, 17274537, 17602269, 17184721, 17762296, 14829250, 18508861
19466309, 16929165, 14602788, 17811429, 18441944, 17811789, 17754782
17752121, 20074391, 14852021, 17705023, 13645875, 17201159, 16668584
17786278, 16198143, 18828868, 17586955, 16692232, 17649265, 16384983
17957017, 19121551, 17570240, 17787259, 19788842, 18094246, 14338435
13944971, 17375354, 17156148, 17936109, 21538567, 18762750, 16450169
17478145, 18096714, 17238511, 17311728, 17648596, 18244962, 17308789
18674047, 14084247, 18280813, 17614227, 17006183, 18092127, 19727057
17205719, 20004021, 17922254, 13837378, 18084625, 17912217, 11883252
12982566, 14764829, 15861775, 17237521, 16934803, 17848897, 20925795
20441797, 19554106, 18199537, 16613964, 18334586, 17288409, 17341326
18091059, 17449815, 17299889, 15913355, 16399083, 21538485, 17546761
14565184, 18155762, 17614134, 16956380, 19854503, 14245531, 16194160
18325460, 15979965, 18247991, 16314254, 16912439, 17246576, 17655634
20067212, 18203835, 20506715, 18203838, 18973907, 18203837, 19615136
17587063, 18000422, 20506706, 18641451, 17397545, 16785708, 21051862
18641461, 17346091, 13829543, 16220077, 18061914, 20448824, 18674024
17596908, 17036973, 17612828, 17892268, 21051858, 21051852, 17767676
17232014, 17501491, 12611721, 14354737, 18356166, 17071721, 17835048
16863422, 21051840, 17267114, 17082983, 21538558, 18641419, 16392068
18744139, 16618694, 14133975, 18331812, 14010183, 16595641, 17080436
17332800, 20777150, 20299015, 18264060, 13866822, 21051833, 18673342
17600719, 17842825, 20558005, 17088068, 9756271, 18440047, 16571443
18328509, 20331945, 18384537, 18607546, 16422541, 18306996, 18315328
17443671, 17478514, 21067387, 16268425, 16360112, 17381384, 17726838
18723434, 17235750, 17571306, 17302277, 17551709, 17634921, 16538760
------------------------------------------------------------------------------- OPatch succeeded.