StarQuest Technical Documents

Transferring SQDR Control Database Information to Files

Last Update: 29 December 2022
Product: StarQuest Data Replicator
Version: 3.4 or later
Article ID: SQV00DR003

Abstract

OBSOLETE - This function is no longer used (and is not useful for Db2 control databases) and is no longer supplied inSQDR 6.x & later.

 

The StarQuest Data Replicator software includes a WRITEDB.CMD utility that uses the SQL Server Bulk Copy Program (BCP) to copy the contents of the Data Replicator control database tables to files. If you encounter a problem while using the Data Replicator, StarQuest Technical Support may ask that you run WRITEDB.CMD to help troubleshoot the problem.

Solution

Follow the steps below if you need to run WRITEDB.CMD to generate control database information that you can send to StarQuest Technical Support.

  1. Make sure the SQL Server service is running.
  2. Open a Command window (Windows Start-->Run, then enter cmd).
  3. Change to the directory where the Data Replicator is installed.
  4. Run the WRITEDB command, substituting the parameters given in the following syntax
    as appropriate for your SQDR environment.
  5. Examine the WRITEDB.LOG file and the target directory to confirm the WRITEDB command
    completed successfully. Send the output files in a compressed folder to the StarQuest
    Technical Support Engineer you are working with to solve a Data Replicator problem.

WRITEDB.CMD Syntax

Following is the syntax of the WRITEDB command.

writedb.cmd control_DB_name control_DB_owner target_directory [loginID] [password] [server\instance]

where:
control_DB_name is the name of the SQDR control database
control_DB_owner is the owner of the database tables
target_directory is the location where you want to write the files
loginID is the userID for logging into the SQL Server database
password is the password for the SQL Server loginID
server\instance is the name of the SQL Server and instance to which you want to connect

Usage Notes

If you do not specify a loginID and password the command is executed using Windows integrated security.

The bcp utility connects to the default instance on the local computer if you do not specify a server. If you do not specify an instance, the bcp utility connects to the default instance on the specified server.

If you want to specify a server but do not want to specify a loginID and password, enter a dash (-) in place of the loginID and password parameters.

Running WRITEDB.CMD again using the same output directory overwrites the .txt, .dat, and .log files that were generated from a previous execution of WRITEDB.CMD.

Examples

The following command would write the user-defined tables of a control database named ControlDB with an owner of dbo to the \temp directory of drive C using the sa user ID and password.

writedb.cmd ControlDB dbo C:\temp sa password4sa

The following command would write the user-defined tables of a control database named ControlDB with an owner of dbo to the \temp directory of drive C using Windows integrated security (no SQL Server loginID and password), connecting to the default instance of a SQL Server named myserver.

writedb.cmd ControlDB dbo C:\temp - - myserver

Output

The WRITEDB utility creates the following files in the target directory. Files with a .txt extension or a .csv extension can be viewed using most spreadsheet applications. Files with an extension of .dat are data files that are written in native format to preserve the database data types.

Filename Description
appevt.csv A Comma Separated Value formatted file that contains events generated to the Application Event Log for the SQDR service.
sysevt.csv A Comma Separated Value formatted file that contains events generated to the System Event Log for the SQDR service.
columns.txt An ASCII text file with Information from the columns table of the control database.
groups.txt An ASCII text file with information from the groups table of the control database.
group_subscriptions.txt An ASCII text file with information from the group_subscriptions table of the control database.
ir_group.txt An ASCII text file with information about groups that contain incremental replication subscriptions.
ir_keylog.dat Contains key logging data.
ir_subscription.txt An ASCII text file with information about the incremental replication subscriptions.
sqconstraints.txt An ASCII text file with information from the sqconstraints table of the control database.
sqindexes.txt An ASCII text file with information from the sqindexes table of the control database.
srcdest.txt An ASCII text file with information from the srcdest table of the control database.
statistic.dat Contains data from the statistic table of the SQDR control database.
subscription.txt An ASCII text file with information from the subscriptions table of the control database.
writedb.log An ASCII text file with status information about the most recent execution of WRITEDB.CMD.
Program Files\sqdr\CrashDumps\ *.* Any files that have been written to the CrashDumps directory by the Windows dump facility due to an SQDR service failure.

DISCLAIMER

The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.