Sunday, December 3, 2023

 Monitoring Protected  Databases with Oracle Autonomous Recovery Service

After configuring automatic backups for your Oracle Cloud Infrastructure (OCI) databases, the next critical step is to verify and monitor the protection status. Oracle makes this easy through the Protected Databases dashboard in the Autonomous Recovery Service.

This post explains what each column means and how to interpret the information so you can confidently manage backup health and recovery readiness.

Navigation : 
Navigate to the Autonomous Recovery Service dashboard, then select your compartment—in this example, it’s PROD_DB_RAC_COMP. You’ll be presented with a table listing all protected databases under this compartment.




 Breakdown of the Protected Databases Table

Here's a detailed explanation of what each column in the table represents:

Column 1 Name

Column 2 State

  • Value: Active/inactive 

  • This indicator indicates the database's registration and protection state within the Recovery Service. An “Active” status confirms that the protection is up and running.

Column 3 Health

  • Value : Protected/unprotected.

  • Reflects the current health status of backup coverage.

  • A "Protected" status means backups are compliant with the defined policy.

  • If present, an info icon (ⓘ) may provide further context or health alerts.

Column 4 Source Database : 

  • A unique identifier or name of the actual database is being protected. This is helpful in matching databases in other OCI services like Database Systems or Exadata Cloud.

Column 5 Real-Time Protection

  • Value : Enabled/Disabled 

  • Indicates whether real-time redo log backup is active.

  • When enabled, the logs are continuously sent to the Recovery Service, like DR log shipping, minimizing data loss during unexpected failures.

Column 6 Data Loss Exposure

  • Value : 0  to XXX....... seconds.

  • Shows the amount of potential data loss in case of recovery. Zero seconds confirms full real-time protection is functioning properly. If there is a number, for example, 600, then the last 600 seconds of data will be lost during the recovery process 

Column 7 Current Recovery Window

  • Value:  h  m  s 

  • This displays how far back in time you can restore your database. It grows until it reaches the maximum retention period defined by your protection policy (e.g., 31 days).

Column 8 Recovery Window Space Used

  • Value :  GB

  • Total storage space is used to maintain recovery data across the current window. This includes incremental backups, redo logs, and metadata.

Column 9 Protection Policy

  • Value:  the recovery policy that we had selected during the configuration of the autonomous recovery service eg: AUTONOMOUS_RECOVERY_SERVICES_PROTECTION_POLICY 

  • It identifies the retention and recovery rules applied to the database. Clicking the link provides detailed policy configurations, such as recovery window length, backup frequency, and redundancy.

Column 10 Database Size

  • Value shown:  GB

  • Displays the current total size of the database being protected.

  • Useful for understanding storage consumption and planning for backup window usage.

Why This Matters

Monitoring this dashboard is key to:

  • Verifying backup and recovery readiness

  • Ensuring compliance with data protection policies

  • Planning for storage and recovery performance

The ability to see real-time protection, data loss exposure, and current recovery windows at a glance offers transparency and confidence in your data resilience strategy.




Sunday, November 5, 2023

Oracle  DBCS DB Home In-Place Patch Upgrade from 19.X to 19.X via DBCLI with Post-Patching Validation

In this blog post, I walk through the process of performing an in-place patch upgrade of Oracle Database 19c from version 19.15.0.0.0 to 19.20.0.0.0 on an Oracle Database Appliance (ODA). This includes precheck validation, applying the patch via dbcli, enabling the OLAP component, and recompiling invalid objects post-patch.

Environment Details

  • Host: <Db hostname>

  • Current DB Version: 19.15.0.0.0

  • Target DB Version: 19.20.0.0.0

  • Platform: Oracle Database Appliance

  • Tools Used: dbcli, SQL*Plus, srvctl, chopt, utlrp.sql

  • In this exercise, we're only upgrading the Oracle Home. However, the Grid Infrastructure Home must be upgraded beforehand.

Step 1 : Login and Environment Preparation

Authenticating with public key "imported-openssh-key"

Last login: Tue Oct 31 12:28:29 2023 from 171.40.40.162


[opc@omdevdb ~]$ sudo -su root

