dmstartmirror - Start mirroring

Issue this command from your CDC Replication source to start mirroring on the specified subscriptions. This command starts mirroring for any table with a replication method of Mirror and a status of Refresh or Active. Tables with a replication method of Mirror and a status of Refresh are refreshed before mirroring begins.

CDC Replication provides two types of mirroring for source tables that are mapped to target tables: Continuous (-c parameter) and Scheduled End (Net Change) (-n parameter). The type of mirroring you select depends on your business needs.

As its name implies, Continuous mirroring replicates changes to the target on a continuous basis. Use this type of mirroring when business requirements dictate that you need replication to be running continuously and you do not have a clearly defined reason to end replication at the present time.

Scheduled End (Net Change) mirroring replicates changes (to the target) up to a user-specified point in the source database log and then ends replication. Use this type of mirroring when business requirements dictate that you only replicate your data periodically and you have a clearly defined end point for the state of your target database when replication ends. Scheduled End (Net Change) mirroring allows you to end replication at the following points in your source database log:
-n parameter
When specified without –tor –p, this parameter ends replication at the current time in the source database log.
-t parameter
When specified with –n, this parameter ends replication at a user-specified date and time.
-p parameter
When specified with –n, this parameter ends replication at a user-specified log position.

These user specified end points ensure that your target database is in a known state when replication ends.

You can also start and end replication in Management Console. For more information, see Starting and ending replication.

Syntax

dmstartmirror [-I <name>] [-c|-n [-t <timestamp>|-p 
<log position>] [-w|-nw]]  -A|-s <subscription ...> [-L <locale>]

Parameters

[-I <name>]
Specifies the CDC Replication instance for which you want to start mirroring. Alternatively, you can specify the TSINSTANCE environment variable in place of this value.
[-c]
Specifies that CDC Replication will start Continuous mirroring on the specified subscriptions.
If you do not specify –c or -n, CDC Replication will start Continuous mirroring by default on the specified subscriptions.
[-n]
Specifies that CDC Replication mirrors all committed database changes in the source database and then ends replication normally at the current source system time in the database log with the Scheduled End option. The source system time when replication will end is set when you issue this command.
If you specify the following parameters with –n, replication will end at a specific date and time or log position:
[–t]
End replication at a specific date and time in your source database log.
[–p]
End replication at a specific log position in your source database log.
Note: As latency between the source and target increases, the amount of time required to end replication will also increase.
[-t <timestamp>]
Indicates the date and time in the source database log when replication will end when using –n. When specifying a value for this parameter, use the following format: "yyyy-MM-dd HH:mm"
This parameter is optional when you specify –n.
[-p <log position>]
Indicates that CDC Replication will end replication at the specified Oracle SCN in your source database log when using -se. Here is an example of an SCN decimal format for Oracle: 6091085393

This parameter is optional when you specify –n.

[-w]
Indicates that this command will wait for replication to end when you use –n. –w is the default setting for a Scheduled End to replication.
If you are scripting the command with this parameter, your script must wait for -n processing to complete before it continues to execute.
This parameter does not apply if you specify –c for Continuous mirroring.
[-nw]
Indicates that this command will not wait for replication to end if you specify –n. If you are scripting this command, this parameter allows your script to continue executing (asynchronous) if –n processing is not complete.
This parameter does not apply if you specify –c for Continuous mirroring.
-A
Indicates that CDC Replication starts mirroring for all subscriptions.
Use –s to start mirroring for one or more subscriptions.
-s <subscription ...>
Indicates the subscriptions where CDC Replication will start mirroring. To specify multiple subscriptions, list the subscriptions separated by a space. For example: Subscription1 Subscription2 Subscription3
You must specify a value for this parameter or use –A for all subscriptions.
[-L <locale>]
The name of the locale used for the CDC Replication instance. The default is the locale of the machine where CDC Replication is installed.

Result

This command returns a value of 0 if the command was successful and a non-zero value if the command fails.

Examples

dmstartmirror -I MYINSTANCE -c -s FINANCE

CDC Replication starts continuous mirroring for the FINANCE subscription.

dmstartmirror -I MYINSTANCE –n –p "000000FB:000001A4:0001" –nw –A

CDC Replication starts mirroring with the Scheduled End option for all subscriptions in the specified instance. Replication will end at the specified Microsoft SQL Server LSN in the source database log. The command will not wait for Scheduled End processing to complete.

dmstartmirror -I MYINSTANCE –n –t "2010-02-05-00-00" FINANCE -nw

CDC Replication starts mirroring with the Scheduled End option for the FINANCE subscription in the MYINSTANCE instance. Replication will end at the specified time in the source database log. The command will exit before Scheduled End processing is complete.