DBCollect/Detection

From Dirty Cache Wiki
Revision as of 15:00, 31 August 2025 by Bart (talk | contribs)
Jump to navigation Jump to search


Instance detection

This page describes how dbcollect detects (running) Oracle instances and their correct ORACLE_HOMEs.

Running instances

  • If a logons file is provided (using --logons), dbcollect will NOT automatically detect instances, but only connect to the services listed in the logons file.
  • If no logons file is specified, dbcollect runs the command ps -eo pid,user,group,args to find all running processes on the OS.
  • Running instances are matched if the args match ora_pmon_<oracle_sid>
  • If the --included option is given, only instances that are explicitly included will be processed (a warning message is given for non-included instances)
  • If the --excluded option is given, only instances that are not explicitly excluded will be processed (a warning message is given for excluded instances)

ORACLE_HOME

dbcollect uses SQL*Plus to connect to databases. As of Oracle 19, there is no clean, consistent way to find the correct ORACLE_HOME for a running instance. Older versions would have a hc_<sid>.dat file where the most recent timestamp on these files was used to figure out which ORACLE_HOME is the correct one. In Oracle 19, the DBS directory is moved from $ORACLE_HOME/dbs to $ORACLE_BASE/dbs which is shared by multiple ORACLE_HOMEs and therefore can no longer be used to identify the correct directory.

Therefore, the instance detection part has been rewritten in version 1.18.0 as follows:

  • If the --orahome option is used, try the ORACLE_HOMEs given by this parameter first
  • Next, try to locate the instance in oratab. The ORACLE_HOME given for the instance will be tried
  • Finally, try the ORACLE_HOMEs found via processing the Oracle Inventory (inventory.xml)