[root@omdevdb opc]# cd


[root@omdevdb ~]# sudo -su oracle

[oracle@omdevdb root]$ cd

==========================================================================Step 2 : Log in to the SQL Plus from the SSH Console

Login  shut down, and start up the instance 

[oracle@omdevdb ~]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 6 00:27:49 2023

Version 19.15.0.0.0

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

Enter user-name: sys as sysdba

Enter password:

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.15.0.0.0


SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE instance started.


Total System Global Area 3.0602E+10 bytes

Fixed Size                 13873640 bytes

Variable Size            1.5301E+10 bytes

Database Buffers         1.5099E+10 bytes

Redo Buffers              187449344 bytes

Database mounted.

Database opened.

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.15.0.0.0

[oracle@omdevdb ~]$ exit

exit

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

Step 3 : Check for Available Patches and Oracle Home Details 

[root@omdevdb ~]# cd /opt

[root@omdevdb opt]# ls

cerberus  clamav  io  lost+found  opc  oracle  ORCLfmap  os-updater  rh  unified-monitoring-agent

[root@omdevdb opt]# cd oracle

[root@omdevdb oracle]# ls

bmc  dcs  dms  extapi  mysql_compact  oak  olite  rp  stig

[root@omdevdb oracle]# cd dcs

[root@omdevdb dcs]# ls

agent  auth  bin  commonstore  conf  configuredcs.pl  dbaasca  dcsadmin-stderr.log  dcsadmin-stdout.log  dcsagent_wallet  dcscli  fpca  invctl  Inventory  java  log  rdbaas  repo  sample  thirdparty  upload

[root@omdevdb dcs]# cd bin

[root@omdevdb bin]# ls

[root@omdevdb bin]# ./dbcli describe-latestpatch


componentType   availableVersion

--------------- --------------------

gi              12.2.0.1.230718

gi              18.16.0.0.0

gi              19.21.0.0.0

gi              21.12.0.0.0

gi              23.3.0.23.09

db              11.2.0.4.231017

db              12.2.0.1.231017

db              12.1.0.2.231017

db              18.16.0.0.0

db              19.21.0.0.0

db              21.12.0.0.0


[root@omdevdb bin]# ./dbcli describe-component

System Version

---------------

23.3.2.0.0


Component                                Installed Version    Available Version

---------------------------------------- -------------------- --------------------

GI                                        19.15.0.0.0           19.21.0.0

DB                                        19.15.0.0.0           19.21.0.0


With this command we are able to get what is the current installed version of the Grid DB and what is the highest available version to upgrade 

Note: Before stating the process we need to check whether the dbcli is up to date if it is not up to date then the below command will update the dbcli binary to the compatible version 

[root@omdevdb bin]# ./cliadm update-dbcli

dbcli is already up-to-date. Skipping...

In this case the dbcli is up-to date no no upgrade to the latest binary is required else it will be upgraded to the latest binary 


Step 4:  Perform Pre-Check for Server Patching

Run the precheck for both Grid Infrastructure (GI) and Oracle Home using dbcli. Once initiated, the process runs in the background as a job. You can use the dbcli list-jobs command to view all currently running jobs, and use dbcli describe-job -i <job-id> to get detailed information about a specific job and monitor its progress.

[root@omdevdb bin]# ./dbcli update-server --precheck -v 19.20.0.0.0 --precheck

{

  "jobId" : "4203c11d-213a-4872-a192-1c1bf00aec47",

  "status" : "Created",

  "message" : null,

  "errorCode" : "",

  "reports" : [ ],

  "createTimestamp" : "November 06, 2023 00:46:52 AM GST",

  "resourceList" : [ ],

  "description" : "Server Patching Prechecks",

  "updatedTime" : "November 06, 2023 00:46:52 AM GST",

  "percentageProgress" : "0%",

  "cause" : null,

  "action" : null

}

check the Job to know the status 

[root@omdevdb bin]# ./dbcli describe-job -i 4203c11d-213a-4872-a192-1c1bf00aec47


Job details

