Oracle單實例升級補(bǔ)丁全過程記錄
1.當(dāng)前DB環(huán)境
[oracle@localhost ~]$ cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [oracle@localhost ~]$ uname -r 3.10.0-1160.el7.x86_64 [oracle@localhost ~]$ lsnrctl status LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-AUG-2023 05:39:02 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 12-JAN-2023 00:13:37 Uptime 208 days 4 hr. 25 min. 25 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19c/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "orcl" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Aug 8 05:40:12 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0
2.下載補(bǔ)丁包和opatch的升級包
要具有開源精神
opatch升級包:
https://dxz.jb51.net/202308/yuanma/OPatch_jb51.rar
19.18的補(bǔ)丁包
鏈接: https://pan.baidu.com/s/10GbaiIoXqQHDqd7Q2p1clg提取碼: bqdh
3.檢查OPatch的版本
更新opatch,根據(jù)README要求,opatch工具版本至少12.2.0.1.34 或更高版本
[oracle@localhost ~]$ cd $ORACLE_HOME [oracle@localhost db_1]$ cd OPatch/ [oracle@localhost OPatch]$ ./opatch version OPatch Version: 12.2.0.1.17 OPatch succeeded.
升級opatch版本
#備份OPatch [oracle@localhost ~]$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.bak #解壓到$ORACLE_HOME目錄下 [oracle@localhost ~]$ unzip p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME #查看升級后的opatch的版本 [oracle@localhost ~]$ cd $ORACLE_HOME [oracle@localhost db_1]$ cd OPatch/ [oracle@localhost OPatch]$ ./opatch version OPatch Version: 12.2.0.1.36 OPatch succeeded.
4.檢查補(bǔ)丁是否沖突
[oracle@localhost ~]$ unzip p34762026_190000_Linux-x86-64.zip [oracle@localhost ~]$ chown -R oracle:oinstall 34762026/ [oracle@localhost ~]$ chmod 775 -R 34762026/ #檢測沖突,依次檢測 [oracle@localhost ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph /home/oracle/34762026/33575402/ [oracle@localhost ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph /home/oracle/34762026/34765931/ [oracle@localhost ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph /home/oracle/34762026/34768559/ [oracle@localhost ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph /home/oracle/34762026/34768569/ [oracle@localhost ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph /home/oracle/34762026/34863894/ #出現(xiàn)以下字樣,檢測成功 Oracle Interim Patch Installer version 12.2.0.1.36 Copyright (c) 2023, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/19c/db_1 Central Inventory : /u01/oraInventory from : /u01/app/oracle/product/19c/db_1/oraInst.loc OPatch version : 12.2.0.1.36 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-08-08_06-47-50AM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
5.關(guān)閉數(shù)據(jù)庫實例,關(guān)閉監(jiān)聽
[oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Aug 8 06:53:08 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 [oracle@localhost ~]$ lsnrctl stop LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-AUG-2023 07:13:07 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) The command completed successfully
6.應(yīng)用patch
[oracle@localhost 34765931]$ pwd /home/oracle/34762026/34765931 [oracle@localhost 34765931]$ $ORACLE_HOME/OPatch/opatch apply Oracle Interim Patch Installer version 12.2.0.1.36 Copyright (c) 2023, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/19c/db_1 Central Inventory : /u01/oraInventory from : /u01/app/oracle/product/19c/db_1/oraInst.loc OPatch version : 12.2.0.1.36 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-08-08_07-19-09AM_1.log Verifying environment and performing prerequisite checks... ......
7.加載變化的SQL到數(shù)據(jù)庫
安裝補(bǔ)丁之后,還需要將有變化的SQL加載到數(shù)據(jù)庫中,這里可以直接運行Datapatch工具將這些修改的SQL重新加載到數(shù)據(jù)庫中,如果是RAC環(huán)境,只需要在一個節(jié)點執(zhí)行就可以了。
根據(jù)readme的說明,操作步驟如下:
sqlplus /nolog SQL> Connect / as sysdba SQL> startup SQL> alter pluggable database all open; SQL> quit cd $ORACLE_HOME/OPatch ./datapatch -verbose
8.ORACLE升級補(bǔ)丁查詢
1.查詢dba_server_registry視圖
SQL> select comp_name,version from dba_server_registry;
2.查詢dba_registry_history
SQL> select * from dba_registry_history;
3.查詢product_component_version視圖
SQL> select product,version from product_component_version;
4.查詢v$version視圖
SQL> select * from v$version;
到此這篇關(guān)于Oracle單實例升級補(bǔ)丁的文章就介紹到這了,更多相關(guān)Oracle單實例升級補(bǔ)丁內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Oracle數(shù)據(jù)庫如何創(chuàng)建第一張表
這篇文章主要介紹了Oracle數(shù)據(jù)庫如何創(chuàng)建第一張表,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-09-09oracle數(shù)據(jù)庫如何使用exp和imp命令導(dǎo)入導(dǎo)出數(shù)據(jù)
這篇文章主要給大家介紹了關(guān)于oracle數(shù)據(jù)庫如何使用exp和imp命令導(dǎo)入導(dǎo)出數(shù)據(jù)的相關(guān)資料,Oracle的EXP(Export)和 IMP(Import)是兩個非常重要的命令,它們用于數(shù)據(jù)庫的備份和恢復(fù),需要的朋友可以參考下2024-07-07Oracle自我補(bǔ)充之trunc()函數(shù)的使用方法
TRUNC函數(shù)為指定元素而截去的日期值。下面通過本文給大家介紹Oracle自我補(bǔ)充之trunc()函數(shù)的使用方法,感興趣的朋友一起看看吧2017-06-06oracle分區(qū)表創(chuàng)建(自動按年、月、日分區(qū))實戰(zhàn)記錄
Oracle的表分區(qū)功能通過改善可管理性、性能和可用性,從而為各式應(yīng)用程序帶來了極大的好處,下面這篇文章主要給大家介紹了關(guān)于oracle分區(qū)表創(chuàng)建(自動按年、月、日分區(qū))的相關(guān)資料,需要的朋友可以參考下2023-06-06oracle 9i使用閃回查詢恢復(fù)數(shù)據(jù)庫誤刪問題
本篇文章給大家介紹在oracle 9i中使用閃回查詢恢復(fù)數(shù)據(jù)庫誤刪問題,涉及到數(shù)據(jù)庫增刪改查的基本操作,對oracle數(shù)據(jù)庫閃回查詢感興趣的朋友可以一起學(xué)習(xí)下本篇文章2015-10-10Oracle聯(lián)機(jī)日志文件與歸檔文件詳細(xì)介紹
這篇文章主要介紹了Oracle聯(lián)機(jī)日志文件與歸檔文件,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧2022-11-11