Control and staging databases¶
Errors from the databases SQDR keep their own data in: the Replicator Service's
control database, the Stelo Capture control database SQDRC, and each Capture
Agent's staging database (SQDRP0, SQDRP1 and so on) in Db2 for LUW on the Stelo VM (see
Programs, services and files).
Replication stops: Db2 on the Stelo VM isn't running¶
Symptoms
One or more of these, often after a reboot, operating system patches, a move of the server, or a password change:
-
The Capture Agents don't start, or show errors in the SQDR Control Center, with:
Error opening socket to server localhost/... on port 50,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001 -
The SQDR Control Center shows no subscriptions or no agent summary.
- Incremental groups report polling errors in the Data Replicator Manager.
- The Replicator Service doesn't start, when its control database is in the same Db2.
Cause
The Db2 instance on the Stelo VM isn't running, so neither are the staging databases and SQDRC, although
the Stelo Capture services may look fine. Causes seen: the Db2 service didn't start after a reboot; the password of the
Windows account that runs the Db2 service changed; in the Docker container, the Db2 engine stopped.
What to do
Start Db2 (Windows):
- Start the Db2 service of the instance (its name ends with the instance name, for example
DB2-0). - If it doesn't start, run
db2startin a Db2 command window run as an administrator. - If it fails to log on, the password of the account it runs as has probably changed: enter the new password on the service's Log On tab and start it again. If the same account is the Db2 user of Stelo Capture, also follow Control database password.
When the Db2 service starts, the scheduled task that the SQDR Plus installer created activates SQDRC (see
Changes to Db2 and
Start and stop Db2).
Start Db2 (Docker): in the container, check whether the Db2 engine runs, and start it as the instance owner if it doesn't:
ps -ef | grep db2sysc
su - db2inst1
db2start
Then check the agents and the service:
- Check that each Capture Agent is running, and start any that isn't.
- Subscriptions that are Offline must be taken Online and then need a baseline (see Take subscriptions offline and online).
- Check that the Replicator Service is running, and start it if it stopped or couldn't start (see
Start and stop the service). In Docker, use
sqdrsvc-statusandsqdrsvc-startin a login shell (see Start and stop the services).
Prevention
- After every reboot or patching of the Stelo VM, check that Db2 is running before you look at anything else.
- Give the accounts that run Db2 and Stelo Capture passwords that don't expire, or plan each password change (see Change the passwords Stelo Capture uses).
- If Db2 stops by itself repeatedly, send the Stelo Capture logs, which include
db2diag.log, to Stelo Support (see Send logs to Stelo Support).
SQDRSVC error 1010 or 2012: permission denied on the control database¶
Symptom
The Replicator Service doesn't start, or logs errors like these (see Logs):
SQDRSVC Error ID 1010: ODBC message: SQLSTATE 42000, native error 229, [Microsoft]...[SQL Server]The SELECT
permission was denied on the object 'sqdrver', database 'ControlDB', schema 'dbo'.
SQDRSVC Error ID 1010: ODBC message: SQLSTATE 08004, native error 916, [Microsoft]...[SQL Server]The server principal
"NT AUTHORITY\SYSTEM" is not able to access the database "ControlDB" under the current security context.
SQDRSVC Error ID 2012: Initialization of incremental support failed (retrying). Error: ODBC message: SQLSTATE 42000,
native error 229, [Microsoft]...[SQL Server]The INSERT permission was denied on the object 'statistic', database
'ControlDB', schema 'dbo'.
Cause
The Replicator Service's Windows account can't read or write the control database. This happens most often with a SQL
Server control database reached with Windows authentication: one user created the control database with the SQDR
Configuration Tool, but the service runs as another account. With Run under the LocalSystem account., the service
runs as NT AUTHORITY\SYSTEM.
What to do
Give the service's account read and write access to the control database:
- In SQL Server Management Studio, under Security › Logins, open the properties of the service's account (for
example
NT AUTHORITY\SYSTEM; add it if it isn't listed). - On User Mapping, tick the control database, and under Database role membership, tick db_datareader and db_datawriter. If the same database is also a destination reached with Windows authentication, tick db_ddladmin too, so that the service can create tables.
- Restart the Replicator Service.
For the account the service runs as, see Windows Service.
SQL4306N on SQDR.GETJARVERSION after an upgrade or migration¶
Symptom
When a Capture Agent starts, its log (the Diagnostics tab) has a warning that it
failed to call SQDR.GETJARVERSION, with:
DB2 SQL Error: SQLCODE=-4306, SQLSTATE=42724, SQLERRMC=SQDR.GETJARVERSION;...;getJarVersion;...
SQL4306N means that Db2 couldn't call the Java method of the stored procedure.
Cause
The Capture Agent's stored procedures are Java routines, installed in each staging database as the jar
CAPTUREPROCS_JAR. Each staging database keeps its own copy. After an upgrade, a move to a new server or a restore of a
staging database, a staging database can still have the copy of an earlier release, which doesn't match the procedures
the agent calls.
What to do
Stelo Capture does this for you: when the Launch Agent starts, before any Capture Agent, it checks the jar
(UDBProcs.jar) in SQDRC and in each staging database, and replaces it if it's older than the installed Stelo Capture
(see What the Stelo Capture upgrade changes). Each replacement is logged
in the Launch Agent log. Replace the jar yourself only:
- for the staging database of a disabled or standby Capture Agent, which the Launch Agent skips;
- if the Launch Agent log has a SEVERE message that Db2 still reports another version after the replacement.
Always use the UDBProcs.jar of the installed release, never one from an earlier release:
-
Find the staging databases that fail. An agent's staging database is in its controlDbUrl on the Configuration tab. To test one, open a Db2 command window as an administrator and run:
db2 connect to SQDRP0 db2 "CALL SQDR.GETJARVERSION(?, ?)" db2 connect resetA working database returns the versions; a failing one returns
SQL4306N. -
Stop the Capture Agents that use the database (see Stop).
-
Connect as the Db2 user of Stelo Capture and replace the jar. The file is in the
capagentfolder of the Stelo Capture program folder:db2 connect to SQDRP0 user SQDR db2 set current schema SQDR db2 "CALL SQLJ.REPLACE_JAR('file:C:\Program Files\StarQuest\sqdrplus\capagent\UDBProcs.jar', 'CAPTUREPROCS_JAR')" db2 commit db2 connect resetReplace
SQDRP0with the staging database, andSQDRwith the Db2 user if it's different. -
Run
SQDR.GETJARVERSIONagain to check, then start the agents with Start/Restart. - Repeat for every staging database that fails.
Prevention
After an upgrade, or a move of Stelo Capture to a new server, test SQDR.GETJARVERSION in every staging database before
you resume replication (see Move to another computer: Stelo Capture).
SQL1646N or SQL1042C: fenced user ID in a staging database¶
Symptoms
-
Incremental groups stop applying changes and are paused, often all the groups of one source, with a message such as:
Stored procedure SQDR.GETCHANGE3 ... failed. ODBC message: SQLSTATE , native error -1646, [StarSQL][StarSQL ODBC Driver][DB2 Universal DataBase]A routine failed because the fenced user ID cannot access required files in the sqllib directory or other instance or database directories. -
The Db2 diagnostic log (
db2diag.log) hasSQL1646Nand, next to it,SQL1042C An unexpected system error occurredfor a staging database (DB : SQDRPn). You can read it under Server Diagnostics in the SQDR Control Center. - Sometimes the
C:drive also fills up with Db2 dump files.
Cause
The Db2 user that Stelo Capture uses (normally SQDR) is missing database authorities on the staging database, so Db2
can't run the fenced Java routines for it.
What to do
Grant DBADM and DATAACCESS on each affected staging database to that user.
- Find the staging database: it's named in the
db2diag.logentry, and in the Agent connection string on the source's Advanced tab in the Data Replicator Manager (Server=SQDRPn). - Stop replication: stop the Replicator Service and the Stelo Capture services, as in The standard stop.
-
Open a Db2 command window as an administrator, signed in as the Db2 instance owner (for example
db2admin), and run, for each affected staging database:db2 connect to SQDRP0 db2 grant dbadm on database to user SQDR db2 grant dataaccess on database to user SQDR db2 connect resetReplace
SQDRP0with the staging database, andSQDRwith the user the Capture Agents connect with, if it's different. -
Start the services again (see Start and stop the service), and check in the SQDR Control Center that the Capture Agents are running.
- Resume the groups if they're paused.
- If
C:filled up, free space on it: Db2 needs room to run.
If it comes back, send the Stelo Capture logs to Stelo Support. Other errors from the same Java routines, such as Java heap or memory errors, need a different fix.
SQLCODE=-302, SQLSTATE=22001 in a staging table¶
Symptom
An error about particular data in a CHAR or VARCHAR column, naming the staging database:
com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001
Cause
A value is too large for its column in the staging table once it's converted to UTF-8. For example, a SQL Server
source column can hold the character x8D, which becomes 3 bytes in UTF-8.
The staging tables' character columns are widened by the agent's inflation percentage: by default 100% (twice the source size) when the staging database isn't the same type as the source, which is usually more than enough.
What to do
This is rare. Work with Stelo Support, who will confirm the cause, and then either alter the staging table, or:
- Raise the agent's
inflationtemporarily (for example from 100 to 200). - Drop the subscription, and wait for pruning to remove the staging table (up to 30 minutes).
- Create the subscription again.
- Set
inflationback.
SQLCODE=-973, SQLERRMC=AGENT_STACK_SZ¶
Symptom
An incremental group with a very large number of tables fails to get changes:
Stored procedure SQDR.GETCHANGE3 ... returned error 11. com.ibm.db2.jcc.am.SqlException: DB2 SQL Error:
SQLCODE=-973, SQLSTATE=57011, SQLERRMC=AGENT_STACK_SZ
Cause
A known issue when very many tables are involved in one request for changes from the staging database.
What to do
On the group's Advanced tab, set Transaction Limit to about 100 instead of 0 (unlimited), so that each request covers fewer source transactions (see Group properties).
SQLCODE=-670 when adding an incremental subscription¶
Symptom
An incremental subscription can't be created, while a snapshot of the same table works:
Failed to add incremental subscription at Capture Agent for source table 'dbo.mytable'. Snapshot could not be
started. Error: Stored procedure SQDR.ADDSUBSCRIPTION ... returned error 11. ...
Failed to add subscription: DB2 SQL Error: SQLCODE=-670, SQLSTATE=54010, SQLERRMC=32677;;71136 ...
Cause
The source table's rows are too large for the staging database. Staging databases created before SQDR Plus 4.50 don't
have Db2's extended_row_sz setting turned on; later ones do. Such a staging database can still be in use after
upgrades.
What to do
- Find the agent's staging database in its controlDbUrl on the
Configuration tab:
jdbc:db2://localhost:50000/SQDRPn:.... - Stop the agent (see Stop).
-
In a Db2 command window run as an administrator:
db2 connect to SQDRPn db2 update db cfg using extended_row_sz ENABLE db2 connect reset -
Start the agent, and run the subscription again.
"The transaction log for the database is full"¶
Symptom
An error with SQLSTATE 57011 and native error or SQLCODE -964 (SQL0964C), for SQDRC or a staging database.
For SQDRC, it can stop the Replicator Service from starting:
Initialization of incremental support failed (retrying). Error: ODBC message: SQLSTATE 57011, native error -964,
[StarSQL][StarSQL ODBC Driver][DB2 Universal DataBase]The transaction log for the database is full.
Cause
A transaction needed more log space than the database has. For SQDRC, a key log left on for a long time is a known cause: it adds rows to the control database with every change applied (see Key log).
What to do
- If the key log is on, turn it off (see Turn the key log off).
- Make the database's transaction log larger: see Transaction log size.
SQL0289N or SQLCODE=-289: unable to allocate new pages in table space¶
Symptom
A Capture Agent, or adding an incremental subscription, fails with:
DB2 SQL Error: SQLCODE=-289, SQLSTATE=57011, SQLERRMC=USERSPACE1
SQLCODE=-289 is Db2's SQL0289N Unable to allocate new pages in table space; SQLERRMC names the table space.
Cause
The drive that holds the staging database is full, usually after a backlog of changes.
What to do
Free or add disk space: see Add storage to a table space, Reclaim table-space storage and Free disk space on the server. Then check that the Replicator Service fetches the changes, so the backlog shrinks.
SQLCODE=-443, SQLSTATE=38553 after a Db2 update¶
Symptom
After Db2 on the Stelo VM was updated to another fix pack, some Capture Agents fail on catalog calls with:
SQLCODE=-443, SQLSTATE=38553, SQLERRMC=GETTYPEINFO;SYSIBM:CLI:-805
Cause
The Db2 CLI catalog packages in the staging database don't match the new Db2 level.
What to do
Bind them again, in each affected staging database:
- Find the agent's staging database (see The databases and where they are).
- Open DB2 Command Window - Administrator and go to Db2's
bndfolder, for examplecd "C:\Program Files\IBM\SQLLIB\bnd". -
Connect as a user that can bind packages (for example the Db2 instance's service account) and bind
db2schema.bnd:db2 connect to SQDRP0 db2 bind db2schema.bnd blocking all grant public sqlerror continue db2 terminate -
Restart the agents with Start/Restart.
To avoid it, run db2updv115 on every database after a Db2 update (see
Update Db2).
SQLCODE=-805, SQLSTATE=51002: package NULLID.SYSLH... not found¶
Symptom
Rare. A Capture Agent's log (the Diagnostics tab) repeatedly shows, often with many rollbacks and notifications:
DB2 SQL Error: SQLCODE=-805, SQLSTATE=51002, SQLERRMC=NULLID.SYSLH103 ...
Cause
The agent has more statements open at once in its staging database than Db2's default CLI packages allow.
What to do
Bind the CLI packages again with more packages per isolation level (5 instead of the default 3), as a user that can bind packages:
cd "C:\Program Files\IBM\SQLLIB\bnd"
db2 connect to SQDRP0
db2 bind @db2cli.lst blocking all grant public sqlerror continue CLIPKG 5
db2 terminate
SQL1005N when adding a Capture Agent: the database already exists¶
Symptom
Add Capture Agent fails with:
An error occurred. Unable to validate connection parameters
remoteException Cannot create database: SQDRP9.
SQL1005N The database SQDRP9 already exists in either the local database directory or system database directory.
But db2 list db directory doesn't list SQDRP9, and db2 drop db SQDRP9 fails.
Cause
The database exists on disk but isn't cataloged. This happens when an agent was deleted while its database was in use (so it wasn't dropped), and Db2 was later reinstalled: the reinstall catalogs only the databases you catalog again.
What to do
Catalog the leftover database, then drop it:
- Find the drive that holds the databases:
db2 list db directoryshows it for the other databases (for exampleE:).db2 list db directory on E:then lists the leftover database too, with its directory (for exampleSQL00019). -
Catalog and drop it:
db2 catalog db SQDRP9 on E: db2 terminate db2 drop db SQDRP9 -
Add the Capture Agent again.
If the drop fails with SQL1031N The database directory cannot be found on the indicated file system and a connection
with SQL1042C, the database's directory (for example E:\DB2\NODE0000\SQL00019) was deleted by hand. Copy another
database's directory under that name (the content doesn't matter, the database is being dropped), then drop it. See also
IBM's Restore database error with SQL1005N.
SQL30061N when adding a Capture Agent: "SQDRPn" not found¶
Symptom
Add Capture Agent fails, although the database doesn't exist and db2 create database SQDRP0 works by hand:
addAgent Failed to add Agent
Cannot enumerate existing databases: java.rmi.RemoteException
Cannot create database : SQDRP0. SQL30061N The database alias or database name "SQDRP0 " was not found at the remote node.
Cause
Seen on servers where agents were often added and deleted: the Launch Agent's view of the databases is out of date.
What to do
Restart the SQDR Plus Launch Agent service (this restarts the Capture Agents), then add the agent again.
"User ID revoked" (ERRORCODE=-4214) or SQL30082N reason 19¶
Symptom
Adding a Capture Agent, or connecting to a staging database, fails with:
Connection authorization failure occurred. Reason: User ID revoked. ERRORCODE=-4214; SQLSTATE=28000
and connecting as that user in a Db2 command window fails with:
SQL30082N Security processing failed with reason "19" ("USERID DISABLED or RESTRICTED"). SQLSTATE=08001
The Windows account isn't disabled, and a command window running as that user can connect without naming a user.
Cause
Stelo Capture connects to Db2 over the network, even on the same server. The local security policy Deny access to this
computer from the network includes Local account and member of Administrators group, and the Db2 user (for
example sqdr) is a member of the local Administrators group.
What to do
- In
secpol.msc, under Local Policies › User Rights Assignment, check Deny access to this computer from the network (and that Access this computer from the network includes the user). - Remove the Db2 user from the local Administrators group: it doesn't need it (see Why the Db2 user needs no authority). Or use a domain account, which the policy doesn't cover.
See IBM's Error SQL30082N Reason Code 19 or 24.
SQLCODE=-101, SQLSTATE=54001 when the Replicator Service fetches changes¶
Symptom
Incremental groups fail to get changes, with:
Stored procedure SQDR.GETCHANGE2 ... returned error 11. com.ibm.db2.jcc.am.SqlException: DB2 SQL Error:
SQLCODE=-101, SQLSTATE=54001
and db2diag.log reports that memory ran out. SQLCODE=-101 means a limit, such as memory, was reached.
Cause
The Stelo VM is a Hyper-V virtual machine with Dynamic Memory and a low startup memory. Db2 sizes itself from the memory present when it starts, which isn't enough later.
What to do
Raise the virtual machine's startup and minimum memory to at least the memory in Requirements, then restart Db2. See Db2 memory.
SQL1224N when restoring a staging database¶
Symptom
Restoring a database, for example to move it to another drive, fails with:
SQL1224N The database manager is not able to accept new requests, has terminated all requests in progress, or has
terminated the specified request because of an error or a forced interrupt. SQLSTATE=55032
Cause
Seen when the database was still cataloged in an LDAP directory after it was dropped.
What to do
Remove the database from the LDAP catalog (db2 uncatalog ldap db SQDRP0), then run the restore again.
The Db2 command window reports "'C:\Program' is not recognized"¶
Symptom
Opening a Db2 command window shows, for example:
'E:\Program' is not recognized as an internal or external command, operable program or batch file.
Or the Db2 installer's launchpad shows no install options.
Cause
Db2 is installed (or its installer is) in a folder whose name has spaces, such as E:\Program Files\IBM\SQLLIB, on a
drive where Windows' short (8.3) file names are turned off. Short names are usually on for C: and often off for other
drives.
What to do
- In an elevated command prompt, check the drive:
fsutil 8dot3name query E:. - Give the folder a short name, which can avoid reinstalling:
fsutil file setshortname "E:\Program Files" PROGRA~1. - If that's not possible, turn short names on for the drive (
fsutil 8dot3name set E: 1), and create the folders with spaces again, which means reinstalling Db2 (see Reinstall Db2) and the other programs in them. Or reinstall Db2 in a folder without spaces, such asE:\DB2\SQLLIB.
Before installing Db2 on a drive other than C:, turn short names on for it. See IBM's
DB2CMD fails with 'C:\Program' is not recognized.