Oracle Database 19c Patch Update(단일 인스턴스 오라클 DB 19.3 에서 19.9로 RU Update)
1. 현재 사용중인 DB의 버전 및 구성 확인
아래 SQL을 통해 확인한다.
SQL> SET LINESIZE 200 SQL> COL NAME FOR A12 SQL> COL OPEN_MODE FOR A10 SQL> COL ACTION FOR A10 SQL> COL ACTION_TIME FOR A11 SQL> COL DESCRIPTION FOR A30 SQL> COL PATCH_TYPE FOR A10 SQL> COL SOURCE_VERSION FOR A15 SQL> COL TARGET_VERSION FOR A15 SQL> SELECT A.CON_ID 2 ,B.NAME 3 ,B.OPEN_MODE 4 ,TO_CHAR (A.ACTION_TIME, 'YYYYMMDD') ACTION_TIME 5 ,A.PATCH_ID 6 ,A.PATCH_TYPE 7 ,A.ACTION 8 ,A.DESCRIPTION 9 ,A.SOURCE_VERSION 10 ,A.TARGET_VERSION 11 FROM CDB_REGISTRY_SQLPATCH A, V$CONTAINERS B 12 WHERE a.con_id = B.CON_ID 13 ORDER BY CON_ID, PATCH_ID; CON_ID NAME OPEN_MODE ACTION_TIME PATCH_ID PATCH_TYPE ACTION DESCRIPTION SOURCE_VERSION TARGET_VERSION ---------- ------------ ---------- ----------- ---------- ---------- ---------- ------------------------------ --------------- --------------- 1 CDB$ROOT READ WRITE 20201126 29517242 RU APPLY Database Release Update : 19.3 19.1.0.0.0 19.3.0.0.0 .0.0.190416 (29517242) 3 MPKWANPDB READ WRITE 20201126 29517242 RU APPLY Database Release Update : 19.3 19.1.0.0.0 19.3.0.0.0 .0.0.190416 (29517242)
위와 같이 19.3 버전의 설치 바이너리로 설치된 것을 확인할 수 있다.
19.9 버전으로 RU Patch를 적용할 예정이다.
2. OPatch 버전 확인 및 Update
mpkwanem.localdomain@oracle:MPKWAN:/home/oracle> opatch version OPatch Version: 12.2.0.1.17 OPatch succeeded.
19.9 버전으로 Patch Update 하기 위해서는 opatch 버전을 12.2.0.1.19 이후 버전을 사용해야 한다.
opatch 버전을 Update 하기 이전에 DB 와 listener 를 내려준다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 26 14:50:34 2020 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 mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> lsnrctl LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-NOV-2020 14:59:54 Copyright (c) 1991, 2019, Oracle. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mpkwanem.localdomain)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 26-NOV-2020 13:17:22 Uptime 0 days 1 hr. 42 min. 34 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19.0.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/mpkwanem/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mpkwanem.localdomain)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully LSNRCTL> stop Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mpkwanem.localdomain)(PORT=1521))) The command completed successfully LSNRCTL> exit
아래와 같이 opatch 버전에 대해서 update를 진행해 준다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> mv OPatch OPatch_bak mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> unzip p6880880_200000_Linux-x86-64.zip ... ... inflating: OPatch/operr inflating: OPatch/opatchauto.cmd mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> opatch version OPatch Version: 12.2.0.1.23 OPatch succeeded.
3. Oracle Database binary Patch Update
다운 받은 패치를 unzip 한다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle> mv p31771877_190000_Linux-x86-64_19_9.zip $ORACLE_HOME/OPatch/ mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle> cd $ORACLE_HOME/OPatch mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch> unzip p31771877_190000_Linux-x86-64_19_9.zip ... ... inflating: 31771877/files/suptools/tfa/release/tfa_home/ext/tnt/lib/tnt.jar/oracle/rat/tfa/checker.class inflating: 31771877/files/suptools/tfa/release/tfa_home/ext/tnt/lib/tnt.jar/oracle/rat/tfa/autosr.class inflating: 31771877/files/suptools/tfa/release/tfa_home/ext/tnt/lib/tnt.jar/oracle/rat/tfa/toaster.class inflating: PatchSearch.xml mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch>
patch conflict 가 존재하는지 확인하기 위해 아래 명령어로 체크해 본다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch/31771877> opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2020, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/19.0.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0/db_1/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2020-11-26_15-05-49PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
위와 같이 passed 명령어를 통해 conflict가 없다는 것이 확인되면 패치를 진행한다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch/31771877> opatch apply Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2020, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/19.0.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0/db_1/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2020-11-26_15-08-35PM_1.log Verifying environment and performing prerequisite checks... OPatch continues with these patches: 31771877 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/19.0.0/db_1') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files... ... ... ... Patching component oracle.precomp.common, 19.0.0.0.0... Patching component oracle.precomp.lang, 19.0.0.0.0... Patching component oracle.jdk, 1.8.0.201.0... Patch 31771877 successfully applied. Sub-set patch [29517242] has become inactive due to the application of a super-set patch [31771877]. Please refer to Doc ID 2161861.1 for any possible further required actions. Log file location: /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2020-11-26_15-08-35PM_1.log OPatch succeeded.
4. Patch Update 후 작업 수행
Database 변경된 내용을 반영하는 sql 로딩 작업을 수행한다.
./datapatch -verbose 명령어를 통해 반영 작업을 수행한다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch/31771877> sqlplus /nolog SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 26 15:16:04 2020 Version 19.9.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. SQL> connect / as sysdba Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 3690986584 bytes Fixed Size 9141336 bytes Variable Size 754974720 bytes Database Buffers 2919235584 bytes Redo Buffers 7634944 bytes Database mounted. Database opened. SQL> alter pluggable database all open; Pluggable database altered. SQL> quit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.9.0.0.0 mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch/31771877> cd $ORACLE_HOME/OPatch mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch> ./datapatch -verbose SQL Patching tool version 19.9.0.0.0 Production on Thu Nov 26 15:17:30 2020 Copyright (c) 2012, 2020, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_20814_2020_11_26_15_17_31/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done 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 1585822.1) 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.9.0.0.0 Release_Update 200930183249: Installed PDB CDB$ROOT: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 26-NOV-20 01.23.25.383409 PM PDB MPKWANPDB: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 26-NOV-20 01.29.50.052110 PM PDB PDB$SEED: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 26-NOV-20 01.29.50.052110 PM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT MPKWANPDB No interim patches need to be rolled back Patch 31771877 (Database Release Update : 19.9.0.0.201020 (31771877)): Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.9.0.0.0 Release_Update 200930183249 No interim patches need to be applied For the following PDBs: PDB$SEED No interim patches need to be rolled back Patch 31771877 (Database Release Update : 19.9.0.0.201020 (31771877)): Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.9.0.0.0 Release_Update 200930183249 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 31771877 apply (pdb CDB$ROOT): WITH ERRORS (RETRYABLE) logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31771877/23869227/31771877_apply_MPKWAN_CDBROOT_2020Nov26_15_18_10.log (errors) -> Error at line 478: script rdbms/admin/standard.sql - ORA-00060: deadlock detected while waiting for resource Patch 31771877 apply (pdb MPKWANPDB): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31771877/23869227/31771877_apply_MPKWAN_MPKWANPDB_2020Nov26_15_26_39.log (no errors) Patch 31771877 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31771877/23869227/31771877_apply_MPKWAN_PDBSEED_2020Nov26_15_32_04.log (no errors) Adding patches to retry installation queue...done Retry installation queue: For the following PDBs: CDB$ROOT No interim patches need to be rolled back Patch 31771877 (Database Release Update : 19.9.0.0.201020 (31771877)): Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.9.0.0.0 Release_Update 200930183249 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 1 Validating logfiles...done Patch 31771877 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31771877/23869227/31771877_apply_MPKWAN_CDBROOT_2020Nov26_15_35_59.log (no errors) SQL Patching tool complete on Thu Nov 26 15:41:09 2020 mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch>
위 내용을 보면 "Patch 31771877 apply (pdb CDB$ROOT): WITH ERRORS (RETRYABLE)" 로 에러가 났음을 확인할 수 있다.
내용이 retryable 이라고 해서 아래에서 재수행되는 것을 확인할 수 있다.
또 완료 후 "$ORACLE_BASE/cfgtoollogs/sqlpatch/31771877" 디렉토리에서 로그 파일을 점검함으로써 작업 내용을 확인해 볼 수 있다.
위 작업까지 완료 후 invalid 된 object에 대해서 compile 하는 작업을 수행한다.
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/OPatch> cd $ORACLE_HOME/rdbms/admin mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/rdbms/admin> sqlplus /nolog SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 26 15:46:45 2020 Version 19.9.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. SQL> connect / as sysdba Connected. SQL> @utlrp.sql Session altered. TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UTLRP_BGN 2020-11-26 15:47:17 DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid DOC> objects in the database. Recompilation time is proportional to the DOC> number of invalid objects in the database, so this command may take DOC> a long time to execute on a database with a large number of invalid DOC> objects. DOC> DOC> Use the following queries to track recompilation progress: DOC> DOC> 1. Query returning the number of invalid objects remaining. This DOC> number should decrease with time. DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6); DOC> DOC> 2. Query returning the number of objects compiled so far. This number DOC> should increase with time. DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED; DOC> DOC> This script automatically chooses serial or parallel recompilation DOC> based on the number of CPUs available (parameter cpu_count) multiplied DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu). DOC> On RAC, this number is added across all RAC nodes. DOC> DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel DOC> recompilation. Jobs are created without instance affinity so that they DOC> can migrate across RAC nodes. Use the following queries to verify DOC> whether UTL_RECOMP jobs are being created and run correctly: DOC> DOC> 1. Query showing jobs created by UTL_RECOMP DOC> SELECT job_name FROM dba_scheduler_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC> DOC> 2. Query showing UTL_RECOMP jobs that are running DOC> SELECT job_name FROM dba_scheduler_running_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC># PL/SQL procedure successfully completed. TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UTLRP_END 2020-11-26 15:47:19 DOC> The following query reports the number of invalid objects. DOC> DOC> If the number is higher than expected, please examine the error DOC> messages reported with each object (using SHOW ERRORS) to see if they DOC> point to system misconfiguration or resource constraints that must be DOC> fixed before attempting to recompile these objects. DOC># OBJECTS WITH ERRORS ------------------- 0 DOC> The following query reports the number of exceptions caught during DOC> recompilation. If this number is non-zero, please query the error DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors DOC> are due to misconfiguration or resource constraints that must be DOC> fixed before objects can compile successfully. DOC> Note: Typical compilation errors (due to coding errors) are not DOC> logged into this table: they go into DBA_ERRORS instead. DOC># ERRORS DURING RECOMPILATION --------------------------- 0 Function created. PL/SQL procedure successfully completed. Function dropped. PL/SQL procedure successfully completed. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.9.0.0.0 mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1/rdbms/admin>
RMAN Catalog를 사용한다면 이 역시 아래와 같이 upgrade를 진행해야 한다.
rman catalog username/ password@alias RMAN> upgrade catalog;
5. patch update 정보 확인하기
mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 26 15:51:09 2020 Version 19.9.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.9.0.0.0 SQL> SET LINESIZE 200 SQL> COL NAME FOR A12 SQL> COL OPEN_MODE FOR A10 SQL> COL ACTION FOR A10 SQL> COL ACTION_TIME FOR A11 SQL> COL DESCRIPTION FOR A30 SQL> COL PATCH_TYPE FOR A10 SQL> COL SOURCE_VERSION FOR A15 SQL> COL TARGET_VERSION FOR A15 SQL> SELECT A.CON_ID 2 ,B.NAME 3 ,B.OPEN_MODE 4 ,TO_CHAR (A.ACTION_TIME, 'YYYYMMDD') ACTION_TIME 5 ,A.PATCH_ID 6 ,A.PATCH_TYPE 7 ,A.ACTION 8 ,A.DESCRIPTION 9 ,A.SOURCE_VERSION 10 ,A.TARGET_VERSION 11 FROM CDB_REGISTRY_SQLPATCH A, V$CONTAINERS B 12 WHERE a.con_id = B.CON_ID 13 ORDER BY CON_ID, PATCH_ID; CON_ID NAME OPEN_MODE ACTION_TIME PATCH_ID PATCH_TYPE ACTION DESCRIPTION SOURCE_VERSION TARGET_VERSION ---------- ------------ ---------- ----------- ---------- ---------- ---------- ------------------------------ --------------- --------------- 1 CDB$ROOT READ WRITE 20201126 29517242 RU APPLY Database Release Update : 19.3 19.1.0.0.0 19.3.0.0.0 .0.0.190416 (29517242) 1 CDB$ROOT READ WRITE 20201126 31771877 RU APPLY Database Release Update : 19.9 19.3.0.0.0 19.9.0.0.0 .0.0.201020 (31771877) 1 CDB$ROOT READ WRITE 20201126 31771877 RU APPLY Database Release Update : 19.9 19.3.0.0.0 19.9.0.0.0 .0.0.201020 (31771877) 3 MPKWANPDB READ WRITE 20201126 29517242 RU APPLY Database Release Update : 19.3 19.1.0.0.0 19.3.0.0.0 .0.0.190416 (29517242) CON_ID NAME OPEN_MODE ACTION_TIME PATCH_ID PATCH_TYPE ACTION DESCRIPTION SOURCE_VERSION TARGET_VERSION ---------- ------------ ---------- ----------- ---------- ---------- ---------- ------------------------------ --------------- --------------- 3 MPKWANPDB READ WRITE 20201126 31771877 RU APPLY Database Release Update : 19.9 19.3.0.0.0 19.9.0.0.0 .0.0.201020 (31771877) SQL> -- mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1> opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2020, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/19.0.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0/db_1/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2020-11-26_15-51-56PM_1.log Lsinventory Output file location : /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2020-11-26_15-51-56PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: mpkwanem.localdomain ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 19c 19.0.0.0.0 There are 1 products installed in this Oracle Home. Interim patches (2) : Patch 31771877 : applied on Thu Nov 26 15:11:28 KST 2020 Unique Patch ID: 23869227 Patch description: "Database Release Update : 19.9.0.0.201020 (31771877)" Created on 7 Oct 2020, 21:34:19 hrs PST8PDT Bugs fixed: 30150710, 31935717, 7391838, 8460502, 8476681, 14735102, 17428816 17468475, 19080742, 19697993, 20313356, 21374587, 21639146, 21888352 21965541, 22580355, 22729345, 22748979, 23294761, 23296836, 23606241 ... ... -------------------------------------------------------------------------------- OPatch succeeded. mpkwanem.localdomain@oracle:MPKWAN:/u01/app/oracle/product/19.0.0/db_1>