oracle打補丁回顧

to_be_Dba發表於2021-12-02

很久沒有進行oracle庫打補丁的操作了,今天操作起來有點兒生疏,記錄一下操作過程,加深印象。


 

2017 7 月開始, Oracle 對資料庫和 GI(Grid Infrastructure) 12.2 及之後版本的主動修補程式進行了更改。 Oracle 12.2 版本開始補丁不在使用 PSU SPU 的稱呼了, 取而代之的為 RU (Release Updates) RUR (Release Update Revisions)。

簡單理解:

RU的版本第三位為0,相當於新的小版本。如  DB RU 19.13.0.0.211019

RUR的版本第三位非0,是已有小版本的再更新。如  GI RUR 19.12.1.0.211019  GI RUR 19.11.2.0.211019

RU和RUR可以互相做補丁,約束條件是 補丁號2、3位之和大於已有版本號。


補丁分為三類,即DB、GI、OJVM,分別是資料庫、grid、java相關的補丁。操作方法有所區別,嚴格按照readme.html的內容,就不會出大問題。


工欲善其事必先利其器,正式打補丁前先要把傢伙更新一下, 需要先安裝 6880880 補丁。 地址:


從這裡找到對應的補丁集:Primary Note for Database Proactive Patch Program (Doc ID 888.1)。需要保證作業系統和位數不要選錯。

一定要把已知的問題和解決/規避方法好好讀讀


目標:單機oracle從19.3升級到19.12

$ mv p33210889_190000_Linux-x86-64.zip  $ORACLE_HOME

$ cd $ORACLE_HOME

$ unzip p33210889_190000_Linux-x86-64.zip

$ cd 33210889/

--衝突檢查:

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 12.2.0.1.28

Copyright (c) 2021, Oracle Corporation.  All rights reserved.


PREREQ session


Oracle Home       : /oracle/database/product/19.0.0/dbhome_1

Central Inventory : /oracle/oraInventory

   from           : /oracle/database/product/19.0.0/dbhome_1/oraInst.loc

OPatch version    : 12.2.0.1.28

OUI version       : 12.2.0.7.0

Log file location : /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-02-36PM_1.log


Invoking prereq "checkconflictagainstohwithdetail"


Prereq "checkConflictAgainstOHWithDetail" passed.


OPatch succeeded.

嘗試使用:

$ opatch apply

Oracle Interim Patch Installer version 12.2.0.1.28

Copyright (c) 2021, Oracle Corporation.  All rights reserved.



Oracle Home       : /oracle/database/product/19.0.0/dbhome_1

Central Inventory : /oracle/oraInventory

   from           : /oracle/database/product/19.0.0/dbhome_1/oraInst.loc

OPatch version    : 12.2.0.1.28

OUI version       : 12.2.0.7.0

Log file location : /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-03-21PM_1.log


Verifying environment and performing prerequisite checks...

Prerequisite check "CheckSystemCommandAvailable" failed.

The details are:

Missing command :fuser

UtilSession failed: 

Prerequisite check "CheckSystemCommandAvailable" failed.

Log file location: /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-03-21PM_1.log


OPatch failed with error code 73


安裝fuser包:

# yum search fuser

Loaded plugins: fastestmirror

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

Loading mirror speeds from cached hostfile

 * base: mirrors.bupt.edu.cn

 * extras: mirrors.bfsu.edu.cn

 * updates: mirrors.bupt.edu.cn

============================================================================= Matched: fuser ==============================================================================

psmisc.x86_64 : Utilities for managing processes on your system

# yum install psmisc.x86_64

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.bupt.edu.cn

 * extras: mirrors.bfsu.edu.cn

 * updates: mirrors.bupt.edu.cn

base                                                                                                                                                | 3.6 kB  00:00:00     

extras                                                                                                                                              | 2.9 kB  00:00:00     

updates                                                                                                                                             | 2.9 kB  00:00:00     

(1/4): extras/7/x86_64/primary_db                                                                                                                   | 243 kB  00:00:00     

(2/4): base/7/x86_64/primary_db                                                                                                                     | 6.1 MB  00:00:00     

(3/4): base/7/x86_64/group_gz                                                                                                                       | 153 kB  00:00:01     

(4/4): updates/7/x86_64/primary_db                                                                                                                  |  12 MB  00:00:03     

Resolving Dependencies

--> Running transaction check

