Disclaimer

Saturday 15 January 2022

Oracle 19c RAC 19.3 upgrade to 19.12

 

1. View the current environment

[grid@rac01 ~]$ crsctl query crs softwareversion
Oracle Clusterware version on node [rac01] is [19.0.0.0.0]
[grid@rac01 ~]$ crsctl query crs releaseversion
Oracle High Availability Services release version on the local node is [19.0.0.0.0]
[grid@rac01 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac01 ~]$ /u01/app/oracle/product/19.3.0/db_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. To upgrade OPatch, both sides nees to be upgraded 

[oracle@rac01 32545013]$ cd $ORACLE_HOME/OPatch/
[oracle@rac01 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.
[oracle@rac01 32545013]$ cd $ORACLE_HOME
[oracle@rac01 dbhome_1]$ mv OPatch/ OPatchbak 
[oracle@rac01 dbhome_1]$ unzip /tmp/p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
[oracle@rac01 OPatch]$ cd /u01/app/oracle/product/19.3.0/db_1/OPatch
[oracle@rac01 OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.27

OPatch succeeded.

[root@rac01 grid]# cd /u01/app/19.3.0/grid
[root@rac01 grid]# mv OPatch OPatchbak
[root@rac01 grid]# unzip /tmp/p6880880_190000_Linux-x86-64.zip
[root@rac01 grid]# chown -R grid.oinstall OPatch
[root@rac01 grid]# cd OPatch
[root@rac01 OPatch]# ./opatch version
OPatch Version: 12.2.0.1.27

OPatch succeeded.


3. Verify the validity of Oracle Inventory

[grid@rac01 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@rac01 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME


4. Check out the 19.12 RU package 

p32895426_190000_Linux-x86-64.zip is the upgrade package for grid p32904851_190000_Linux-x86-64.zip is the upgrade package for oracle

[root @rac01 tmp]# chown -R grid:oinstall 32895426
[

root @rac02 tmp]# chown -R grid:oinstall 32895426


5. Check for Patch Conflicts

[grid@rac01 ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/32904851/
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, 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.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/19.3.0/grid/cfgtoollogs/opatch/opatch2021-09-21_10-48-33AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

[oracle@rac01 tmp]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/32904851/
Oracle Interim Patch Installer version 12.2.0.1.27
Copyright (c) 2021, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/19.3.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.27
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatch/opatch2021-09-21_10-53-28AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.


[grid@rac01 tmp]$ cat /tmp/patch_list_gihome.txt
/tmp/32895426/32585572
/tmp/32895426/32904851
/tmp/32895426/32915586
/tmp/32895426/32916816
/tmp/32895426/32918050
[grid@rac01 32585572]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, 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.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/19.3.0/grid/cfgtoollogs/opatch/opatch2021-09-21_10-58-04AM_1.log

Invoking prereq "checksystemspace"


6. Analysis before Installation


[root@rac01 grid]# yum install -y psmisc
[root@rac01 ~]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /tmp/32895426/ -analyze

OPatchauto session is initiated at Tue Sep 21 12:40:11 2021

System initialization log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-09-21_12-40-18PM.log.

Session log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/opatchauto2021-09-21_12-40-48PM.log
The id for this session is SQ3G

Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.3.0/grid

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1

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


Executing patch validation checks on home /u01/app/oracle/product/19.3.0/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1

OPatchAuto successful.

--------------------------------Summary--------------------------------

Analysis for applying patches has completed successfully:

Host:rac01
RAC Home:/u01/app/oracle/product/19.3.0/db_1
Version:19.0.0.0.0


==Following patches were SKIPPED:

Patch: /tmp/32895426/32915586
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /tmp/32895426/32585572
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /tmp/32895426/32918050
Reason: This patch is not applicable to this specified target type - "rac_database"


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /tmp/32895426/32916816
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log

Patch: /tmp/32895426/32904851
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log


Host:rac01
CRS Home:/u01/app/19.3.0/grid
Version:19.0.0.0.0


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /tmp/32895426/32916816
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log

Patch: /tmp/32895426/32915586
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log

Patch: /tmp/32895426/32585572
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log

Patch: /tmp/32895426/32918050
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log

Patch: /tmp/32895426/32904851
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_12-41-16PM_1.log



OPatchauto session completed at Tue Sep 21 12:43:26 2021
Time taken to complete the session 3 minutes, 16 seconds


Prereq "checkSystemSpace" passed.

OPatch succeeded.


7. Execute the opatchauto tool to apply RU

Patch GI HOME:


(1) The upgrade process will automatically shut down and start the cluster.


(2) Upgrade node 1 grid first, and then upgrade node 2 grid.

[root@rac01 grid]# cd /u01/app/19.3.0/grid/OPatch
[root@rac01 OPatch]# ./opatchauto apply /tmp/32895426/ -oh /u01/app/19.3.0/grid

OPatchauto session is initiated at Tue Sep 21 14:26:05 2021

System initialization log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-09-21_02-26-15PM.log.

Session log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/opatchauto2021-09-21_02-26-32PM.log
The id for this session is 93CM

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/rac01/crsconfig/crs_prepatch_apply_inplace_rac01_2021-09-21_02-27-44PM.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/rac01/crsconfig/crs_postpatch_apply_inplace_rac01_2021-09-21_02-48-45PM.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:rac01
CRS Home:/u01/app/19.3.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SUCCESSFULLY applied:

Patch: /tmp/32895426/32585572
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_14-30-51PM_1.log

Patch: /tmp/32895426/32904851
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_14-30-51PM_1.log

Patch: /tmp/32895426/32915586
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_14-30-51PM_1.log

Patch: /tmp/32895426/32916816
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_14-30-51PM_1.log

Patch: /tmp/32895426/32918050
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_14-30-51PM_1.log



OPatchauto session completed at Tue Sep 21 14:54:40 2021
Time taken to complete the session 28 minutes, 35 seconds
[grid@rac01 ~]$ cd /u01/app/19.3.0/grid/OPatch
[grid@rac01 OPatch]$ ./opatch lspatches
32918050;TOMCAT RELEASE UPDATE 19.0.0.0.0 (32918050)
32916816;OCW RELEASE UPDATE 19.12.0.0.0 (32916816)
32915586;ACFS RELEASE UPDATE 19.12.0.0.0 (32915586)
32904851;Database Release Update : 19.12.0.0.210720 (32904851)
32585572;DBWLM RELEASE UPDATE 19.0.0.0.0 (32585572)

OPatch succeeded.


8. Start to upgrade DB RU (Release Update) Patch

Note: Since the GI RU includes the DB RU, this Patch can also be used when the DB is upgraded in the RAC environment.

Description: (both nodes need to be executed)


(1) The upgrade process will automatically shut down and start the cluster.


(2) Upgrade the node 1 database first, and then upgrade the node 2 database.


[root@rac01 OPatch]# cd /u01/app/oracle/product/19.3.0/db_1/OPatch
[root@rac01 OPatch]# ./opatchauto apply /tmp/32904851/ -oh /u01/app/oracle/product/19.3.0/db_1/

OPatchauto session is initiated at Tue Sep 21 15:35:34 2021

System initialization log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchautodb/systemconfig2021-09-21_03-35-47PM.log.

Session log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/opatchauto2021-09-21_03-36-39PM.log
The id for this session is E13M

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1


Executing patch validation checks on home /u01/app/oracle/product/19.3.0/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1


Preparing to bring down database service on home /u01/app/oracle/product/19.3.0/db_1
Successfully prepared home /u01/app/oracle/product/19.3.0/db_1 to bring down database service


Bringing down database service on home /u01/app/oracle/product/19.3.0/db_1
Database service successfully brought down on home /u01/app/oracle/product/19.3.0/db_1


Performing prepatch operation on home /u01/app/oracle/product/19.3.0/db_1
Perpatch operation completed successfully on home /u01/app/oracle/product/19.3.0/db_1


Start applying binary patch on home /u01/app/oracle/product/19.3.0/db_1
     Binary patch applied successfully on home /u01/app/oracle/product/19.3.0/db_1


Performing postpatch operation on home /u01/app/oracle/product/19.3.0/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19.3.0/db_1


Starting database service on home /u01/app/oracle/product/19.3.0/db_1
Database service successfully started on home /u01/app/oracle/product/19.3.0/db_1


Preparing home /u01/app/oracle/product/19.3.0/db_1 after database service restarted
No step execution required.........


Trying to apply SQL patch on home /u01/app/oracle/product/19.3.0/db_1
SQL patch applied successfully on home /u01/app/oracle/product/19.3.0/db_1

OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:rac01
RAC Home:/u01/app/oracle/product/19.3.0/db_1
Version:19.0.0.0.0
Summary:

==Following patches were SUCCESSFULLY applied:

Patch: /tmp/32904851
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_15-37-54PM_1.log


Patching session reported following warning(s): 
_________________________________________________

[WARNING] The database instance 'cxmtdb1' from '/u01/app/oracle/product/19.3.0/db_1', in host'rac01' 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 Tue Sep 21 16:05:12 2021
Time taken to complete the session 29 minutes, 39 seconds


[root@rac02 lib]# chmod g+w /u01/app/oraInventory/ContentsXML/oui-patch.xml
[root@rac02 lib]# cd /u01/app/oracle/product/19.3.0/db_1/inventory/
[root@rac02 inventory]# cp -r oneoffs/ oneoffs.bak
[root@rac02 inventory]# cd oneoffs
[root@rac02 oneoffs]# ls
29517242  29585399
[root@rac02 oneoffs]# rm -rf 295*
从 节点1 拷贝到 节点2: 将第一个节点的补丁oneoffs目录拷贝到第二个节点
[oracle@rac01 ~]$ cd /u01/app/oracle/product/19.3.0/db_1/inventory/
[oracle@rac01 inventory]$ cd oneoffs/
[oracle@rac01 oneoffs]$ ls
29517242  29585399  32904851
[oracle@rac01 oneoffs]$ scp -r * rac02:/u01/app/oracle/product/19.3.0/db_1/inventory/oneoffs
actions.xml                                                                                                                                                                                               100%   98KB  25.0MB/s   00:00    
inventory.xml                                                                                                                                                                                             100%   64KB  22.6MB/s   00:00    
actions.xml                                                                                                                                                                                               100%  347   417.0KB/s   00:00    
inventory.xml                                                                                                                                                                                             100%   18KB   8.1MB/s   00:00    
inventory.xml                                                                                                                                                                                             100%  646KB  67.3MB/s   00:00    
actions.xml 
[root@rac02 oneoffs]# cd /u01/app/oracle/product/19.3.0/db_1/OPatch
[root@rac02 OPatch]# ./opatchauto apply /tmp/32904851/ -oh /u01/app/oracle/product/19.3.0/db_1/

OPatchauto session is initiated at Tue Sep 21 17:56:32 2021

System initialization log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchautodb/systemconfig2021-09-21_05-56-36PM.log.

Session log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/opatchauto2021-09-21_05-56-58PM.log
The id for this session is BIV5

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1


Preparing to bring down database service on home /u01/app/oracle/product/19.3.0/db_1
Successfully prepared home /u01/app/oracle/product/19.3.0/db_1 to bring down database service


Bringing down database service on home /u01/app/oracle/product/19.3.0/db_1
No step execution required.........


Starting database service on home /u01/app/oracle/product/19.3.0/db_1
No step execution required.........


Preparing home /u01/app/oracle/product/19.3.0/db_1 after database service restarted
No step execution required.........

OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:rac02
RAC Home:/u01/app/oracle/product/19.3.0/db_1
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /tmp/32904851
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-09-21_17-57-21PM_1.log
Reason: /tmp/32904851 is not required to be applied to oracle home /u01/app/oracle/product/19.3.0/db_1



OPatchauto session completed at Tue Sep 21 17:58:25 2021
Time taken to complete the session 1 minute, 54 seconds
[oracle@rac02 OPatch]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 21 18:02:31 2021
Version 19.12.0.0.0

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

Connected to an idle instance.
SQL> quit
Disconnected


9.  Update the digital dictionary 

oracle $ /u01/app/oracle/product/19.3.0/db_1/OPatch/datapatch -verbose. 

==Note==: 

As mentioned above, the downtime is reduced by playing in sequence, but the downtime is still needed, which is the time to run the datapatch here. 

This step is to upgrade the data dictionary, for the data dictionary of the entire database, so it only needs to run on one node. 

The main thing to note is that if it is in cdb mode, you need to alter pluggable database all open, open all pdb, and then run datapatch.


[oracle@rac01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 21 18:05:31 2021
Version 19.12.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 2516581448 bytes
Fixed Size                  9141320 bytes
Variable Size            1124073472 bytes
Database Buffers         1375731712 bytes
Redo Buffers                7634944 bytes
Database mounted.
Database opened.
SQL>   alter session set container = hbhe;

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.12.0.0.0
[oracle@rac01 ~]$ cd $ORACLE_HOME/OPatch
[oracle@rac01 OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.12.0.0.0 Production on Tue Sep 21 18:46:40 2021
Copyright (c) 2012, 2021, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_11678_2021_09_21_18_46_40/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)

Warning: PDB HBHE is in mode MOUNTED and will be skipped.
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.0.0.0 Release_Update 210716141810: Installed
  PDB CDB$ROOT:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 20-SEP-21 12.41.09.423918 PM
  PDB PDB$SEED:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 20-SEP-21 12.55.30.682713 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    No interim patches need to be rolled back
    Patch 32904851 (Database Release Update : 19.12.0.0.210720 (32904851)):
      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.12.0.0.0 Release_Update 210716141810
    No interim patches need to be applied

Installing patches...
                          Patch installation complete.  Total patches installed: 2

Validating logfiles... done
Patch 32904851 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32904851/24343243/32904851_apply_CXMTDB_CDBROOT_2021Sep21_18_48_08.log (no errors)
Patch 32904851 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32904851/24343243/32904851_apply_CXMTDB_PDBSEED_2021Sep21_19_02_32.log (no errors)

Automatic recompilation incomplete; run utlrp.sql to revalidate.
  PDBs: PDB$SEED

SQL Patching tool complete on Tue Sep 21 19:15:57 2021


10.  Check the Invalid Objects

[oracle@rac01 OPatch]$ cd $ORACLE_HOME/rdbms/admin
[oracle@rac01 admin]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 21 19:17:14 2021
Version 19.12.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.12.0.0.0

SQL> @utlrp.sql

Session altered.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2021-09-21 19:17:26

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              2021-09-21 19:17:49

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.

No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...