7.1.1 Prepare MS SQL Server Database as Source Database
The “prepare” database command is used to configure MS SQL Server database in order to use it as a Source. It enables CDC and creates the Database Objects necessary for any Capture Processes.
Note – In order to use the “prepare” database command the database user must have sufficient privileges.
REST API:
- Endpoint: https://repstance_url/configure/database
- Method: POST
- Header:
- Content-Type: application/json
- X-Token: token
- Body:
{
"command":"prepare",
"parameters":[
["database","source"],
["dbtype","mssql"],
["server","host_name"],
["port","port_number"],
["dbname","database_name"],
["user","db_user_name"],
["password","db_user_password"],
["housekeeping","0|1|2"]
]
}
Server response:
- HTTP Status – status of the command, possible codes are:
- 200 – if no error occurs
- 422 – if error occurs
- Body:
{
"Status":"{Completed|Failed}",
"Message":"The command execution details"
}
CLI Syntax:
repcli prepare database=source dbtype=mssql \
server=databaseHost port=databasePort \
user=username password=password \
dbname=databaseName housekeeping={0|1|2}
The input parameters are:
- database – Database role, the only possible value is source – to insert Capture Process objects and enable CDC
- dbtype – Type of the Source Database, the acceptable value is mssql – MS SQL Server database
- server – Host name or IP address of the database server
- port – Database port number
- dbname – Database name to be connected to
- user – Database User name
- password – Database User password
- housekeeping – This parameter determines how the CDC data will be cleaned up. The possible values are:
- 0 – data will be cleaned up by an SQL Server job only,
- 1 – install Repstance job to clean up data only after extraction and keep SQL Server cleanup job, which is a time based CDC setting,
- 2 – install Repstance job and remove SQL Server cleanup job, data will be cleaned up only by the Repstance job.