Running the SF_Mirror Procedure Without Using xp_cmdshell


Running the SF_Mirror Procedure Without Using xp_cmdshell


xp_cmdshell May Not Be Available

In some SQL Server environments, the use of xp_cmdshell may be restricted. In this case you can use a CmdEXECfeature of the SQL job step to run the underlying replicate program directly (i.e. instead of using the SF_Mirror stored procedure). The name of the executable is DBAmpAZ.exe, and it is located in C:\Program Files\DBAmp\CData\CData DBAmp\bin.

DBAmpAZ.exe Parameters

The DBAmpAZ.exe program takes the following parameters:

  • mirrorcopy—you must explicitly use mirrorcopy as the command when using the CmdEXECfeature to run the replicate program directly.

  • Salesforce Object—the name of the Salesforce object to mirror locally

  • SQL Server Name—the name of the SQL instance to connect to

  • SQL Database Name—the name of the database to connect to. Enclose in double quotes if the name contains a blank.

  • Link Server Name—the name of the DBAmp link server

  • Options—must be either a combination of options or “”. Options are handled the same way as in SF_Mirror. If you specify “” as the option, DBAmpAZ.exe uses the BulkAPI.

Example Using pkchunk,batchsize(50000)

Here is an example of a complete command:

 "C:\Program Files\CData\CData DBAmp\bin\DBAmpAZ.exe" MirrorCopy Account BUDDY "Salesforce
 backups" SALESFORCE pkchunk,batchsize(50000)

Even though the command appears on multiple lines in this document, you must enter it as a single line. Double quotes are required when parameters contain blanks.

When setting up a job step to call the program directly, you must change the Type of the job step to: “Operating System (CmdExec)”. Then enter your complete command in the Command text box. The command must be on a single line.

The DBAmpAZ.exe program returns 0 for a successful completion and -1 if any rows failed. Ensure that the Process exit code of a successful command is 0. It returns -1 if the replication fails.