Class DB2LUWDatabaseStatsExtractor

java.lang.Object
org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
org.odpi.openmetadata.adapters.connectors.db2luw.survey.DB2LUWDatabaseStatsExtractor

public class DB2LUWDatabaseStatsExtractor extends AuditLoggingBase
DB2LUWDatabaseStatsExtractor gathers the same measurements as the PostgreSQL equivalent (org.odpi.openmetadata.adapters.connectors.postgres.survey.PostgresDatabaseStatsExtractor) but sources them from Db2 for Linux, UNIX and Windows' system catalog views (SYSCAT.SCHEMATA, SYSCAT.TABLES, SYSCAT.VIEWS, SYSCAT.COLUMNS, SYSCAT.COLDIST, SYSCAT.INDEXES, SYSCAT.TRIGGERS, SYSSTAT.COLUMNS), the SYSIBMADM.ADMINTABINFO administrative view and the SYSPROC.ADMIN_GET_TAB_INFO and MON_GET_TABLE table functions instead of pg_catalog. All of these sources are metadata/statistics only - no user data is read.

Unlike Oracle (whose CDB root can see every pluggable database's size through a single cross-container connection before looping per-PDB for schema detail), Db2 for Linux, UNIX and Windows has no catalog view that spans multiple databases - every one of the views above is already scoped to whichever single database the connection is attached to. Consequently getDatabaseStatistics() here is called once per database, on a connection to that specific database, rather than once up front on a shared connection.

The connections passed to it are expected to be in auto-commit mode, so that every query is its own short transaction. Each schema is surveyed with its own set of queries, and a query that fails is logged and skipped, so one inaccessible schema, a missing privilege for the administrative views and monitoring functions (a common situation, since they need more than the CONNECT privilege), or a dropped table leaves a gap in the results rather than ending the survey.
  • Constructor Details

    • DB2LUWDatabaseStatsExtractor

      public DB2LUWDatabaseStatsExtractor(List<String> validDatabases, SurveyActionServiceConnector surveyActionServiceConnector)
      Constructor sets up the list of databases to process and the connection to the database. Every schema in those databases is surveyed.
      Parameters:
      validDatabases - list of database names
      surveyActionServiceConnector - calling connector
    • DB2LUWDatabaseStatsExtractor

      public DB2LUWDatabaseStatsExtractor(List<String> validDatabases, List<String> excludedSchemas, List<String> includedSchemas, SurveyActionServiceConnector surveyActionServiceConnector, AuditLog auditLog, String surveyActionServiceName)
      Constructor sets up the list of databases to process, the schemas within them to survey, and the connection to the database.
      Parameters:
      validDatabases - list of database names
      excludedSchemas - schemas to leave out (null means none are excluded)
      includedSchemas - the only schemas to survey (null means all that are not excluded); takes precedence over excludedSchemas
      surveyActionServiceConnector - calling connector
      auditLog - logging destination for queries that fail (may be null)
      surveyActionServiceName - name of the calling survey action service, for the audit log