Contents Index Utilities and Options Reference The Database Extraction utility

SQL Remote User's Guide
  Utilities and Options Reference

The Message Agent


Purpose 

To send and apply SQL Remote messages, and to maintain the message tracking system to ensure message delivery.

Syntax 

dbremote | ssremote } [ options ] [ directory ]

Options 
Option Description
@filename Read in options from configuration file
@envvar Read in options from environment variable
-a Do not apply received transactions
-b Run in batch mode
-c "keyword=value; ..." Supply database connection parameters
-cq "keyword=value; ..." Supply database connection parameters for the stable queue (Adaptive Server Enterprise only)
-dl Display log messages on screen
-ek key Specify encryption key
-ep Prompt for encryption key
-e locale-string Locale setting (Adaptive Server Enterprise only)
-fq Full scan of the stable queue when sending messages (Adaptive Server Enterprise only)
-g n Group transactions consisting of less than n operations.
-i Scan transactions from the transaction log into the stable queue (Adaptive Server Enterprise only).
-k Close window on completion
-l length Maximum message length
-m size Maximum amount of memory used for building messages.
-o file Output messages to file
-os size Maximum file size for logging output messages
-ot file Truncate file and log output messages
-p Do not purge messages
-q Run with minimized window
-r Receive messages
-rd minutes Polling frequency for incoming messages
-ro filename Log remote output to file
-rp number Number of receive polls before message is assumed lost
-rt filename Truncate, and log remote output to file.
-ru time Waiting period to re-scan log on receipt of a resend.
-s Send messages
-sd time Send polling period
-t Replicate all triggers (Adaptive Server Anywhere only)
-u Process only backed up transactions
-ud On UNIX platforms, run as a daemon.
-v Verbose operation
-w n Number of worker threads to apply incoming messages (Not NetWare or Windows CE)
-x [ size ] Rename and restart the transaction log (Adaptive Server Anywhere only).
directory The directory in which old transaction logs are held (Adaptive Server Anywhere only)
Description 

The Message Agent sends and applies messages for SQL Remote replication, and maintains the message tracking system to ensure message delivery.

The name of the Message Agent executable is as follows:

You can also run the Message Agent from your own application by calling into the DBTools library. For more information, see the file dbrmt.h in the h subdirectory of your SQL Remote installation directory.

For Adaptive Server Anywhere, the user ID in the Message Agent command must have either REMOTE DBA or DBA authority. For Adaptive Server Enterprise, the user ID must have replication role.

The optional directory parameter specifies a directory in which old transaction logs are held, so that the Message Agent has access to events from before the current log was started.

The Message Agent uses a number of connections to the database. For a listing, see Connections used by the Message Agent.

For information on REMOTE DBA authority, see The Message Agent and replication security.

Option details 

@filename    Read in options from the supplied file.

The file may contain line breaks, and may contain any set of options. For example, the following command file holds a set of options for a Message Agent that starts with a cache size of 4 Mb, sends messages only, and connects to a database named field on a server named myserver:

-m 4096
-s
-c "eng=myserver;dbn=field;uid=sa;pwd=sysadmin"

If this configuration file is saved as c:\config.txt, it can be used in a command as follows:

ssremote @c:\config.txt

or

dbremote @c:\config.txt

@environment-variable    Read in options from the supplied environment variable.

The environment variable may contain any set of options. For example, the first of the following pair of statements sets an environment variable holding a set of options for a database server that starts with a cache size of 4 Mb, receives messages only, and connects to a database named field on a server named myserver. The set statement should be entered all on one line:

set envvar=-m 4096 -r
   -c "eng=myserver;dbn=field;uid=sa;pwd=sysadmin"
ssremote @envvar

-a    Process the received messages (those in the inbox) without applying them to the database. Used together with -v (for verbose output) and -p (so the messages are not purged), this option can help detect problems with incoming messages. Used without -p, this option purges the inbox without applying the messages, which may be useful if a subscription is being restarted.

-b    Run in batch mode. In this mode, the Message Agent processes incoming messages, scans the transaction log once and processes outgoing messages, and then stops.

-c "parameter=value; ..."    Specify connection parameters. For Adaptive Server Anywhere, if this option is not specified, the environment variable SQLCONNECT is used.

For example, the following statement runs dbremote on a database file named c:Program Files\Sybase\SQL Anywhere 9\asademo.db, connecting with user ID DBA and password SQL:

dbremote -c "uid=DBA;pwd=SQL;dbf=c:\Program Files\Sybase\SQL Anywhere 9\asademo.db"

The Message Agent must be run by a user with REMOTE DBA authority or DBA authority.

For information on REMOTE DBA authority, see The Message Agent and replication security.