----------------------------------------------------------------

                     ID:  4203c11d-213a-4872-a192-1c1bf00aec47

            Description:  Server Patching Prechecks

                 Status:  Running

                Created:  November 6, 2023 at 12:46:52 AM GST

               Progress:  0%

                Message:

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Pre-operations for Server Patching Prechecks                             November 6, 2023 at 12:46:52 AM GST November 6, 2023 at 12:46:52 AM GST Running

Once the Job is completed the Progress will be changed to 100%

[root@omdevdb bin]# ./dbcli describe-job -i 4203c11d-213a-4872-a192-1c1bf00aec47


Job details

----------------------------------------------------------------

                     ID:  4203c11d-213a-4872-a192-1c1bf00aec47

            Description:  Server Patching Prechecks

                 Status:  Success

                Created:  November 6, 2023 at 12:46:52 AM GST

               Progress:  100%

                Message:

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Pre-operations for Server Patching Prechecks                             November 6, 2023 at 12:46:52 AM GST November 6, 2023 at 12:49:02 AM GST Success

Server Patching Prechecks                                                November 6, 2023 at 12:49:02 AM GST November 6, 2023 at 12:49:47 AM GST Success

Install object store swift module                                        November 6, 2023 at 12:49:08 AM GST November 6, 2023 at 12:49:38 AM GST Success


[root@omdevdb bin]# ./dbcli list-dbhomes


ID                                       Name                 DB Version                               Home Location                                 Status

---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------

f6bd8244-cd8b-439b-a4a5-5c6080a3f67a     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured


Run rm -rf /tmp/datapatchoutput* before patching to remove any stale or leftover datapatch output files, ensuring a clean environment and preventing conflicts or errors during the patching process.

[root@omdevdb bin]# rm -rf /tmp/datapatchoutput*

Step 5   In-Place Patch the DB Home

We are specific to upgrade to 19.20 which is n-1 so we are specifying the version if the version is not specified then it takes the latest available version 

[root@omdevdb bin]# ./dbcli update-dbhome -i f6bd8244-cd8b-439b-a4a5-5c6080a3f67a -v 19.20.0.0.0

{

  "jobId" : "bf6c920c-a773-47c2-ad38-5eb543dd4982",

  "status" : "Created",

  "message" : null,

  "errorCode" : "",

  "reports" : [ ],

  "createTimestamp" : "November 06, 2023 00:53:11 AM GST",

  "resourceList" : [ ],

  "description" : "Database inplace image patching with dbhomeId : f6bd8244-cd8b-439b-a4a5-5c6080a3f67a",

  "updatedTime" : "November 06, 2023 00:53:13 AM GST",

  "percentageProgress" : "0%",

  "cause" : null,

  "action" : null

}

[root@omdevdb bin]# ./dbcli describe-job -i bf6c920c-a773-47c2-ad38-5eb543dd4982


Job details

----------------------------------------------------------------

                     ID:  bf6c920c-a773-47c2-ad38-5eb543dd4982

            Description:  Database inplace image patching with dbhomeId : f6bd8244-cd8b-439b-a4a5-5c6080a3f67a

                 Status:  Running

                Created:  November 6, 2023 at 12:53:11 AM GST

               Progress:  0%

                Message:

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Precheck DBHome patching tasks                                           November 6, 2023 at 12:53:13 AM GST November 6, 2023 at 12:53:13 AM GST Running

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

[root@omdevdb bin]# ./dbcli describe-job -i bf6c920c-a773-47c2-ad38-5eb543dd4982


Job details

----------------------------------------------------------------

                     ID:  bf6c920c-a773-47c2-ad38-5eb543dd4982

            Description:  Database inplace image patching with dbhomeId : f6bd8244-cd8b-439b-a4a5-5c6080a3f67a

                 Status:  Running

                Created:  November 6, 2023 at 12:53:11 AM GST

               Progress:  8%

                Message:

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Precheck DBHome patching tasks                                           November 6, 2023 at 12:53:13 AM GST November 6, 2023 at 12:53:13 AM GST Running

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

[root@omdevdb bin]# ./dbcli describe-job -i bf6c920c-a773-47c2-ad38-5eb543dd4982


Job details

