Skip to main content

ctrepd

Replication transaction log utility

The FairCom replication utility, ctrepd, provides a simple replication environment to quickly troubleshoot specific replication-related applications. The ctrepd utility can be used when you need to benchmark your replication performance as it logs a wealth of transaction replication information.

This utility can be used to set up or fix some replication requirements — for example. it can be used to set the log requirements for a specific Replication Agent ID, as explained in Set the source server's log requirements.

Normally the Replication Agent sets the source server's log requirements based on how far it has processed the activity in the source server's transaction logs. But if the Replication Agent is taken offline, an administrator might want to remove the log requirement so that the source server does not continue to keep old transaction logs.

Note

If the source server is allowed to delete old transaction logs and it is desired to restart the Replication Agent at a later time at a later log position to continue replicating changes, it is necessary to resync the replicated data files on the target system with the files on the source server as of the Replication Agent's new starting log position. Otherwise, if there was activity on the source system between the log position at which the Replication Agent stopped and the new log position at which the Replication Agent began, the source and target files will be out of sync.

How ctrepd can be used to change log requirements:

The ctrepd utility supports an option that is specifically designed to set the log requirements for a specific Replication Agent ID.

  1. Use ‑setlog:0 to remove the log requirement.

  2. Use ‑setlog:LOG_NUMBER to change the log requirement to the specified log number.

  3. Use ‑setlog:current to use the server's most recent transaction log.

Example 1. Remove transaction log requirement
ctrepd -setlog:0 -unqid:REPLID SERVERNAME

Replication log reader connected to data source.

Successfully removed transaction log requirement for replication ID 'REPLID'


Example 2. Set transaction log requirement to log 33
ctrepd -setlog:33 -unqid:REPLID SERVERNAME

Replication log reader connected to data source.

Successfully set required transaction log for replication ID 'REPLID' to 33


Example 3. Set transaction log requirement to current log (37)
ctrepd -setlog:current -unqid:REPLID SERVERNAME

Replication log reader connected to data source.

Successfully set required transaction log for replication ID 'REPLID' to 37


The procedure in this sect can be used to change Replication Agent's required minimum log.

Note

You may need to resync the files on the target server with the source server after performing these procedures. This is because the source server might delete logs that the agent hasn't processed yet. However, if the Replication Agent starts once, sets a required log, and is not used after that, these procedures will remove the log requirement and no other action will be needed.

To change Replication Agent's required minimum log:
  1. Monitor Replication Agent's current position.

    Example 4. Replication Agent current position

    In this example, the Replication Agent is using unique ID of RA and its minimum required log is 52. The agent is currently connected. The name would be listed as ‑RA if it is not connected.

    # ctstat -var -h 1 -t -i 2 -u ADMIN -p ADMIN -s SOURCE_SERVER_NAME
    
    Mon Apr 27 08:43:30 2015
    name                               lowlog  curlog       curpos
    source(SERVER)                         49      52     23251686
    RA                                     52      52     23250783


  2. Shut down the Replication Agent if it is running.

  3. Run the ctrepd utility and use the -setlog:0 option to remove a log requirement.

    Example 5. ctrepd utility with the -setlog:0 option
    # ctrepd -unqid:RA -setlog:0 -inow SOURCE_SERVER_NAME
    
    FairCom DB(tm) Version 10.6.0.40037(Build-150422)
    Transaction Log Entry Reader for Replicated Files
    
    Copyright (C) 1992 - 2015 FairCom Corporation
    ALL RIGHTS RESERVED.
    
    Replication log reader connected to data source.
    Successfully removed transaction log requirement for replication ID 'RA'


  4. Check the log requirements again.

    Note

    The server will delete old logs only after it creates a new transaction log, so you won't necessarily see the number of existing logs decrease immediately.

    Example 6. Requirements log
    # ctstat -var -h 1 -t -i 2 -u ADMIN -p ADMIN -s SOURCE_SERVER_NAME
    
    Mon Apr 27 08:47:38 2015
    name                               lowlog  curlog       curpos
    source(SERVER)                         49      52     23252068