Skip to content

Db2 for LUW and Db2 for z/OS

Db2 for LUW as a source

Setting it up: Db2 for LUW.

"Failed in call to log library (RC=-1)"

The agent fails when it starts, with Failed in call to log library (RC=-1) and Failure Reading Log Records.

Cause: the agent reads the log over ODBC (without the log reader stored procedure), and either:

  • the database manager's AUTHENTICATION (db2 get dbm cfg) isn't SERVER, and the agent property udbAuthentication doesn't match it; or
  • the database uses SERVER_ENCRYPT or DATA_ENCRYPT and Stelo Capture runs on Windows Server 2016 or later: the log reader can't load Db2's GSKit library. The db2diag.log on the Stelo VM then shows ECF_LIB_CANNOT_LOAD and Cannot load the specified library for ...\icc64\gsk8ssl_64.dll.

What to do:

  1. Set udbAuthentication to the database manager's AUTHENTICATION on the agent's Configuration tab, and save (the agent restarts). See Other authentication types.
  2. With SERVER_ENCRYPT or DATA_ENCRYPT on Windows Server 2016 or later, use the log reader stored procedure (recommended). If you can't, add GSKit to the Launch Agent's path:
    1. Find GSKit's folder, by default C:\Program Files\IBM\gsk8.
    2. In C:\Program Files\StarQuest\sqdrplus\capagent\wrapper\conf\wrapper.conf, copy the line that starts with set.PATH=.
    3. Paste it into C:\ProgramData\StarQuest\sqdrplus\conf\wrapper-local.conf (create the file if needed), and add GSKit's lib64 folder after the Db2 bin folder, for example set.PATH=C:\Program Files\IBM\SQLLIB/bin%WRAPPER_PATH_SEPARATOR%C:\Program Files\IBM\gsk8\lib64%WRAPPER_PATH_SEPARATOR%... followed by the rest of the copied line. The line in wrapper.conf can change between Stelo Capture versions: copy it again after an upgrade.
    4. Restart the SQDR Plus Launch Agent service.
  3. For CLIENT or DATA_ENCRYPT, see AUTHENTICATION=CLIENT and AUTHENTICATION=DATA_ENCRYPT.

"Security mechanism not supported" (ERRORCODE=-4214) when you add the agent

The wizard can't connect to the source: Security mechanism not supported, ERRORCODE=-4214, SQLSTATE 28000.

Cause: the database manager uses AUTHENTICATION=CLIENT or DATA_ENCRYPT, which the wizard's connection doesn't support.

What to do: add the agent through a placeholder database (see Add the agent through a placeholder database).

"Log reader initialization failed with sqlcode=-2032" after a Db2 upgrade

After the source was upgraded from Db2 9.7 to 10.5 or later, the agent fails with Failed in call to log library (RC=-2032):Log reader initialization failed with sqlcode=-2032.

Cause: the log sequence number (LSN) became longer in Db2 10.5, and the StarSQL packages and the agent's saved reading positions still have the old format.

What to do:

  1. Stop the Replicator Service, so that no StarSQL connection to the source remains.
  2. Bind the StarSQL packages in the agent's collection on the source again (see Connecting SQDR to a Db2 source: bind the StarSQL packages). If the bind fails, drop the package SQDR.SYSCAT first (for example with the SQDR Control Center's Query tool or in a Db2 command window).
  3. Clear the agent's reading positions in its staging database, for example:

    db2 connect to SQDRP0
    db2 delete from SQDR.SQ_READERS
    db2 disconnect SQDRP0
    

    The agent's controlDbUrl names the staging database and controlDbSchema the schema.

  4. Start the Replicator Service and the agent.

"Log reader initialization failed with sqlcode=-2018", or SQLCODE=-440 for SQ_READLOG

SQLCODE=-440 appears with the log reader stored procedure.

Cause: the Capture Agent user has neither SYSADM nor DBADM authority.

What to do: grant it DBADM (see Users and privileges), or add it to the operating system group named in the database manager's SYSADM_GROUP. The agent's user is its sourceUserId property. To find the group:

db2 get dbm cfg | findstr SYSADM_GROUP

If it's empty, create an operating system group (for example db2adm), set it with db2 update dbm cfg using SYSADM_GROUP db2adm, and restart Db2 (db2stop, db2start). Then add the user to the group, and restart the agent.

"Log reader failed with sqlcode=-2652"

db2diag.log on the source shows "No memory available in the database heap".

Cause: the database's DBHEAP is too small.

What to do: set DBHEAP to AUTOMATIC (db2 update db cfg for MYDB using DBHEAP AUTOMATIC), then restart the agent.

SQLCODE=-444, SQLSTATE=42724 for SQ_READLOG or SQ_GET_INITIAL_LRI

Cause: Db2 can't load the log reader stored procedure.