----------------------------------------------------------------

                     ID:  bf6c920c-a773-47c2-ad38-5eb543dd4982

            Description:  Database inplace image patching with dbhomeId : f6bd8244-cd8b-439b-a4a5-5c6080a3f67a

                 Status:  Running

                Created:  November 6, 2023 at 12:53:11 AM GST

               Progress:  18%

                Message:  WARNING::Patch bundle conflicts with: [35320081]. Missing Patches in target DBHome are: [34059654]

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Precheck DBHome patching tasks                                           November 6, 2023 at 12:53:13 AM GST November 6, 2023 at 1:00:02 AM GST  Success

DBHome patching                                                          November 6, 2023 at 1:00:02 AM GST  November 6, 2023 at 1:00:02 AM GST  Running

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

[root@omdevdb bin]# ./dbcli describe-job -i bf6c920c-a773-47c2-ad38-5eb543dd4982


Job details

----------------------------------------------------------------

                     ID:  bf6c920c-a773-47c2-ad38-5eb543dd4982

            Description:  Database inplace image patching with dbhomeId : f6bd8244-cd8b-439b-a4a5-5c6080a3f67a

                 Status:  SuccessWithWarning

                Created:  November 6, 2023 at 12:53:11 AM GST

               Progress:  100%

                Message:  WARNING::Patch bundle conflicts with: [35320081]. Missing Patches in target DBHome are: [34059654]

             Error Code:


Task Name                                                                Start Time                          End Time                            Status

------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------

Precheck DBHome patching tasks                                           November 6, 2023 at 12:53:13 AM GST November 6, 2023 at 1:00:02 AM GST  Success

DBHome patching                                                          November 6, 2023 at 1:00:02 AM GST  November 6, 2023 at 1:24:12 AM GST  Success

Post DBHome patching tasks                                               November 6, 2023 at 1:24:12 AM GST  November 6, 2023 at 2:04:27 AM GST  Success

Install object store swift module                                        November 6, 2023 at 2:04:09 AM GST  November 6, 2023 at 2:04:27 AM GST  Success

In this case the patch had been completed with warnings but the patch is successful 

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

[root@omdevdb bin]# sudo -su oracle

Step 6:  check the database components 

in case of upgrade completed with the warnings we need to check the logs and fix the warnings in this case we are checking the list of database options that are available  in the instance 

[oracle@omdevdb bin]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 6 07:22:20 2023

Version 19.20.0.0.0

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

Enter user-name: sys as sysdba

Enter password:

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.20.0.0.0


SQL> select COMP_NAME, VERSION, STATUS from dba_registry ORDER BY 3;


COMP_NAME

--------------------------------------------------------------------------------

VERSION                        STATUS

------------------------------ ---------------------------------

OLAP Analytic Workspace

19.0.0.0.0                     OPTION OFF


Oracle OLAP API

19.0.0.0.0                     OPTION OFF


Oracle Real Application Clusters

19.0.0.0.0                     OPTION OFF



COMP_NAME

--------------------------------------------------------------------------------

VERSION                        STATUS

------------------------------ ---------------------------------

Oracle XDK

19.0.0.0.0                     VALID


Oracle Database Java Packages

19.0.0.0.0                     VALID


Oracle XML Database

19.0.0.0.0                     VALID



COMP_NAME

--------------------------------------------------------------------------------

VERSION                        STATUS

------------------------------ ---------------------------------

Oracle Workspace Manager

19.0.0.0.0                     VALID


Oracle Text

19.0.0.0.0                     VALID


Oracle Multimedia

19.0.0.0.0                     VALID



COMP_NAME

--------------------------------------------------------------------------------

VERSION                        STATUS

------------------------------ ---------------------------------

Spatial

19.0.0.0.0                     VALID


Oracle Label Security

19.0.0.0.0                     VALID


JServer JAVA Virtual Machine

19.0.0.0.0                     VALID



COMP_NAME

--------------------------------------------------------------------------------

VERSION                        STATUS

------------------------------ ---------------------------------

Oracle Database Vault

19.0.0.0.0                     VALID


Oracle Database Catalog Views

19.0.0.0.0                     VALID


Oracle Database Packages and Types

19.0.0.0.0                     VALID