---> Package psmisc.x86_64 0:22.20-17.el7 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


===========================================================================================================================================================================

 Package                                 Arch                                    Version                                       Repository                             Size

===========================================================================================================================================================================

Installing:

 psmisc                                  x86_64                                  22.20-17.el7                                  base                                  141 k


Transaction Summary

===========================================================================================================================================================================

Install  1 Package


Total download size: 141 k

Installed size: 475 k

Is this ok [y/d/N]: y

Downloading packages:

psmisc-22.20-17.el7.x86_64.rpm                                                                                                                      | 141 kB  00:00:00     

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : psmisc-22.20-17.el7.x86_64                                                                                                                              1/1 

  Verifying  : psmisc-22.20-17.el7.x86_64                                                                                                                              1/1 


Installed:

  psmisc.x86_64 0:22.20-17.el7                                                                                                                                             


Complete!

# su - oracle

Last login: Wed Dec  1 16:07:44 CST 2021 on pts/0

$ cd $ORACLE_HOME/33210889/

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 12.2.0.1.28

Copyright (c) 2021, Oracle Corporation.  All rights reserved.


PREREQ session


Oracle Home       : /oracle/database/product/19.0.0/dbhome_1

Central Inventory : /oracle/oraInventory

   from           : /oracle/database/product/19.0.0/dbhome_1/oraInst.loc

OPatch version    : 12.2.0.1.28

OUI version       : 12.2.0.7.0

Log file location : /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-10-07PM_1.log


Invoking prereq "checkconflictagainstohwithdetail"


Prereq "checkConflictAgainstOHWithDetail" passed.


OPatch succeeded.

--重新應用opatch

$ opatch apply

Oracle Interim Patch Installer version 12.2.0.1.28

Copyright (c) 2021, Oracle Corporation.  All rights reserved.



Oracle Home       : /oracle/database/product/19.0.0/dbhome_1

Central Inventory : /oracle/oraInventory

   from           : /oracle/database/product/19.0.0/dbhome_1/oraInst.loc

OPatch version    : 12.2.0.1.28

OUI version       : 12.2.0.7.0

Log file location : /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-10-36PM_1.log


Verifying environment and performing prerequisite checks...

Prerequisite check "CheckActiveFilesAndExecutables" failed.

The details are:



Following active executables are not used by opatch process :



/oracle/database/product/19.0.0/dbhome_1/bin/oracle



Following active executables are used by opatch process :

/oracle/database/product/19.0.0/dbhome_1/lib/libclntsh.so.19.1

/oracle/database/product/19.0.0/dbhome_1/lib/libasmclntsh19.so


/oracle/database/product/19.0.0/dbhome_1/bin/tnslsnr

UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.

Log file location: /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-10-36PM_1.log



對應日誌中看到,是因為oracle和監聽都啟動著導致的。

[16:13:07][Dec 1, 2021 4:11:04 PM] [INFO]     Prerequisite check "CheckActiveFilesAndExecutables" failed.

[16:13:07]                                    The details are:

[16:13:07]                                    

[16:13:07]                                    

[16:13:07]                                    Following active executables are not used by opatch process :

[16:13:07]                                    

[16:13:07]                                    

[16:13:07]                                    /oracle/database/product/19.0.0/dbhome_1/bin/oracle

[16:13:07]                                    

[16:13:07]                                    

[16:13:07]                                    Following active executables are used by opatch process :

[16:13:15]                                    /oracle/database/product/19.0.0/dbhome_1/lib/libclntsh.so.19.1

[16:13:15]                                    /oracle/database/product/19.0.0/dbhome_1/lib/libasmclntsh19.so




關庫、停監聽後,正常執行:

$ opatch apply

Oracle Interim Patch Installer version 12.2.0.1.28

Copyright (c) 2021, Oracle Corporation.  All rights reserved.



Oracle Home       : /oracle/database/product/19.0.0/dbhome_1

Central Inventory : /oracle/oraInventory

   from           : /oracle/database/product/19.0.0/dbhome_1/oraInst.loc

OPatch version    : 12.2.0.1.28

OUI version       : 12.2.0.7.0

Log file location : /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-18-11PM_1.log


Verifying environment and performing prerequisite checks...

OPatch continues with these patches:   33210889  


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 = '/oracle/database/product/19.0.0/dbhome_1')



Is the local system ready for patching? [y|n]

y

User Responded with: Y

Backing up files...

