Extracting data from a legacy IBM Optim database

Use the nextgen-upgrade utility to connect directly to a legacy IBM® Optim database and extract all OPTIMDIR table data to JSON files for use in subsequent upgrade steps.

Before you begin

Before you extract data, ensure that the following prerequisites are met:

  • You have access to the legacy IBM Optim database (DB2, Oracle, or SQL Server) that contains the OPTIMDIR schema.
  • Your database user account has SELECT permission on all 13 OPTIMDIR tables.
  • The machine running the utility has network connectivity to the database host and port.
  • For IBM DB2 source databases only: Java Runtime Environment (JRE) 21 or later is installed and available on the PATH. To check the current version, run java -version. To install Java 21 on Red Hat Linux, run yum install java-21-openjdk.
    Important: The JDBCQuery.class file that is embedded in the binary is compiled with Java 21 (class file version 65.0). The Java runtime on the target machine must be Java 21 or later. Running the DB2 extractor with an older JRE produces an UnsupportedClassVersionError and the extraction fails.
  • The machine runs Red Hat Enterprise Linux version 9 or later.
  • The nextgen-upgrade binary is downloaded and extracted.

Procedure

  1. Identify the following connection details for your legacy IBM Optim database:
    • Database type: db2, oracle, or sqlserver
    • Hostname or IP address of the database server
    • Port number
    • Database name (DB2 and SQL Server) or Oracle service name
    • Username with SELECT access to the OPTIMDIR schema
  2. Run the nextgen-upgrade binary with the --data-extractor flag and the appropriate database connection parameters.

    Use the example that matches your database type:

    DB2

    ./nextgen-upgrade \
        --data-extractor db2 \
        --db-host <db2-hostname> \
        --db-port 50000 \
        --db-name <OPTIMDIR_DB_NAME> \
        --db-user <username> \
        --optimdirpath ./extracted-data

    Oracle

    ./nextgen-upgrade \
        --data-extractor oracle \
        --db-host <oracle-hostname> \
        --db-port 1521 \
        --service-name <ORACLE_SERVICE_NAME> \
        --db-user <username> \
        --optimdirpath ./extracted-data

    SQL Server

    ./nextgen-upgrade \
        --data-extractor sqlserver \
        --db-host <sqlserver-hostname> \
        --db-port 1433 \
        --db-name <OPTIMDIR_DB_NAME> \
        --db-user <username> \
        --optimdirpath ./extracted-data

    The following tables describe the available parameters:

    Table 1. Required data extraction parameters
    Parameter Applies to Description
    --data-extractor All Source database type. Valid values are db2, oracle, and sqlserver.
    --db-host All Hostname or IP address of the database server.
    --db-port All Port number of the database server.
    --db-user All Database username with SELECT access to the OPTIMDIR schema.
    --db-name DB2, SQL Server Name of the legacy OptimDB database. Not used for Oracle.
    --service-name Oracle only Oracle service name. Required for Oracle source databases.
    --optimdirpath All Output directory where the extracted JSON files are written.
    Table 2. Optional data extraction parameters
    Parameter Default Description
    --db-schema Connecting username Overrides the database schema used when querying tables. For DB2, the schema defaults to the connecting username.
    --jdbc-driver Embedded drivers Path to an external DB2 JDBC JAR file. Use only if you need to override the IBM DB2 JDBC drivers that are embedded in the binary.
  3. When prompted, enter the database password.
    Enter database password:
    Tip: The password is not echoed to the screen, stored, logged, or written to disk. It is used only to establish the database connection.
  4. Monitor the extraction progress in the console output.

    The utility extracts each of the 13 OPTIMDIR tables in sequence and reports the record count and schema metadata for each table. The following example shows typical output:

    Starting data extraction from db2 database
    Extracting table: PSTOBJ2...
      Extracting metadata for PSTOBJ2...
      ✓ Extracted 42 records from PSTOBJ2 (8 columns, 1 indexes, 1 constraints)
    Extracting table: PSTDBA2...
      ...
    Data extraction completed successfully in 14.32s
    Output saved to: ./extracted-data
  5. Verify that the output directory contains 14 JSON files: one per OPTIMDIR table and a _relationships.json summary file.
    extracted-data/
    ├── pstarcvfdat2.json
    ├── pstarcvfile2.json
    ├── pstarcvseg2.json
    ├── pstarcvtbl2.json
    ├── pstaudit2.json
    ├── pstcollection2.json
    ├── pstdba2.json
    ├── pstobj2.json
    ├── pstpk2.json
    ├── pstpt2.json
    ├── pstrel2.json
    ├── pstsec2.json
    ├── pstsecdat2.json
    └── _relationships.json
    Important: The utility parses only pstobj2.json, pstdba2.json, and pstrel2.json during data processing. The remaining files are extracted for completeness but are not processed in subsequent upgrade steps.
    Note:
    • For DB2 databases, the tool queries tables under the schema that matches the connecting username (for example, SELECT * FROM db2admin.PSTOBJ2). Use --db-schema to override this if your OPTIMDIR tables are owned by a different schema.
    • If a table metadata query fails due to insufficient catalog permissions, the extraction continues and the table JSON file is written without the schema_metadata section. Row data is not affected.
    • If all 13 tables fail to extract, the utility exits with an error and no output files are written.

Results

The output directory specified by --optimdirpath now contains 14 JSON files representing all 13 OPTIMDIR tables and a relationships summary. These files are ready for use in the next phase of the upgrade process.

The following table describes common errors and their resolutions:
Table 3. Data extraction errors and resolutions
Error message Likely cause Resolution
failed to ping database: <driver error> Incorrect hostname, port, or database name; network unreachable. Verify the connection details and confirm network access to the database host and port.
authentication failed: incorrect username or password for database '<DBNAME>' Wrong credentials supplied. Re-enter the correct credentials. Confirm that the database user exists and has SELECT access on OPTIMDIR tables.
unsupported database type: <value> An unsupported value was passed to --data-extractor. Use only db2, oracle, or sqlserver.
JDBC query failed: <error> Java 21 is not installed or not available on PATH (DB2 only). Install Java 21 and verify with java -version.
JDBC query failed: <error> with UnsupportedClassVersionError: JDBCQuery has been compiled by a more recent version of the Java Runtime The JRE on the target machine is older than Java 21. The embedded JDBCQuery.class was compiled at class file version 65.0 and cannot run on an earlier JRE (DB2 only). Upgrade the JRE on the target machine to Java 21 or later.
Warning: Failed to extract <TABLE>: query failed: <driver error> where the driver error indicates insufficient privileges (for example, DB2 SQLSTATE=42501 or Oracle ORA-01031) Database user lacks SELECT on one or more OPTIMDIR tables. Request GRANT SELECT on the affected OPTIMDIR tables from your database administrator.
Warning: Failed to extract <TABLE>: query failed: <driver error> where the driver error indicates the table is not found (for example, DB2 SQLCODE=-204) For DB2: the OPTIMDIR tables are not in the schema that matches the connecting username. Confirm that the OPTIMDIR tables exist under the schema that matches your DB2 username, or use --db-schema to specify the correct schema owner. Contact your database administrator if needed.
--service-name is required for Oracle data extraction The --service-name flag was not provided for an Oracle extraction. Add --service-name <service_name> to the command.
data extraction failed: 0 of <N> tables were successfully extracted All table queries failed due to connectivity or permission issues. Resolve the underlying issue that is reported in the preceding warning messages and retry.

What to do next

Use the extracted JSON files as input to generate upgrade pipelines or an assessment report. For more information, see Generating upgrade pipelines from extracted data.