The Message Agent for Adaptive Server Anywhere supports the full range of Adaptive Server Anywhere connection parameters. The Message Agent for Adaptive Server Enterprise supports the following connection parameters:

Parameter Description
UID Login ID
PWD Password
DBN (optional) Database name. If this parameter is not supplied, the connection defaults to the default database for the login ID.
ENG Adaptive Server Enterprise name.

-cq "parameter=value; ..."    Specify connection parameters for the stable queue. This option applies to Adaptive Server Enterprise only. If not supplied, the values default to the -c values.

-dl    Display messages in the Message Agent window or at the command prompt and also in the log file if specified.

Specify encryption key (-ek)    This option allows you to specify the encryption key for strongly encrypted databases directly at the command prompt. If you have a strongly encrypted database, you must provide the encryption key to use the database or transaction log in any way, including offline transaction logs. For strongly encrypted databases, you must specify either -ek or -ep, but not both. The command will fail if you do not specify a key for a strongly encrypted database.

Prompt for encryption key (-ep)    This option allows you to specify that you want to be prompted for the encryption key. This option causes a dialog box to appear, in which you enter the encryption key. It provides an extra measure of security by never allowing the encryption key to be seen in clear text. For strongly encrypted databases, you must specify either -ek or -ep, but not both. The command will fail if you do not specify a key for a strongly encrypted database.

-e locale-string    This option applies to Adaptive Server Enterprise only. Specify Adaptive Server Enterprise locale information. The locale string has the following format:

"language_name,charset_name[,sort_order]"

By default, the Message Agent uses the default locale, which is defined in the file sybase\locales\locales.dat.

If language_name and charset_name are not supplied, the Message Agent obtains them from Adaptive Server Enterprise. If sort_order is not supplied, the Message Agent uses a binary sort order (sort by byte value).

-fq    This option is for use only with Adaptive Server Enterprise. It permits a full scan of the stable queue when sending messages, starting from the oldest confirm_sent value in the sr_remoteuser table.

This feature is intended for occasional use to clean out a large stable queue. If, for example, a single user has not confirmed receipt of a message from a long time ago, the stable queue may be very large. However, by running -fq you can delete entries from more up-to-date users that have been confirmed, even though they are more recent than the cutoff value at which entries are deleted by default.

-g     nInstructs the Message Agent to group transactions containing less than n operations together with transactions that follow. The default is twenty operations. Increasing the value of n can speed up processing of incoming messages, by doing less commits. However, it can also cause deadlock and blocking by increasing the size of transactions.

-i    Scan transactions from the transaction log into the stable queue. This option is available for Adaptive Server Enterprise only. It is used when you wish to run a separate copy of the Message Agent for scanning the transaction log and for sending and receiving messages.

If none of -r, -i, or -s is specified, the Message Agent executes all three phases. Otherwise, only the indicated phases are executed.

For more information, see Running multiple Message Agents.

-k    Close window on completion when used together with the -o parameter.

-l length    Specifies the maximum length of each message to be sent, in bytes. Longer transactions are split into more than one message. The default is 50000 bytes and the minim length is 10000.

Caution    The maximum message length must be the same at all sites in an installation.

For platforms with restricted memory allocation, the value must be less than the maximum memory allocation of the operating system.

-m size    Specifies a maximum amount of memory to be used by the Message Agent for building messages and caching incoming messages. The allowed size can be specified as n (in bytes), nK, or nM. The default is 2048K (2M).

When all remote databases are receiving unique subsets of the operations being replicated, a separate message for each remote database is built up concurrently. Only one message is built for a group of remote users that are receiving the same operations. When the memory being used exceeds the -m value, messages are sent before reaching their maximum size (as specified by the -l option).

When messages arrive, they are stored in memory by the Message Agent until they are applied. This caching of messages prevents rereading of that are out of order messages from the message system , which may lower performance on large installations. When the memory usage specified using the -m option is exceeded, messages are flushed in a least-recently used fashion.

-o    Append output to a log file. Default is to send output to the screen.

-os    Specifies the maximum file size for logging output messages. The allowed size can be specified as n (bytes), nK (Kb), or nM (Mb). By default there is no limit, and the minimum limit is 10000 bytes.

Before SQL Remote logs output messages to a file, it checks the current file size. If the log message will make the file size exceed the specified size, SQL Remote renames the output file to yymmddxx.dbr (for dbremote) and yymmddxx.ssr (for ssremote) where xx are sequential characters ranging from AA to ZZ, and yymmdd represents the current year, month, and date.

If the Message Agent us running in continuous mode for a long time, this option allows you to manually delete old log files and free up disk space.