Applying interim patch '33210889' to OH '/oracle/database/product/19.0.0/dbhome_1'

ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ]  not present in the Oracle Home or a higher version is found.




Patching component oracle.perlint, 5.28.1.0.0...


Patching component oracle.rdbms.locator, 19.0.0.0.0...


Patching component oracle.perlint.modules, 5.28.1.0.0...


Patching component oracle.rdbms, 19.0.0.0.0...



Patching component oracle.rdbms.util, 19.0.0.0.0...


Patching component oracle.rdbms.rsf, 19.0.0.0.0...


Patching component oracle.assistants.acf, 19.0.0.0.0...


……


Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...


Patching component oracle.sqlplus, 19.0.0.0.0...


Copy failed from '/oracle/database/product/19.0.0/dbhome_1/33210889/files/sqlplus/admin/help/helpus.sql' to '/oracle/database/product/19.0.0/dbhome_1/sqlplus/admin/help/helpus.sql'...  

Please verify all applications associated with the Oracle Home '/oracle/database/product/19.0.0/dbhome_1' are shut down. If this is AIX, please perform solution documented in Note 739963.1 on


Do you want to retry copying the file? [y|n]

Could not recognize input. Please re-enter.


Could not recognize input. Please re-enter.

y

User Responded with: Y


……


Patching component oracle.jdk, 1.8.0.201.0...


The following actions have failed:

Copy failed from '/oracle/database/product/19.0.0/dbhome_1/33210889/files/sqlplus/admin/help/helpus.sql' to '/oracle/database/product/19.0.0/dbhome_1/sqlplus/admin/help/helpus.sql'... 



Do you want to proceed? [y|n]y

User Responded with: Y

Patch 33210889 successfully applied.

Sub-set patch [29517242] has become inactive due to the application of a super-set patch [33210889].

Please refer to Doc ID 2161861.1 for any possible further required actions.

OPatch Session completed with warnings.

Log file location: /oracle/database/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-12-01_16-18-11PM_1.log


OPatch completed with warnings.



warning是由於help資訊缺失導致的,可以忽略。



啟動資料庫,然後執行:

$ ./datapatch -verbose

SQL Patching tool version 19.12.1.0.0 Production on Wed Dec  1 16:25:54 2021

Copyright (c) 2012, 2021, Oracle.  All rights reserved.


Log file for this invocation: /oracle/database/cfgtoollogs/sqlpatch/sqlpatch_15771_2021_12_01_16_25_54/sqlpatch_invocation.log


Connecting to database...OK

Gathering database info...done

Bootstrapping registry and package to current versions...done

Determining current state...done


Current state of interim SQL patches:

  No interim patches found


Current state of release update SQL patches:

  Binary registry:

    19.12.1.0.0 Release_Update_Revision 211013043447: Installed

  SQL registry:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 19-JUN-19 05.34.25.732019 PM


Adding patches to installation queue and performing prereq checks...done

Installation queue:

  No interim patches need to be rolled back

  Patch 33210889 (Database Release Update Revision : 19.12.1.0.211019 (33210889)):

    Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.12.1.0.0 Release_Update_Revision 211013043447

  No interim patches need to be applied


Installing patches...




Patch installation complete.  Total patches installed: 1


Validating logfiles...done

Patch 33210889 apply: SUCCESS

  logfile: /oracle/database/cfgtoollogs/sqlpatch/33210889/24463836/33210889_apply_ORCL_2021Dec01_16_26_38.log (no errors)

SQL Patching tool complete on Wed Dec  1 16:33:03 2021



$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/oracle/database/product/19.0.0/dbhome_1/rdbms/admin/utlrp_catcon_16787.lst]


catcon::set_log_file_base_path: catcon: See [/oracle/database/product/19.0.0/dbhome_1/rdbms/admin/utlrp*.log] files for output generated by scripts


catcon::set_log_file_base_path: catcon: See [/oracle/database/product/19.0.0/dbhome_1/rdbms/admin/utlrp_*.lst] files for spool files, if any


catcon.pl: completed successfully



按照readme.html檔案的步驟,還應該進行rman相關的升級,但由於這是一套測試庫,沒提供sys密碼,也確實不用rman,就省略了。

補丁操作到此完成。


有不合理的地方還請看到的各位同行拍磚~


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26451536/viewspace-2845255/,如需轉載,請註明出處,否則將追究法律責任。

相關文章