Skip to main content

SLAM_replicate

SLAM_replicate

Efficiently replicates multiple entire Salesforce objects to SQL Server in parallel. The objects specified in @sObjects are submitted to run in parallel with the Bulk v1 API. Each sObject will be downloaded to a table with the provided @table_suffix (defaults to "_replicated"). The table is overwritten if it already exists.

There are length limitations in regards to the command that is sent to Speediful from SQL Server of 4,000 charactes. Long lists of objects may exceed this limit and fail to start Speediful correctly.

Parameters:

NameTypeDefaultDescription
@sObjectsNVARCHARRequiredComma-separated list of Salesforce object names to replicate
@table_suffixNVARCHAR'_replicated'Suffix to append to table names
@pkchunksizeINT100000PK Chunksize to use for replication. Speediful will smartly disable PK Chunking for objects that do not support it. If NULL, PK Chunking is disabled
@queryallBIT0When 1, includes deleted/archived records
@max_workersINT20Number of parallel processing threads. Lower this number if experiencing issues with job processing on Salesforce
@exists_actionVARCHAR(20)SLAM_Settings.default_exists_actionAction to take if the target object name specified by @table is already taken. If NULL, uses the value from SLAM_Settings.default_exists_action (defaulted to 'drop' during initial setup).

Valid options:
  • 'drop'
  • 'rename'
  • 'fail'

Usage Examples:

Replicate multiple objects with default settings. Will create Account_replicated, Contact_replicated, Opportunity_replicated tables:

EXEC dbo.SLAM_replicate
@sObjects = 'Account,Contact,Opportunity'

Whitespace between items in the sObject list is ignored, so this is valid as well:

EXEC dbo.SLAM_replicate
@sObjects = 'Account
,Contact
,Opportunity'

Replicate with custom table suffix and batch size. This will create OpportunityLineItem_backup, WorkOrder_backup, WorkOrderLineItem_backup tables:

EXEC dbo.SLAM_replicate
@sObjects = 'OpportunityLineItem,WorkOrder,WorkOrderLineItem',
@table_suffix = '_backup',
@pkchunksize = 250000

Full replication including deleted records with reduced parallelism:

EXEC dbo.SLAM_replicate
@sObjects = 'Case,CaseComment,FeedItem,Task,EmailMessage,Attachment,ContentVersion',
@table_suffix = '_full_backup',
@pkchunksize = 15000,
@queryall = 1,
@max_workers = 5