15 rows selected.



SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.20.0.0.0

In this case the OLAP is off  so we need to se the CHOPT to change the status of the options that are available in the database 

[oracle@omdevdb bin]$ srvctl stop database -d <db unique name>

Step 7 use CHOPT to enable or disable the database option as per the requirement 

chopt (short for "change option") is a command-line utility provided by Oracle to enable or disable optional database features in an Oracle Home without reinstalling the software.

chopt enable/disable database options 






Important Notes

  • Must be run from the Oracle Home bin directory.

  • Requires database to be stopped before enabling/disabling features.

  • Logs can be found in:
    $ORACLE_HOME/install/enable_<option>_<timestamp>.log

  • Log location :  /u01/app/oracle/product/19.0.0.0/dbhome_1/install/enable_olap_2023-11-06_07-30-54AM.log

[oracle@omdevdb bin]$ cd $ORACLE_HOME/bin ; chopt enable olap

Writing to /u01/app/oracle/product/19.0.0.0/dbhome_1/install/enable_olap_2023-11-06_07-30-54AM.log...

/usr/bin/make -f /u01/app/oracle/product/19.0.0.0/dbhome_1/rdbms/lib/ins_rdbms.mk olap_on ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1

/usr/bin/make -f /u01/app/oracle/product/19.0.0.0/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1

[oracle@omdevdb bin]$ vi /u01/app/oracle/product/19.0.0.0/dbhome_1/install/enable_olap_2023-11-06_07-30-54AM.log...

[oracle@omdevdb bin]$ vi/u01/app/oracle/product/19.0.0.0/dbhome_1/install/enable_olap_2023-11-06_07-30-54AM.log^C

[oracle@omdevdb bin]$ vi /u01/app/oracle/product/19.0.0.0/dbhome_1/install/enable_olap_2023-11-06_07-30-54AM.log

Once the Chopt is completed start the database and and compile the invalid objects 

[oracle@omdevdb bin]$ srvctl start database -d OMDEV_OIC


Step 8: Compile Invalid objects 

[oracle@omdevdb bin]$ sqlplus "/ as sysdba" @?/rdbms/admin/utlrp.sql

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 6 07:33:08 2023

Version 19.20.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.20.0.0.0

Session altered.

TIMESTAMP

--------------------------------------------------------------------------------

COMP_TIMESTAMP UTLRP_BGN              2023-11-06 07:33:09


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              2023-11-06 07:33:11

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

-------------------

                  1


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.


Step 9 :Check the status of the Component that is off and make sure that it had been valid 

SQL> col comp_name format a40

SQL> col VERSION format a20

SQL> col status format a10

SQL> set pages 100

SQL> select COMP_NAME, VERSION, STATUS from dba_registry ORDER BY 3;


COMP_NAME                                VERSION              STATUS

---------------------------------------- -------------------- ----------

Oracle Real Application Clusters         19.0.0.0.0           OPTION OFF

Oracle Database Vault                    19.0.0.0.0           VALID

JServer JAVA Virtual Machine             19.0.0.0.0           VALID

Oracle XDK                               19.0.0.0.0           VALID

Oracle Database Java Packages            19.0.0.0.0           VALID

OLAP Analytic Workspace                  19.0.0.0.0           VALID

Oracle XML Database                      19.0.0.0.0           VALID

Oracle Workspace Manager                 19.0.0.0.0           VALID

Oracle Text                              19.0.0.0.0           VALID

Oracle Multimedia                        19.0.0.0.0           VALID

Spatial                                  19.0.0.0.0           VALID

Oracle OLAP API                          19.0.0.0.0           VALID

Oracle Label Security                    19.0.0.0.0           VALID

Oracle Database Catalog Views            19.0.0.0.0           VALID

Oracle Database Packages and Types       19.0.0.0.0           VALID


15 rows selected.


SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.20.0.0.0

Conclusion

This blog walked through the end-to-end process of performing an in-place patch upgrade of Oracle Database 19c from version 19.15.0.0.0 to 19.20.0.0.0 using dbcli on DBCS running in Base database service in OCI. Key steps included running prechecks, applying the patch to the Oracle Home, enabling optional components like OLAP, and performing post-patch validation with utlrp.sql.