What to do: check that the StarQuestSP file is in the Db2 instance's function directory and that the instance owner can read and run it (see step 1 of Log reader stored procedure). On a Windows database server, check that a recent Microsoft Visual C++ Redistributable for Visual Studio 2015–2022 is installed. If it still fails, look for other libraries the file needs that are missing: with a dependency tool on Windows (for example the open-source Dependencies), with ldd on Linux, or dump -H on AIX.

SQLCODE=-911, SQLSTATE=40001 when you publish or subscribe to a table

The agent's ALTER TABLE ... DATA CAPTURE CHANGES timed out on a lock. Have it run in a quiet period: see Turn on data capture yourself.

"Failed in call to log library (RC=-1263)" after a Db2 upgrade

Cause: Db2 was upgraded to a new major release, and it can't read the log files written by the earlier release.

What to do: before you stop Db2 for an upgrade, let the agent catch up with the log. If it's too late, start the agent once with the startup mode Force New Baselines, which clears its log position, so every subscription gets a new baseline (see Startup mode). Use Warm (restored) instead only if you're sure that no source table changed after the agent stopped.

"Truncated before image record for : table"

Cause: the table was altered (for example, columns added) before it was subscribed to.

What to do: run a REORG of the table (db2 reorg table MYSCHEMA.MYTABLE).

If the subscription has criteria, the agent may stop instead of logging this warning. If you suspect this, remove the criteria to see whether the warning appears.

Capture lags behind, and db2diag.log shows "ADM1843I Started retrieve for log file"

Db2 retrieves archived log files before the agent can read them. Set an overflow log path: see Overflow log path.

Capture slows down when the database is busy

Capture keeps up when the database is quiet, but lags (by half an hour or more) when it's busy.

Cause: when the log files the agent needs are already archived, Db2 retrieves them from the archive first. With thousands of archived log files that were never cleaned up, that gets slow.

What to do: delete the archived log files the agent and recovery no longer need (see Keeping archived logs for the agent), and set an overflow log path (see Overflow log path).

The active log path fills up (Db2 11.1 fix pack 3)

On Db2 11.1.3.3 (and 11.1.3.3 iFix001), log files that were archived aren't removed from the active log path while db2ReadLog is used, which the agent does, until the file system is full.

What to do: update Db2 to 11.1 fix pack 4 or later (APAR IT25556), or set the registry variable DB2_USE_BUFFERED_READ_FOR_ACTIVE_LOG to NO as IBM describes.

Capture is slow and bursty, with db2shred messages in db2diag.log

Cause: the memory buffer Db2 uses to read the log for db2ReadLog is too small, and its db2shred threads wait.

What to do: first tune the log file size, log buffer size and log archive method. IBM then suggests a larger buffer with the registry variable DB2_DPS_RLOG_SHR_MEMBYTES; Stelo hasn't verified it, and IBM recommends asking Db2 Support before you change it. See IBM's DB2 readlog API Slow Performance.

"GSKit Error 408" or "GSKit Error 414" in db2diag.log

A TLS connection to Db2 fails (see SSL/TLS to a Db2 for LUW source).

  • GSKit Error 408: the keystore password is wrong (for the IBM Db2 ODBC driver, the SSLClientKeystoreDBPassword value or the stash file).
  • GSKit Error 414: the certificate received from the server is badly formatted, usually because the certificate of the certificate authority isn't in the client's keystore. Add it.

See IBM's Common GSKit errors.

Other messages

See also, for Db2 for LUW sources:

For any other message, see Error messages.

Db2 for LUW and Db2 for z/OS as a destination

Setting it up: Db2 for LUW and Db2 for z/OS.

"The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use"

Applying rows fails with a message such as:

ODBC message: SQLSTATE 22001, native error -302, [StarSQL][StarSQL ODBC Driver][DB2 Universal DataBase]The value of
a host variable in the EXECUTE or OPEN statement is too large for its corresponding use.

Cause: characters from a non-Unicode source become multibyte characters in the destination's encoding (for example UTF-8), and the destination's character columns are too short for them.

What to do: make the affected destination columns longer: in the subscription, change their length on the Columns tab, or rebuild the column list with an inflation option (Character data destination precision heuristic, see Options that change the mapping). See Data types.

"... cannot be created because a drop is pending on the object"

A subscription that re-creates the destination table fails with a message such as:

[StarSQL][StarSQL ODBC Driver][DB2]THE OBJECT MYSCHEMA.MYTABLE CANNOT BE CREATED BECAUSE A DROP IS PENDING ON THE OBJECT.

Cause: on a slow destination (seen mostly with Db2 for z/OS, SQLCODE -679), Db2 hasn't finished dropping the old table when the Replicator Service creates it again.

What to do: stop re-creating the table on each run: set the subscription's Destination DDL Options to Use existing table (Use existing table for baseline for an incremental subscription), and empty it with Truncate table before replication or Delete existing data before replication in the Baseline Replication Options.

Other problems

See also: