Home / Repstance User Guide / 7. COMMANDS TO BE USED / 7.1 Prepare Source and Target Databases / 7.1.5 Prepare PostgreSQL and Aurora PostgreSQL Databases as Target Database

7.1.5 Prepare PostgreSQL and Aurora PostgreSQL Databases as Target Database

The “prepare” database command is used to configure PostgreSQL and Aurora PostgreSQL databases as a Target. The command must be executed before running Apply Process. It creates the necessary database objects for any Apply 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","target"],
         ["dbtype","postgresql"],
         ["server","host_name"],
         ["port","port_number"],
         ["dbname","database_name"],
         ["user","db_user_name"],
         ["password","db_user_password"]
      ]
    }

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=target dbtype=postgresql \
server=databaseHost port=databasePort \
user=username password=password \
dbname=databaseName

The input parameters are:

  • database – Database role, the only possible value is target – to insert Apply Process Objects
  • dbtype – Type of RDBMS, the only possible value is postgresql
  • 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