The upgrade completed successfully, with all core components in a VALID state and the database running on the new patched version. This approach ensures minimal downtime while keeping the environment consistent and secure with the latest updates and fixes.

Following a structured and clean patching process—combined with checks like clearing old datapatch outputs and validating job statuses—helps maintain Oracle environments efficiently and reduces the risk of post-upgrade issues.


Sunday, September 17, 2023

 

Resolving RPM Database Corruption Before Package Upgrades

Issue: During system maintenance on the OCI Linux environment, we encountered an issue where the RPM database became corrupted, causing dnf upgrade to fail with the following error:

 
[root@omdmz ~]# dnf upgraade
error: rpmdb: BDB0113 Thread/process 590272/140176820012928 failed: BDB1507 Thread died in Berkeley DB library

error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery

error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
Error: Error: rpmdb open failed

Step 1: Clean Up Stale RPM Database Files

To fix the issue, I first removed all temporary __db.* files:  as this clears out incomplete or orphaned transactions that may have caused the corruption.

[root@omapps01 rpm]# rm -f __db.*

D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "7ab75f337467cc17322ec627c0f5525bcd83a735" to Sha1header index.
D:  read h#    2707
Header SHA256 digest: OK
Header SHA1 digest: OK
D: adding "flatpak" to Name index.
D: adding 129 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 78 entries to Requirename index.
D: adding 2 entries to Providename index.
D: adding 1 entries to Conflictname index.
D: adding 58 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "453cd6fb88f9b42a07e8f9ab047f0e8e94e2fda8" to Sha1header index.
D: adding 2 entries to Recommendname index.
D:  read h#    2201
Header SHA256 digest: OK
Header SHA1 digest: OK
D: adding "swtpm-tools" to Name index.
D: adding 34 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 36 entries to Requirename index.
D: adding 3 entries to Providename index.
D: adding 15 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "53d49b3bac3d0da69c55add54e90f2c33c3c5c95" to Sha1header index.
D:  read h#     667


Header SHA256 digest: OK
Header SHA1 digest: OK
D: adding "libXres" to Name index.
D: adding 8 entries to Basenames index.
D: adding "System Environment/Libraries" to Group index.
D: adding 11 entries to Requirename index.
D: adding 3 entries to Providename index.
D: adding 6 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "6c7e1dc63b857095258408c570cc9ce6c15b8ec8" to Sha1header index.
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Packages
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Enhancename
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Supplementname
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Suggestname
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Recommendname
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Transfiletriggername
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Filetriggername
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Sha1header
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Sigmd5
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Installtid
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Dirnames
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Triggername
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Obsoletename
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Conflictname
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Providename
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Requirename
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Group
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Basenames
D: closed   db index       /var/lib/rpmrebuilddb.1125429/Name
D: closed   db environment /var/lib/rpmrebuilddb.1125429
==

Step 2:  check the location of  /var/lib/rpm 


[root@omdmz ~]# cd /var/lib/rpm
[root@omdmz rpm]# ls
Basenames     __db.001  __db.003  Enhancename      Group       Name          Packages     Recommendname  Sha1header  Suggestname     Transfiletriggername
Conflictname  __db.002  Dirnames  Filetriggername  Installtid  Obsoletename  Providename  Requirename    Sigmd5      Supplementname  Triggername
[root@omdmz rpm]#

Step 3: Rebuild the RPM db

rpm -vv --rebuilddb

This command reindexes the RPM database and ensures all package metadata is intact. The verbose flag -vv provides detailed output for troubleshooting, showing progress on database index handling.

Result

After successfully rebuilding the database, the dnf upgrade worked without errors, and the package system went back to normal.

This is a common issue on systems where RPM operations are interrupted (e.g., forced reboots, crashes). If you notice package-related errors, it’s always good practice to rebuild the RPM database after such events.



Tuesday, May 16, 2023

Setting a Persistent Hostname in Oracle Cloud (Oracle Linux )

When deploying virtual machines in Oracle Cloud Infrastructure (OCI), the cloud metadata service often manages hostname configuration. This can overwrite any manual hostname changes made on the instance after a reboot.