-ot    Truncate the log file and then append output messages to it. Default is to send output to the screen.

-p    Process the messages without purging them.

-q    For Windowing operating systems only, starts the Message Agent with a minimized window.

-r    Receive messages. If none of -r, -i, or -s is specified, the Message Agent executes all three phases. Otherwise, only the indicated phases are executed.

The Message Agent runs in continuous mode if called with -r. To have the Message Agent shut down after receiving messages, use the -b option in addition to -r.

-rd time    By default, the Message Agent polls for incoming messages every minute. This option (rd stands for receive delay) allows the polling frequency to be configured, which is useful when polling is expensive.

You can use a suffix of s after the number to indicate seconds, which may be useful if you want frequent polling. For example:

dbremote -rd 30s

polls every thirty seconds.

For more information on polling, see Tuning incoming message polling.

-ro    This option is for use at consolidated sites. When remote databases are configured to send output log information to the consolidated database, this option writes the information to a file. The option is provided to help administrators troubleshoot errors at remote sites.

For more information, see Troubleshooting errors at remote sites.

-rp    When running in continuous mode, the Message Agent polls at certain intervals for messages. After polling a set number of times (by default, one), if a message is missing, the Message Agent assumes it has got lost and requests that it be resent. On slow message systems, this can result in many unnecessary resend requests. You can set the number of polls before a resend request is issued using this option, to cut down on the number of resend requests.

For more information on configuring this option, see Tuning incoming message polling.

-rt    This option is for use at consolidated sites. It is identical to the -ro option except that the file is truncated on startup.

-ru    Control the resend urgency. This is the time between detection of a resend request and when the Message Agent starts fulfilling the request. Use this option to help the Message Agent collect resend requests from multiple users before rescanning the log. The time unit can be any of {s = seconds; m = minutes; h = hours; d = days}

-s    Send messages. If none of -r, -i, or -s is specified, the Message Agent executes all three phases. Otherwise, only the indicated phases are executed.

-sd time    Control the send delay which is the time to wait between polls for more transaction log data to send.

-t    All trigger actions are replicated. If you do use this option, you must ensure that the trigger actions are not carried out twice at remote databases, once by the trigger being fired at the remote site, and once by the explicit application of the replicated actions from the consolidated database.

To ensure that trigger actions are not carried out twice, you can wrap an IF CURRENT REMOTE USER IS NULL ... END IF statement around the body of the triggers. This option is available for Adaptive Server Anywhere only.

-u    Process only transactions that have been backed up. This option prevents the Message Agent from processing transactions since the latest backup. Using this option, outgoing transactions and confirmation of incoming transactions are not sent until they have been backed up.

In Adaptive Server Anywhere, this means only transactions from renamed logs are processed. In Adaptive Server Enterprise, this means that only transactions committed before the latest dump database or dump transaction statement are processed.

-ud    On UNIX platforms, you can run the Message Agent as a daemon by supplying the -ud option.

If you run the Message Agent as a daemon, you must also supply the -o or -ot option, to log output information.

If you run the Message Agent as a daemon and are using FTP or SMTP message links, you must store the message link parameters in the database, because the Message Agent does not prompt the user for these options when running as a daemon.

For information on message link parameters, see Setting message type control parameters.

-v    Verbose output. This option displays the SQL statements contained in the messages to the screen and, if the -o or -ot option is used, to a log file.

-w n    The number of worker threads used to apply incoming messages. The default is zero, which means all messages are applied by the main (and only) thread. A value of 1 (one) would have one thread receiving messages from the message system and one thread applying messages to the database.

The -w option makes it possible to increase the throughput of incoming messages with hardware upgrades. Putting the consolidated database on a device that can perform many concurrent operations (a RAID array with a striped logical drive) will improve throughput of incoming messages. Multiple processors in the computer running the Message Agent could also improve throughput of incoming messages.

The -w option will not improve performance significantly on hardware that cannot perform many concurrent operations.

Incoming messages from a single remote database will never be applied on multiple threads. Messages from a single remote database are always applied serially in the correct order.

-x    Rename and restart the transaction log after it has been scanned for outgoing messages. In some circumstances, replicating data to a consolidated database can take the place of backing up remote databases, or renaming the transaction log when the database server is shut down. This option is available for Adaptive Server Anywhere only.

If the optional size qualifier is supplied, the transaction log is renamed only if it is larger than the specified size. The allowed size can be specified as n (in bytes), nK, or nM. The default is 0.

Message system control parameters 

SQL Remote uses several registry settings to control aspects of message link behavior.

The message link control parameters are stored in the following places:

For a listing of registry settings, see the section for each message system under Using message types.


Contents Index Utilities and Options Reference The Database Extraction utility