Databases Mapping

Databases mapping is important in case of migrating a subscription with databases created and used on it: It defines on what database server registered in destination Plesk the subscription databases should be hosted after migration. If no database mapping rules are defined, the databases are created on the default database server of the corresponding type.

Database mapping is defined by the db-server node used in the start request packet. The node is defined by type MappedDbServer (plesk_migration.xsd).

The db-server node is structured as follows:

  • The old node is required. It wraps properties of source database server where databases of the subscription to be migrated exist. Data type: DbServer (plesk_migration.xsd).
  • The new node is required. It wraps properties of destination database server where databases of the subscription to be migrated will be transferred to. Data type: DbServer (plesk_migration.xsd).
  • The host node is required. It specifies the name or IP address of the source/ destination database server. Data type: string.
  • The port node is required. It specifies the number of port on which the database server is listening. Data type: string.

    Important: When migrating Microsoft SQL databases, the port specification in IP mapping must take the following values: 0 if the server is set as default, and empty value if the server is not default.

  • The type node is required. It specifies the database server type.ata type: string. Allowed values: mysql | postgresql | mssql.

 

Note: To retrieve information on a database server registered in Plesk, use the db_server:GET operation. To retrieve information on default database server of a particular type, use the db_server:GET_DEFAULT operation. For information on the operations, refer to the section Supported Operations: Managing Database Servers.

 

The following packet starts migrating subscription doe.com from Plesk for Unix host 'plesk1' to Plesk for Unix host 'plesk2' (to which the request packet is sent). The packet maps source MySQL database server 'msql3' to the destination MySQL server hosted on the Plesk server. The packet also maps source Microsoft SQL server at 'localhost', set as default, to the destination server at 192.0.2.42 which is non-default.

<packet version="1.6.3.0">
<migration>
<start>
   <host>plesk1</host>
   <login>root</login>
   <password>jehdnOEI</password>
   <destination-host-directory>/tmp_dst</destination-host-directory>
   <selected-objects>
      <migrate-webspaces>
         <target-owner>John Doe</target-owner>
         <webspace>
            <name>doe.com</name>

            <db-server>
               <old>
                  <host>msql3</host>
                  <port>3306</port>
                  <type>mysql</type>
               </old>
               <new>
                  <host>localhost</host>
                  <port>3306</port>
                  <type>mysql</type>
               </new>
            </db-server>

            <db-server>
              <old>
                <host>localhost</host>
                <port>0</port>
                <type>mssql</type>
              </old>
              <new>
                <host>192.0.2.42</host>
                <port/>
                <type>mssql</type>
              </new>
            </db-server>


         </webspace>
      </migrate-webspaces>
   </selected-objects>
</start>
</migration>
</packet>