Skip to content

Control database

The control database holds the Replicator Service's configuration and history: sources, destinations, subscriptions, groups, schedules, settings, users and the positions incremental groups have reached. The service can't run without it; backing it up protects your replication setup.

Supported databases

The control database is a Microsoft SQL Server database (typically ControlDB) or a Db2 for Linux, UNIX and Windows database (typically SQDRC), on the Replicator Service's computer or another server. The tables are in the control database user's schema: SQDR on the usual Db2 setup, often dbo on SQL Server (see Control Table Qualifier).

On SQL Server, keep the database's AUTO_CLOSE option off: with it on, the service slows down and can fail with "Database is being recovered" messages (see tempdb and AUTO_CLOSE).

In the Docker container, it's the SQDRC Db2 database inside the container; see Manage the Docker container.

The SQDR Configuration Tool creates the control tables, or connects existing ones, when the Replicator Service is installed (see Installation); the database itself must exist first. The connection (data source, user and encrypted password) is saved in sqdr.properties on the service's computer, shown as Properties Path on the Service tab.

A SQL Server control database

On the Stelo VM, use SQDRC. A SQL Server control database suits a Replicator Service on a server of its own, where SQL Server is already in use (see Control database for the supported versions). The database can be on the Replicator Service's computer or another server.

  1. SQL Server. If there's none yet, install a supported edition; the free Express edition is enough. Install SQL Server Management Studio too. Choose mixed mode authentication if the service will connect with a SQL Server login, and note the login's password.
  2. The database. Create an empty database, for example controlDB.
  3. The login. Give the login the service connects with the db_owner role on that database (in SQL Server Management Studio: Security › Logins, the login's Properties, User Mapping). The SQDR Configuration Tool creates the control tables with it, and the Replicator Service creates and alters its own tables when it upgrades the control database.
  4. The driver. On the Replicator Service's computer, install Microsoft ODBC Driver 17 or 18 for SQL Server.
  5. The SQDR Configuration Tool. Connect with a connection string (see Sample connection strings) and choose Create new control tables.

When a database administrator creates the database. If company policy doesn't let the SQDR administrator create databases, the database administrator does steps 2 and 3. With Windows authentication, the login is the domain account the Replicator Service will run as (for example MYDOMAIN\sqdrsvc): run the SQDR Configuration Tool as that account, and set the service to run as it (see Change the service account). The account then needs the Log on as a service right on the Replicator Service's computer: check that a group policy doesn't remove it. If the service can't use the database, see SQDRSVC error 1010 or 2012.

What it holds

Tables What they hold
sqdrver The control database version and the Replicator Service's settings (everything on Service settings except the control database connection).
srcdest Sources and destinations, with their connection information.
subscription, columns, sqindexes, sqconstraints Subscriptions, their column mappings, indexes and constraints.
groups, group_subscriptions Groups and their members.
ir_group, ir_subscription, ir_position Incremental group and member settings, and the last change each incremental group applied.
ss_position Checkpoints of baselines and snapshots, for Checkpoint/Restart, and the last run of each subscription (a group's last run is in groups).
ss_slice The state of each slice of a parallel baseline. Created by the Replicator Service when it starts; on a Db2 control database, the control database user needs the REFERENCES privilege on SUBSCRIPTION for it.
schedule Group and subscription schedules.
statistic Replication history: one record per run, with its result, row counts and messages, except the last run, which is kept apart.
schema_history The control database upgrades the Replicator Service has applied (see Upgrades).
ir_keylog The key log: the changes applied by incremental groups whose change data logging uses SQLOGGER.
rbac_users, rbac_roles, rbac_groups, rbac_members, rbac_methods Role Based Access Control.
rbac_journal The audit journal.
sqdr_macros, sqdr_secret SQDR macros and secrets (encrypted).

The Capture Agents' staging data isn't here: Stelo Capture keeps it in its own staging databases. To look inside without a database tool, use the reports on the Query tab.

Size and growth

The configuration tables stay small. Three kinds of data grow with activity:

Data How it's kept in check
Replication history (statistic) Pruned regularly to the limits on the Logging tab of Service Settings; see How long history is kept.
Audit journal (rbac_journal) Entries older than Audit journal retention (7 days by default) are deleted about every 15 minutes; see Retention. You can also delete entries on the Audit tab of the Monitoring page.
Key log (ir_keylog) Grows only while a group's change data logging writes to it, and isn't pruned. Turn it off when you've finished investigating, and delete the rows with Delete Statistics on the members; see Key log.

Keep the database's own maintenance running, as for any busy database: transaction log backups or truncation on SQL Server, and log and statistics maintenance on Db2. The service's pool of connections to the control database is set on ControlDB.

Back up the control database

Back it up with the database's own tools, on the same schedule as your other production databases, and before every upgrade. Also keep a copy of sqdr.properties (see Back up the configuration).

  • SQDRC on the Stelo VM: back it up together with the staging databases, offline or online, and restore it, as in Back up the databases and Restore a database. The automatic backups the SQDR Plus installer turns on can't be relied on alone (see What the installer sets up).
  • SQL Server: in SQL Server Management Studio, right-click the database and choose Tasks › Back Up, or use your usual backup jobs.

A backup restores the configuration and the history. Incremental groups also depend on their Capture Agents' staging data: after restoring an older backup, check the incremental groups and run a new baseline where needed.

Move the control database

To move it to another database server, or to a new database:

  1. Wait for running group runs to finish, then stop the Replicator Service (see Start and stop). Stopping the service cancels snapshots in progress and pauses incremental replication.
  2. Back up the control database and restore it on the new server, with the database's tools.
  3. Run the SQDR Configuration Tool, connect to the new database, and choose Use existing control tables. This updates sqdr.properties.
  4. Start the Replicator Service, connect with the Data Replicator Manager, and check that the incremental groups are running.

To move SQDRC to another drive of the same server, nothing changes for the Replicator Service: see Move a database to another drive.

To move to a different type of database (from SQL Server to Db2 for LUW, or back), contact Stelo Support: the configuration isn't moved with a backup and restore, but copied table by table into new control tables.

If the service can't reach its control database, it doesn't start; see SQDRSVC error 1010 or 2012: cannot access the control database.

Upgrades

The service checks the control database's format when it starts. For the whole upgrade procedure, see Upgrade on Windows or Upgrade the Docker container.

The Replicator Service upgrades the control database itself when it starts, in one step, from control table version 6.10 (the version of every SQDR 6 release). Nothing needs to be run by hand:

  • Each step runs once, and its outcome is recorded in schema_history: the step, when and on which computer it was applied, and by which service build. At each start the service log gives the control database's level ("Control database level ..."), and when a step is applied, "Control database upgraded to level ...".
  • If a step doesn't complete, the service log says why ("Control database upgrade to level ... did not complete"), and the service tries again at its next start.
  • Service Settings › Control Database shows the control database's level, the service's level and the upgrade history, with a warning while an upgrade hasn't completed (see Control Database).
  • The support bundle (see Sending logs to Stelo Support) includes ControlDbHistory.log: the control database's level and its schema_history.

Back up the control database before you upgrade (see Back up the control database). An upgraded control database can't be downgraded: to go back to an earlier SQDR version, restore the backup. Run only one Replicator Service against a control database.

Control tables older than version 6.10 (SQDR 5.x): the service stops with "controlDB version mismatch - run config". Run the SQDR Configuration Tool and choose to use the existing control database, to update the tables to version 6.10 (see Upgrade SQDR). The service then applies the 7.0 step itself when it starts.