In this blog post, we'll walk through setting a custom hostname on an OCI instance running Oracle Linux 8.7 and ensuring it persists across reboots

Manually set the hostname of your OCI instance and configure it so that your changes aren't lost during reboots or restarts.

Step 1: Set the Static Hostname

Use the hostnamectl command to define your new hostname:

[root@omoicsso ~]# hostnamectl set-hostname omoicsso.oasiserp.com

You can verify the change by running:

[root@omoicsso ~]# hostnamectl

   Static hostname: omoicsso.oasiserp.com

         Icon name: computer-vm

           Chassis: vm

        Machine ID: e0251ef691f54fe7b98d3354af266d31

           Boot ID: 333e7d37ec2b45d6942b50a9bf180b11

    Virtualization: kvm

  Operating System: Oracle Linux Server 8.7

       CPE OS Name: cpe:/o:oracle:linux:8:7:server

            Kernel: Linux 5.15.0-100.96.32.el8uek.x86_64

      Architecture: x86-64

[root@omoicsso ~]#

At this point, the hostname has been changed — but it may not be persistent across reboots due to OCI's metadata-based management.

Step 2: Configure Hostname Persistence

OCI instances come with a special configuration file: /etc/oci-hostname.conf.

Edit or verify the following setting:

[root@omoicsso ~]# cat /etc/oci-hostname.conf

# This configuration file controls the hostname persistence behavior for Oracle Linux

# compute instance on Oracle Cloud Infrastructure (formerly Baremetal Cloud Services)

# Set PRESERVE_HOSTINFO to one of the following values

#   0 -- default behavior to update hostname, /etc/hosts and /etc/resolv.conf to

#        reflect the hostname set during instance creation from the metadata service

#   1 -- preserve user configured hostname across reboots; update /etc/hosts and

#           /etc/resolv.conf from the metadata service

#   2 -- preserve user configured hostname across instance reboots; no custom

#        changes to /etc/hosts and /etc/resolv.conf from the metadata service,

#        but dhclient will still overwrite /etc/resolv.conf

#   3 -- preserve hostname and /etc/hosts entries across instance reboots;

#        update /etc/resolv.conf from instance metadata service

PRESERVE_HOSTINFO=2

What Does This Do?

  • PRESERVE_HOSTINFO=2 tells the system to preserve your manually configured hostname even after a reboot.

  • It prevents the OCI metadata service from overwriting your hostname, while still allowing it to update /etc/resolv.conf.

Final Check

After setting PRESERVE_HOSTINFO=2, your instance will retain the hostname even after a reboot.

You can test by rebooting:


[root@omoicsso ~]# reboot

[root@omoicsso ~]# hostnamectl

Static hostname: omoicsso.oasiserp.com

Conclusion

Oracle Linux on OCI provides flexibility in hostname configuration — but only when you know where to look. Setting PRESERVE_HOSTINFO=2 ensures that your manual hostname configuration stays intact, avoiding surprises after restarts.

This is particularly useful in environments where:

  • Hostnames are used for licensing, monitoring, or DNS registration.

  • Manual management of infrastructure is part of your architecture.



Thursday, May 11, 2023

How to Create and Manage LVM  Oracle Linux 8 on OCI

In enterprise Linux environments, Logical Volume Manager (LVM) provides flexibility in managing disk space by allowing dynamic resizing and better abstraction of physical storage devices.

In this post, we'll walk through adding a new disk, creating a volume group (VG), and then creating a logical volume (LV) on an Oracle Linux 8 server, specifically in an OCI (Oracle Cloud Infrastructure) environment.

Senerio

We want to:

  1. Initialize a new disk (/dev/sdb) for use with LVM.

  2. Create a new volume group vg_data.

  3. Create a logical volume lv_data with 350 GB of space.

Step 1: Create a Physical Volume (PV)

Before we can use a new disk with LVM, it must be initialized as a Physical Volume.

 [root@omoicsso opc]# pvcreate /dev/sdb

  Physical volume "/dev/sdb" successfully created.

