dmshowlogdependency - Show log dependency

Use this command to display information about source database logs in order to implement a log retention policy.

You can display the following information for a specified instance of CDC Replication, you can display:
  • A list of all the logs that are required for the specified instance. If you are shipping your archive logs, a log status is also displayed.
  • A list of the required logs that are missing and are required by the specified instance. If you are shipping your archive logs, a log status is also displayed.
  • The earliest open transaction in the log for the specified instance.
  • The logs which contain the position confirmed by the target database for the specified instance.
  • The logs which contain the position the specified instance is reading from.

You must issue this command on your CDC Replication source system.

Syntax

dmshowlogdependency [-I <name>] ( -i | -t | -l | -m) [-c]
(-s <subscription> | -A | -a) [-v] [-L <locale>]

Parameters

[-I <name>]
The name of the CDC Replication instance. You can set the TSINSTANCE environment variable to the name of your CDC Replication instance. After this is complete, you no longer have to specify the instance when issuing commands.
-i
Displays the complete list of required source database logs for the specified instance. These logs are required to start replication and contain data that has not been applied to the target. If you specify -A, the command considers all subscriptions and displays a list of logs required to start replication on all subscriptions. If you specify -s, the command displays a list of logs required to start replication on the specified subscription. If you decide to use -a, then the command displays a list of logs required to start replication for each individual subscription. Each list contains logs required for the corresponding subscription.
The path to the archive log is displayed if you are shipping your archive logs.
This parameter displays the following log status information if you are shipping your archive logs:
Available/Not Available
Status that indicates whether or not the archive log file is available. You must run the dmarchivelogavailable command to make archive logs available to CDC Replication.
Exists/Missing
Status that indicates whether the log file exists or is missing. If a log file is missing, you will have to adjust your log shipping process.
-t
Displays the source database log which contains the position confirmed by the target database. If you specify -A, the command considers all subscriptions and displays the oldest log. If you specify -s, the command displays the log for the specified subscription. If you decide to use -a, then the command displays one log for each subscription. Each log contains the position confirmed by the target database for the corresponding subscription.
-l
Displays the source database log which contains the position CDC Replication is reading from. If you specify -A, the command considers all subscriptions and displays the oldest log. If you specify -s, the command displays the log for the specified subscription. If you decide to use-a, then the command displays one log for each subscription. Each log contains the position for the corresponding subscription.
Accurate information about where in the log CDC Replication is reading will only be provided if there is a steady stream of in scope data being applied and committed on the source database
-m
Displays a list of source database logs that are missing for the specified instance and are required for replication. These logs must be restored before you can start replication. If no logs are missing, the output will display 'OK' which you can parse with a script or batch file. If you specify -A, the command considers all subscriptions and displays a list of logs that are missing for at least one of the subscriptions. If you specify -s, the command displays a list of logs that are missing for the specified subscription. If you decide to use -a, then the command displays a list of logs that are missing for each individual subscription. Each list contains logs that are missing for the corresponding subscription.
The path to the archive log will be displayed if you are shipping your archive logs.
This parameter will display the following log status information if you are shipping your archive logs:
Available/Not Available
Status that indicates whether or not the archive log file is available. You must run the dmarchivelogavailable command to make archive logs available to CDC Replication.
Exists/Missing
Status that indicates whether the log file exists or is missing. If a log file is missing, you will have to adjust your log shipping process.
[-c]
Considers the current position instead of the restart position.
-s <subscription>
Displays a source database log or a list of logs for the specified subscription.
-A
Displays a source database log or a list of logs for all subscriptions.
-a
Displays a source database log or a list of logs for each individual subscription.
[-v]
Specifies verbose output (otherwise, the output is formatted for scripting).
[-L <locale>]
The name of the locale used for the CDC Replication instance. The default is your machine's locale.

Result

This command returns a value of 0 if the command was successful and a non-zero value if the command fails. The command can also print as NULL if there are no tables defined in the subscription.

Examples

dmshowlogdependency -I MYINSTANCE -i -s MYSUBSCRIPTIONNAME

Displays the complete list of required source database logs for the specified instance and subscription.

dmshowlogdependency -I MYINSTANCE -m -A

Displays the complete list of source database logs that are missing for all subscriptions in the specified instance.