Command Line

CopyStorm/Restore is generally used in GUI mode, but it is possible to run Copystorm/Restore as a command line application. This is useful for repetitive tasks such as:

  • Refreshing 15 training Salesforce sandboxes in preparation for the next training class.

Prerequisites:

  • A CopyStorm/Restore configuration file. This is the file saved by the GUI when selecting File -> Save As.

The simplest form of a CopyStorm/Restore command line is:

  • Windows:
    • CopyStormRestore.bat -run myConfig.copyStormRestore
  • Linux / Mac:
    • sh CopyStormRestore.sh -run myConfig.copyStormRestore

When running in command line mode CopyStorm/Restore will write progress and any errors encountered to stdout, in addition to the Tracker Database.

Often when CopyStorm/Restore is run in batch mode any history about past restores stored in the Tracker Database should be forgotten. The script that launches CopyStorm could delete the existing Tracker Database — and if so, Copystorm/Restore will automatically recreate it. However, a simpler solution is to use the “-restart” command-line switch. When the “-restart” switch is present, Copystorm/Restore will reset the Tracker Database before the restore begins. For example,

  • Windows
    • CopyStormRestore.bat -restart -run myConfig.copyStormRestore
  • Linux / Mac:
    • sh CopyStormRestore.sh -restart -run myConfig.copyStormRestore

Command Line Reference

Command Line Switch Description Notes
-restart Reset the CopyStorm/Restore tracker database before starting the restore. This will delete all historical data in CopyStorm/Restore. Ids restored in previous jobs will no longer be available.
-scan Run a candidate scan before starting the restore. This will search the CopyStorm database for any new records matching the Restore Set prior to starting the restore.
-resetSkippedReasons Clear record skipped reasons before starting the restore. This will delete all historical record skip reasons from the CopyStorm/Restore tracker database prior to starting the restore.
-deleteExceptions Clear historical exceptions before starting the restore. This will delete all historical job exceptions from the CopyStorm/Restore tracker database prior to starting the restore.
-scanonly Run a candidate scan and do not start the restore. This will search the CopyStorm database for any new records matching the Restore Set and add them to the CopyStorm/Restore tracker database, but will not restore to Salesforce.
-run Specifies the configuration file used to drive the restore.
-restoreType Specifies the type restore to perform. Recognized values include:

  • data (default)
  • metadata
  • tracker
  • data: Restore records to Salesforce, optionally scanning for new records to restore or removing Restore history prior to restoring.
  • metadata: Restore metadata to Salesforce.
  • tracker: Do not restore records to Salesforce. Only perform operations which impact the CopyStorm/Restore tracker database without uploading data to Salesforce.
-sftype The type of Salesforce instance. Recognized values include:

  • Production
  • Sandbox
  • DatabaseDotCom
-sfuser Salesforce username. Note that this option can be used to override the Salesforce user name for both the classic and SFDX Username credentials type.
-sfpassword Salesforce password.
-sftoken Salesforce security token, if required by your organization.
-sfhost Salesforce host If you use a custom domain like capstorm.my.salesforce.com specific it here. For scratch orgs a Salesforce host must always be specified.
-dbuser CopyStorm database username.
-dbpassword CopyStorm database password.
-dbconnection CopyStorm database connection string.
-dbschema Schema Name Override (or set) the database schema value in the configuration file.
-proxyHost Host Name Override the proxy server in the configuration file. Example: proxy.capstorm.com
-proxyPort Port Number Override the port number used by the proxy server.
-proxyUser Username Override the username used to authenticate with the proxy server.
-proxyPassword Password
-apiTraceFile File Name Log all communication with Salesforce to a file.