Db2 for i¶
Db2 for i as a source¶
Setting it up: Db2 for i.
Text arrives as hexadecimal, or "String data, right truncation" (CCSID 65535)¶
Character columns of a Db2 for i table arrive at the destination as hexadecimal EBCDIC bytes: for example HELLO
arrives as C8C5D3D3D6. This is common with Microsoft Fabric, BigQuery and Databricks destinations. Or changes fail to
apply and the subscription is flagged, with an error such as:
ODBC message: SQLSTATE 22001, native error 0, [Microsoft][ODBC Driver 18 for SQL Server]String data, right
truncation Analysis: Error: Excessive character count( 80) for column "MYCOL"SQL_CHAR(40)
The value is twice the column's length, because each byte became two hexadecimal characters.
Cause: the columns are tagged CCSID 65535 (FOR BIT DATA), which marks them as binary, and neither the Replicator
Service nor the agent was told which CCSID to read them in (see Columns without a
CCSID). To list a table's columns with CCSID 65535, run on the IBM i:
SELECT column_name, data_type, length, ccsid
FROM qsys2.syscolumns
WHERE table_schema = 'MYLIB' AND table_name = 'MYTABLE' AND ccsid = 65535
ORDER BY ordinal_position;
What to do: have both the agent and the Replicator Service read these columns as text in your data's CCSID, for
example 37 (US English EBCDIC):
- Capture Agent: on the agent's Configuration tab, set binaryCCSID to the CCSID. Saving restarts the agent.
- SQDR source: add
BinaryCCSID=37(StarSQL driver) orTRANSLATE=1(IBM i Access ODBC driver) to the source's connection string. Saving a changed connection string on an incremental source resets all its incremental groups, so every member needs a new baseline (see Saving changes): plan the change for a time when that's acceptable. - For each affected subscription, Rebuild Column List on the Columns tab (see Columns), and check that the columns are now character types.
- Run a baseline of those subscriptions, and check the values at the destination.
If the destination table already exists (Use existing table), make sure its columns are character columns of the right length.
A table is re-baselined over and over¶
The same subscriptions need a new baseline again and again (every day, every week or at random), although only a small part of the table changes; large tables spend hours in their baselines. Or a baseline doesn't start. There are three common causes, which the messages tell apart.
Journal receivers deleted before the agent read them¶
The agent's Diagnostics tab shows, for these tables,
ChangePropagator.onInvalidLogPosition: New baseline snapshot needed for MYLIB.MYTABLE, often after
QjoRetrieveJournalEntries returned CPF9801.
Cause: the table's journal deletes its receivers automatically (DLTRCV(*YES)), or a job deletes them, while the
Stelo Capture exit program doesn't protect them: it isn't registered, it was removed, or the agent has
managedLogs=false. When a receiver the agent still needs is gone, every table journaled to that journal needs a new
baseline, each time it happens (see
How Stelo Capture protects receivers).
What to do:
- Check that the exit program is registered: run
WRKREGINFand type8next to exit pointQIBM_QJO_DLT_JRNRCV(formatDRCV0100). ProgramCADLTRCVin the agent's library (defaultSQDR) should be listed. -
If it isn't, check that managedLogs isn't
falseon the agent's Configuration tab, and restart the agent: it registers the exit program when it starts. You can also register it yourself, as a user with*ALLOBJand*SECADMspecial authorities (replace bothSQDRvalues with the agent's library if it's different):CALL PGM(SQDR/CALOGMGMT) PARM('I' 'SQDR') -
If you manage receivers yourself instead (see Remove the Db2 for i exit program), change the journal so that IBM i doesn't delete them, and delete them with your own job only after Stelo Capture has read them:
CHGJRN JRN(MYLIB/MYJRN) DLTRCV(*NO) -
Check every journal the agent reads: each journal's settings apply to all the tables journaled to it, and nothing reports which tables are affected.
- Baseline the affected subscriptions once more.
An RRN-keyed table was reorganized¶
The group's replication events say "A reorganization event was detected for a subscription using a hidden column(i.e. RRN)."
Cause: a reorganization (for example RGZPFM, often in a scheduled maintenance job) can give rows new relative
record numbers, so subscriptions keyed by the RRN need a new baseline. This is expected (see
The RRN or ROWID column).
What to do: find out which job reorganizes the table, and schedule it at a time when a baseline is acceptable; let Automatic Snapshot or a scheduled group run take the baseline. A subscription keyed by a primary key or unique index isn't affected by reorganizations: see Tables without a usable key for the options.
The baseline fails with CPF7007¶
A baseline doesn't start, with a message such as
Failed to start Baseline for table 'MYLIB'.'MYTABLE'. ... Cannot tag journal: CPF7007.
Cause: to start a baseline, the agent writes a marker to the table's journal. IBM i reports CPF7007 when it can't
allocate the table's member, usually because another job, such as a maintenance or backup job, holds a lock on it.
What to do: at the time of the failure, find the job that locks the file
(WRKOBJLCK OBJ(MYLIB/MYTABLE) OBJTYPE(*FILE)) and look at its job log (DSPJOBLOG). Run the baseline again when the
lock is gone, and schedule the job and the baseline so that they don't overlap.
"Relational database LIBRARY not the same as the current server" (table names with ".")¶
Creating a subscription for a table whose name contains a period (.) fails with a message such as:
[StarSQL][StarSQL ODBC Driver][DB2/400]Relational database MYLIB not the same as the current server MYSYSTEM.
What to do: with StarSQL, add UseDSCRDBTBL=No to the source's connection string (for a StarSQL data source,
set UseDSCRDBTBL to No on its Experts Page). Then restart the Replicator Service so that new connections
use the setting.
"Invalid journaling/logging options" or "File Not Journaled" when you add a subscription¶
Creating an incremental subscription fails with a message such as:
Stored procedure SQDR.ADDSUBSCRIPTION returned error 18. Invalid journaling/logging options
or the agent's Diagnostics tab shows
CaptureAgent.addSubscription: File Not Journaled (MYLIB.MYTABLE).
Cause: the table isn't journaled, or it's journaled with after images only (*AFTER) and the subscription isn't
keyed by the relative record number (RRN), or it has criteria.
What to do: check how the table is journaled (see Journaling), then one of these:
- Journal it with before and after images (see Before and after images).
- For a table that must stay
*AFTER: key its subscription by the RRN, without criteria (see The RRN or ROWID column), and create the subscription again. On the subscription's Columns tab, the RRN column must have a destination name, or it isn't replicated. If all the agent's tables are journaled*AFTER, the agent propertyalwaysUseRowId=truekeys every subscription by the RRN. - For a table that isn't journaled, journal it, or let the agent do it (see Autojournaling).
"Journaled for Minimized Journal Entries, but not on Field Boundaries"¶
Subscribing fails with Stored procedure SQDR.ADDSUBSCRIPTION returned error 11 and this message.
Cause: the table's journal is created with MINENTDTA(*FILE) or MINENTDTA(*DTAARA), which the agent can't read.
What to do: journal the table to a journal with MINENTDTA(*NONE), or MINENTDTA(*FLDBDY) with an RRN-keyed
subscription and no criteria (see Before and after images).
"Cannot read user space: Connection refused", or the agent keeps restarting¶
The agent cycles between running and failing, and its Diagnostics tab shows
Unexpected native error: Cannot read user space: Connection refused, or another connection error.
Cause: an IBM i host server the agent uses isn't running or can't be reached, here the file server (as-file,
port 8473).
What to do:
- On the Stelo VM, run JPing (SQDR Plus (64-bit) › Tools › JPing - Verify IBM i host
servers) for the IBM i's host name. Each host server that answers prints
Successfully connected to server application:; when all do, it ends withConnection verified. - For a server that doesn't answer, check on the IBM i whether it listens:
WRKTCPSTS, option 3 (Work with IPv4 connection status), and look for its port (see Host servers, ports and jobs). - Start it, for example the file server with
STRHOSTSVR SERVER(*FILE), or all of them withSTRHOSTSVR SERVER(*ALL). If it listens, check the firewall between the two servers. The agent recovers on its own.
"[SQL0552] Not authorized to CREATE DATABASE" when you add the agent¶
The wizard stops with
Unable to create or verify schema/collection SQDR. [SQL0552] Not authorized to CREATE DATABASE.
Cause: the agent user, which creates the control library, isn't authorized to the CRTLIB command:
DSPOBJAUT OBJ(CRTLIB) OBJTYPE(*CMD) shows *PUBLIC *EXCLUDE.
What to do: one of these, then run the wizard again; it fills the library and sets its owners and authorities.
- Give the agent user
*USEauthority toCRTLIB. - Create the library yourself, as a user with enough authority, with
CREATE COLLECTION SQDR(inSTRSQL, ordb2 'CREATE COLLECTION SQDR'inQSH).
Autojournaling also creates libraries: if the agent user can't, set
autoJournal=false and journal the tables yourself. Subscribing to a table that isn't journaled then fails with a
clear message.
"[SQL0443] SYSIBM:CLI:-514" when you add the agent¶
After step 1 of the wizard: Unable to validate connection parameters [SQL0443] SYSIBM:CLI:-514.
Cause: catalog calls fail because the SYSIBM library on the IBM i is incomplete, or the database cross-reference
files are damaged (for example after a failed release upgrade or a power failure).
What to do:
- Check
SYSIBM:CALL QSYS/QSQIBMCHK, thenDSPJOBLOGand F10 for the result. If objects are missing, create them withCALL QSYS/QSQSYSIBM. - Check the cross-reference information with
RCLDBXREF OPTION(*CHECK). To repair one library without a restricted state, useRCLDBXREF OPTION(*FIX) LIB(MYLIB). To rebuild all of it, runRCLSTG SELECT(*DBXREF)in restricted state; on a large system that can take long, so do it only if needed.
See IBM's Verifying System Catalog Information for ODBC Use.
"[SQL0601] SQ_IXLIST in SQDR type *FILE already exists" when the agent starts¶
After an IBM i release upgrade, the agent fails to start, trying to create a control table that already exists.
Cause: the database cross-reference files are damaged.
What to do: rebuild them with RCLSTG SELECT(*DBXREF) in restricted state (see
"[SQL0443] SYSIBM:CLI:-514").
"Unable to copy resources to SQDR", or "adopt authority attribute not restored"¶
Adding the agent fails with:
Request failed.
Unable to copy resources to SQDR.
Object RJRNLAPI in library SQDR type *SRVPGM not found.
The SQDR Plus Jetty service's wrapper.log shows 7 objects restored. 6 not restored to SQDR., and the job log of
the QZRCSRVS job shows messages such as CADLTRCV in library SQDR with adopt authority attribute not restored.
Update Host seems to succeed, but wrapper.log shows the same "not restored" message and the programs aren't
updated.
Cause: the system value QALWOBJRST doesn't allow programs that adopt authority to be restored (see
Allow the Stelo Capture programs to be restored).
What to do:
- Set
QALWOBJRSTto*ALLor include*ALWPGMADP. - After a failed Add Capture Agent: delete the control library and the users (for example
SQDRandSQDRADM) the wizard created, otherwise the wizard finds the library and doesn't create it again. Then add the agent again. - After Update Host: run it again.
"Operation not valid on system domain object" (CPF3C48)¶
Running a baseline or publishing a table fails, and the agent's Diagnostics tab shows getJournalName: Call to
QUSPTRUS(return -1) returned CPF3C48, Message Text=Operation not valid on system domain object.
Cause: the system value QALWUSRDMN lists libraries instead of *ALL, without the agent's control library, so
the agent's user spaces there can't be used.
What to do:
- Stop the agent.
-
Check the value with
DSPSYSVAL QALWUSRDMN, and add the control library to the list (QTEMPmust stay in it). The change takes effect at once. For example:CHGSYSVAL SYSVAL(QALWUSRDMN) VALUE('QBRM QTEMP QUSRBRM SQDR') -
Delete the user spaces already created in the control library:
DLTOBJ OBJ(SQDR/*ALL) OBJTYPE(*USRSPC) -
Start the agent; it creates them again.
"Cannot initialize service program: Value for a parameter was not valid"¶
After a Stelo Capture upgrade, the agent fails to start with
Unexpected native error: Cannot initialize service program: Value for a parameter was not valid.
Cause: the Stelo Capture programs on the IBM i are older than the agent.
What to do: stop the agent, run Update Host, and start the agent.
"User is not authorized to object" for the user space¶
The agent fails to start, with /QSYS.LIB/SQDR.LIB/SQSPC0.USRSPC: User is not authorized to object. (and
Cannot read user space) on its Diagnostics tab.
Cause: the QPWFSERVER authorization list excludes *PUBLIC, so the agent user can't reach its user space
through the file server.
What to do: give the agent user access (see File server access for the agent user):
ADDAUTLE AUTL(QPWFSERVER) USER(SQDR) AUT(*USE)
"Cannot allocate object SQSPC0" (CPF9803)¶
The agent fails to start: its log shows RemoteJournalReader.initializeUserSpace with
Connection reset by peer: socket write error, or CPF9803 Cannot allocate object SQSPC0 in library SQDR.
WRKOBJLCK shows no lock, and the user's authority is fine.
Cause: a lock held by a leftover connection or job from the Stelo VM, which WRKOBJLCK doesn't show.
What to do:
-
Look for locks held by ILE programs: run this SQL on the IBM i (IBM i 7.3, or 7.2 with Db2 PTF group SF99702 level 9, or 7.1 with SF99701 level 38) and look at
MODULE_LIBRARYandMODULE_NAME:SELECT * FROM QSYS2.OBJECT_LOCK_INFO WHERE OBJECT_SCHEMA = 'SQDR' AND OBJECT_NAME LIKE 'SQSP%' WITH NC; -
Check with
NETSTATon the IBM i for connections from the Stelo VM that are left while the agent is stopped, and review the IBM i's TCP keepalive setting (CHGTCPA TCPKEEPALV). - If nothing else helps, restart the Stelo VM: that closed the connections when this was seen.
"Object MYJRN in library MYLIB not found" after a role swap¶
After a switch to another IBM i (for example a disaster recovery test), the agent fails to start with Replication
Worker failed to initialize and Call to QjoRetrieveJournalInformation(return -1) returned CPF9801, Message Text=Object
MYJRN in library MYLIB not found., although the journal exists in another library on the new system.
Cause: the agent keeps the tables' metadata, including their journals, in a cache in its staging database, which still names the journals of the old system.
What to do: with Stelo Support (rebuilding the cache can take a long time): stop the agent, empty the cache table
SQ_MDCACHE in the agent's staging database, and start the agent. The agent's
controlDbUrl names the database and
controlDbSchema the schema; for example, in a Db2 command window
on the Stelo VM:
db2 connect to SQDRP0
db2 delete from SQDR.SQ_MDCACHE
db2 disconnect SQDRP0
For the role swap itself, see High availability and role swaps.
"Attempt to use permanent system object QGY without authority"¶
Adding the agent fails with this message.
Cause: *PUBLIC is excluded from the library QGY. The IBM Toolbox for Java, which Stelo Capture uses, still calls
the open list APIs through QGY.
What to do: give *PUBLIC (or the agent user and the installing user) *USE authority again to the library QGY
and at least the objects QGY/QGYOLOBJ, QGY/QGYOLAUS and QGY/QGYCLIST.
"[SQL0552] Not authorized to CREATE PROCEDURE" when the agent starts¶
The first start of a new agent fails with this message on its Diagnostics tab.
Cause: access to the catalog table QSYS2/SYSROUTINE is restricted (the default is *PUBLIC *CHANGE), so the
agent user can't create its procedures.
What to do: give the agent user at least *OBJOPR and *ADD authority to QSYS2/SYSROUTINE. If the table is in
use and can't be changed, add the agent user to the authorization list that controls it, if there is one.
More than one exit program registered, or "CPF2469" spooled files¶
WRKREGINF lists several CADLTRCV entries for the exit point QIBM_QJO_DLT_JRNRCV for one agent, journal receivers
aren't deleted when they should be, or jobs create many QPRINT spooled files with
CALog: Exception ID: CPF2469, Exception Data:.
Cause: agents were deleted and created again (for example in a test environment) without removing their exit
program registrations. Each agent should have at most one; none if managedLogs is false.
What to do:
-
Find the number of the registration to keep: on the IBM i, run (with the agent's control library for
SQDR):SELECT PROPERTYVALUE FROM SQDR.SQ_PROPERTIES WHERE PROPERTYNAME = 'ExitProgram'; -
In
WRKREGINF, type8next toQIBM_QJO_DLT_JRNRCV, and remove (option4) the otherCADLTRCVentries of that library.
Or remove all the agent's entries, run DELETE FROM SQDR.SQ_PROPERTIES WHERE PROPERTYNAME = 'ExitProgram', and restart
the agent, which registers the exit program again. If the library exists but has no SQ_PROPERTIES table, the agent
was deleted without cleaning up the IBM i: remove its registrations (see
Remove the Db2 for i exit program).
Latency rose after a move to a new IBM i¶
Replication that ran with a fraction of a second of latency now lags by seconds.
Cause: journal caching (IBM i option 42, HA Journal Performance) on the new system holds journal entries in memory for up to the cache wait time before the agent can read them.
What to do: turn journal caching off for the journals the agent reads, or shorten the cache wait time (see Performance).
Trace the IBM Toolbox for Java¶
When Stelo Support asks for a trace of the connections to the IBM i, turn on IBM Toolbox for Java tracing in the service that makes them: the SQDR Plus Jetty service (the SQDR Control Center and its wizards) or the Launch Agent (the Capture Agents). For example, for the Jetty service:
- Open
jetty\wrapper\conf\wrapper.confin the Stelo Capture program folder (for exampleC:\Program Files\StarQuest\sqdrplus), and note the highestwrapper.java.additional.N number, for example 7. -
Create the file
C:\ProgramData\StarQuest\sqdrplus\jetty\wrapper-local.confwith the next number:wrapper.java.additional.8=-Dcom.ibm.as400.access.Trace.category=error,warning,information,diagnosticTo write the trace to its own file, add a line such as
wrapper.java.additional.9=-Dcom.ibm.as400.access.Trace.file=c:\\temp\\trace.out. -
Restart the SQDR Plus Jetty service. The trace goes to
C:\ProgramData\StarQuest\sqdrplus\jetty\logs\wrapper.logand grows quickly. - When you're done, delete or rename
wrapper-local.confand restart the service.
For the Launch Agent, the files are capagent\wrapper\conf\wrapper.conf and
C:\ProgramData\StarQuest\sqdrplus\conf\wrapper-local.conf, and the log is
C:\ProgramData\StarQuest\sqdrplus\conf\wrapper.log. See IBM's documentation of the Toolbox for Java trace
properties.
Other messages¶
See also, for Db2 for i sources:
- New baseline needed: the Capture Agent lost its log position
- QZRCSRVS jobs for user SQDR in MSGW status
- Using Stelo Capture alongside HA products (MIMIX, iCluster, DataMirror)
- Tools for testing connectivity (ping, Test-NetConnection, odbctest, isql, jping)
- Changing the user profile that installed SQDR Plus
For any other message, see Error messages.
Db2 for i as a destination¶
Setting it up: Db2 for i.
"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.
Other problems¶
See also:
- "The UPDATE or DELETE statement does not include a WHERE clause" when a baseline empties a Db2 for i table: see Why the tables must be journaled
- ALTER DROP processing for Db2 for i destinations
- Common StarSQL Error Messages
- Testing the connection
- Destination data type differs from the source
- Group polling error caused by a trigger on the destination table