1.查看当前环境
[grid@asm01 ~]$ crsctl query has softwareversion
Oracle High Availability Services version on the local node is [19.0.0.0.0]
[grid@asm01 ~]$ crsctl query has releaseversion
Oracle High Availability Services release version on the local node is [19.0.0.0.0]
[grid@asm01 ~]$ crsctl check has
CRS-4638: Oracle High Availability Services is online
[grid@asm01 ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/OPatch/opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517247;ACFS RELEASE UPDATE 19.3.0.0.0 (29517247)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
29401763;TOMCAT RELEASE UPDATE 19.0.0.0.0 (29401763)
OPatch succeeded.
2.升级OPatch
https://www.cndba.cn/hbhe0316/article/106566
https://www.cndba.cn/hbhe0316/article/106566
[root@asm01 ~]# su - oracle
[oracle@asm01 ~]$ cd $ORACLE_HOME/OPatch/
[oracle@asm01 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.
[oracle@asm01 OPatch]$ cd $ORACLE_HOME
[oracle@asm01 dbhome_1]$ mv OPatch/ OPatchbak
[oracle@asm01 dbhome_1]$ unzip /tmp/p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
[oracle@asm01 dbhome_1]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/OPatch
[oracle@asm01 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.27
OPatch succeeded.
升级grid用户OPatch
[root@asm01 ~]# cd /u01/app/19.3.0/grid
[root@asm01 grid]# mv OPatch/ OPatchbak
[root@asm01 grid]# unzip /tmp/p6880880_190000_Linux-x86-64.zip
[root@asm01 grid]# chown -R grid.oinstall OPatch
[root@asm01 grid]# cd OPatch
[root@asm01 OPatch]# ./opatch version
OPatch Version: 12.2.0.1.27
OPatch succeeded.
3.验证Oracle Inventory的有效性https://www.cndba.cn/hbhe0316/article/106566https://www.cndba.cn/hbhe0316/article/106566
[grid@asm01 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@asm01 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
4.查看19.12 RU包
p33182768_190000_Linux-x86-64.zip为grid的升级包
p33192793_190000_Linux-x86-64.zip为oracle的升级包https://www.cndba.cn/hbhe0316/article/106566https://www.cndba.cn/hbhe0316/article/106566https://www.cndba.cn/hbhe0316/article/106566
[root@asm01 tmp]# chown -R grid.oinstall p33182768
5.检查Patch 是否冲突
https://www.cndba.cn/hbhe0316/article/106566
https://www.cndba.cn/hbhe0316/article/106566
[grid@asm01 tmp]$ cat /tmp/patch_list_gihome.txt
/tmp/33182768/32585572
/tmp/33182768/33192793
/tmp/33182768/33208107
/tmp/33182768/33208123
/tmp/33182768/33239955
[grid@asm01 tmp]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.27
Copyright (c) 2022, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/19.3.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/19.3.0/grid/oraInst.loc
OPatch version : 12.2.0.1.27
OUI version : 12.2.0.7.0
Log file location : /u01/app/19.3.0/grid/cfgtoollogs/opatch/opatch2022-01-14_10-00-30AM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
安装grid包
[root@asm01 OPatch]# ./opatchauto apply /tmp/33182768/ -oh /u01/app/19.3.0/grid
OPatchauto session is initiated at Fri Jan 14 10:04:14 2022
System initialization log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchautodb/systemconfig2022-01-14_10-04-21AM.log.
Session log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/opatchauto2022-01-14_10-04-27AM.log
The id for this session is JGSI
Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.3.0/grid
Patch applicability verified successfully on home /u01/app/19.3.0/grid
Executing patch validation checks on home /u01/app/19.3.0/grid
Patch validation checks successfully completed on home /u01/app/19.3.0/grid
Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19.3.0/grid
Prepatch operation log file location: /u01/app/grid/crsdata/asm01/crsconfig/hapatch_2022-01-14_10-05-27AM.log
CRS service brought down successfully on home /u01/app/19.3.0/grid
Start applying binary patch on home /u01/app/19.3.0/grid
Binary patch applied successfully on home /u01/app/19.3.0/grid
Performing postpatch operations on CRS - starting CRS service on home /u01/app/19.3.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/asm01/crsconfig/hapatch_2022-01-14_10-19-50AM.log
CRS service started successfully on home /u01/app/19.3.0/grid
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:asm01
SIHA Home:/u01/app/19.3.0/grid
Version:19.0.0.0.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /tmp/33182768/32585572
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_10-05-56AM_1.log
Patch: /tmp/33182768/33192793
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_10-05-56AM_1.log
Patch: /tmp/33182768/33208107
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_10-05-56AM_1.log
Patch: /tmp/33182768/33208123
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_10-05-56AM_1.log
Patch: /tmp/33182768/33239955
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_10-05-56AM_1.log
OPatchauto session completed at Fri Jan 14 10:21:08 2022
Time taken to complete the session 16 minutes, 55 seconds
[grid@asm01 ~]$ cd /u01/app/19.3.0/grid/OPatch
[grid@asm01 OPatch]$ ./opatch lspatches
33239955;TOMCAT RELEASE UPDATE 19.0.0.0.0 (33239955)
33208123;OCW RELEASE UPDATE 19.13.0.0.0 (33208123)
33208107;ACFS RELEASE UPDATE 19.13.0.0.0 (33208107)
33192793;Database Release Update : 19.13.0.0.211019 (33192793)
32585572;DBWLM RELEASE UPDATE 19.0.0.0.0 (32585572)
OPatch succeeded.
开始升级 DB RU (RELEASE UPDATE) 补丁
[root@asm01 ~]# cd /u01/app/oracle/product/19.3.0/dbhome_1/OPatch
[root@asm01 OPatch]# ./opatchauto apply /tmp/33192793 -oh /u01/app/oracle/product/19.3.0/dbhome_1/
OPatchauto session is initiated at Fri Jan 14 13:23:38 2022
System initialization log file is /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatchautodb/systemconfig2022-01-14_01-23-52PM.log.
Session log file is /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatchauto/opatchauto2022-01-14_01-24-01PM.log
The id for this session is YULE
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0/dbhome_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/dbhome_1
Executing patch validation checks on home /u01/app/oracle/product/19.3.0/dbhome_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0/dbhome_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0/dbhome_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/dbhome_1
Preparing to bring down database service on home /u01/app/oracle/product/19.3.0/dbhome_1
Successfully prepared home /u01/app/oracle/product/19.3.0/dbhome_1 to bring down database service
Bringing down database service on home /u01/app/oracle/product/19.3.0/dbhome_1
Database service successfully brought down on home /u01/app/oracle/product/19.3.0/dbhome_1
Start applying binary patch on home /u01/app/oracle/product/19.3.0/dbhome_1
Binary patch applied successfully on home /u01/app/oracle/product/19.3.0/dbhome_1
Starting database service on home /u01/app/oracle/product/19.3.0/dbhome_1
Database service successfully started on home /u01/app/oracle/product/19.3.0/dbhome_1
Preparing home /u01/app/oracle/product/19.3.0/dbhome_1 after database service restarted
No step execution required.........
Trying to apply SQL patch on home /u01/app/oracle/product/19.3.0/dbhome_1
SQL patch applied successfully on home /u01/app/oracle/product/19.3.0/dbhome_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:asm01
SIDB Home:/u01/app/oracle/product/19.3.0/dbhome_1
Version:19.0.0.0.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /tmp/33192793
Log: /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-14_13-25-17PM_1.log
Patching session reported following warning(s):
_________________________________________________
[WARNING] The database instance 'testdb' from '/u01/app/oracle/product/19.3.0/dbhome_1', in host'asm01' is not running. SQL changes, if any, will not be applied.
To apply. the SQL changes, bring up the database instance and run the command manually from any one node (run as oracle).
Refer to the readme to get the correct steps for applying the sql changes.
OPatchauto session completed at Fri Jan 14 13:39:01 2022
Time taken to complete the session 15 minutes, 25 seconds
更新数字字典https://www.cndba.cn/hbhe0316/article/106566
[root@asm01 OPatch]# su - oracle
s[oracle@asm01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jan 14 13:40:55 2022
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2516579048 bytes
Fixed Size 9138920 bytes
Variable Size 620756992 bytes
Database Buffers 1879048192 bytes
Redo Buffers 7634944 bytes
Database mounted.
Database opened.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 MOUNTED
SQL> alter session set container=pdb01;
Session altered.
SQL> alter pluggable database open;
Pluggable database altered.
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
[oracle@asm01 ~]$ cd $ORACLE_HOME/OPatch
[oracle@asm01 OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.13.0.0.0 Production on Fri Jan 14 13:43:46 2022
Copyright (c) 2012, 2021, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_7294_2022_01_14_13_43_46/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.13.0.0.0 Release_Update 211004165050: Installed
PDB CDB$ROOT:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 09-JAN-22 11.18.17.230073 PM
PDB PDB$SEED:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 09-JAN-22 11.28.22.707378 PM
PDB PDB01:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 09-JAN-22 11.28.22.707378 PM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED PDB01
No interim patches need to be rolled back
Patch 33192793 (Database Release Update : 19.13.0.0.211019 (33192793)):
Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.13.0.0.0 Release_Update 211004165050
No interim patches need to be applied
Installing patches...
Patch installation complete. Total patches installed: 3
Validating logfiles...done
Patch 33192793 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/33192793/24462514/33192793_apply_TESTDB_CDBROOT_2022Jan14_13_45_20.log (no errors)
Patch 33192793 apply (pdb PDB$SEED): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/33192793/24462514/33192793_apply_TESTDB_PDBSEED_2022Jan14_13_57_10.log (no errors)
Patch 33192793 apply (pdb PDB01): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/33192793/24462514/33192793_apply_TESTDB_PDB01_2022Jan14_13_57_10.log (no errors)
Automatic recompilation incomplete; run utlrp.sql to revalidate.
PDBs: PDB01 PDB$SEED
SQL Patching tool complete on Fri Jan 14 14:07:01 2022
[oracle@asm01 OPatch]$ cd $ORACLE_HOME/rdbms/admin
[oracle@asm01 admin]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jan 14 14:10:35 2022
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
SQL> @utlrp.sql
Session altered.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2022-01-14 14:11:05
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 2022-01-14 14:11:07
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.
版权声明:本文为博主原创文章,未经博主允许不得转载。
Linux,oracle