/dev/Sdb is the hardware partition created in the OCI console as the block volume and assigned to the Linux server. It is raw storage from the OCI

[root@omoicsso opc]# pvs

  PV         VG        Fmt  Attr PSize   PFree

  /dev/sda3  ocivolume lvm2 a--   45.47g      0

  /dev/sdb             lvm2 ---  400.00g 400.00g

PVS lists all the physical volumes that are associated with this server 

Step 2: Create a Volume Group (VG)

Next, we group one or more physical volumes into a Volume Group:

[root@omoicsso opc]# vgcreate vg_data /dev/sdb

  Volume group "vg_data" successfully created

We had created the   volume group in the physical volume as vg_data -- it can be any name 

[root@omoicsso opc]# vgdisplay

  --- Volume group ---

  VG Name               vg_data

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               <400.00 GiB

  PE Size               4.00 MiB

  Total PE              102399

  Alloc PE / Size       0 / 0

  Free  PE / Size       102399 / <400.00 GiB

  VG UUID               iWc996-XIO2-M3WL-oFxr-1LtR-ndXf-KxM0bL


  --- Volume group ---

  VG Name               ocivolume

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  23

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               45.47 GiB

  PE Size               4.00 MiB

  Total PE              11641

  Alloc PE / Size       11641 / 45.47 GiB

  Free  PE / Size       0 / 0

  VG UUID               Hu90og-5IAx-0g5d-Q272-rmZL-L5fw-Z4R7lw

Here we have two volume groups,, so two groups have been displayed 

Step 3: Create a Logical Volume (LV)

Now, we need to created  a Logical Volume of 350 GB from vg_data:

[root@omoicsso opc]#  lvcreate -n lv_data -L 350G vg_data

  Logical volume "lv_data" created.

Once the volume group is created with the required size, you can format the logical volume using your preferred file system, such as XFS or ext4, and then mount it on the Linux system.

[root@omoicsso opc]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/vg_data/lv_data

  LV Name                lv_data

  VG Name                vg_data

  LV UUID                mkJZtP-E5k6-vsmN-4lNf-9Qcg-DrIl-U5bKhe

  LV Write Access        read/write

  LV Creation host, time omoicsso, 2023-05-11 11:57:00 +0000

  LV Status              available

  # open                 0

  LV Size                350.00 GiB

  Current LE             89600

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     4096

  Block device           252:2


  --- Logical volume ---

  LV Path                /dev/ocivolume/oled

  LV Name                oled

  VG Name                ocivolume

  LV UUID                nLXc2g-VyUO-dcUo-u1R1-HFOA-znRZ-PYAeBu

  LV Write Access        read/write

  LV Creation host, time localhost.localdomain, 2023-01-17 19:39:46 +0000

  LV Status              available

  # open                 1

  LV Size                10.00 GiB

  Current LE             2560

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     4096

  Block device           252:1


  --- Logical volume ---

  LV Path                /dev/ocivolume/root

  LV Name                root

  VG Name                ocivolume

  LV UUID                0MG24k-y6uq-CJo6-75bH-Qfak-Glvd-U2E9YK

  LV Write Access        read/write

  LV Creation host, time localhost.localdomain, 2023-01-17 19:39:47 +0000

  LV Status              available

  # open                 1

  LV Size                35.47 GiB

  Current LE             9081

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     4096

  Block device           252:0


We have three LVs, so the lvdisplay command displays all the LV in the server 


[root@omoicsso opc]#

At this point:

  • /dev/sdb is being used as an LVM physical volume.

  • You've grouped it into a volume group called vg_data.

  • A 350 GB logical volume (lv_data) is ready for formatting and mounting.


Create the file system 

mkfs.xfs /dev/vg_data/lv_data

Create A directory and Mount the lv 

mkdir /data
mount /dev/vg_data/lv_data /data

And optionally, add it to /etc/fstab for persistent mounting.

 Conclusion

Using LVM makes your Linux server storage much more flexible, especially in cloud environments like OCI where disks can be resized or replaced frequently. You can simplify expansion, backups, and migration by structuring your storage into volume groups and logical volumes.

Stay tuned for future posts on resizing volumes and taking LVM snapshots!