Adds a database instance to DMS Enterprise of your enterprise.

As the DMS of , administrator or DBA Enterprise Edition users You can call this operation to add database instances to your enterprise. For more information, see the administrator and DBA roles in the system management> user management section.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. You can use OpenAPI Explorer to search for API operations, call API operations, and dynamically generate SDK sample code.

Request parameters

Parameter Type Required Example Description
Action String Yes RegisterInstance

The operation that you want to perform. Value: RegisterInstance .

Tid Long Yes -1

The ID of the tenant.

Note The tenant ID is taken from the tenant ID displayed when you move the pointer on your profile picture. For more information, see View tenant information .
InstanceType String Yes MySQL

The type of the database instance. Valid values:

  • MySQL
  • SQLServer
  • PostgreSQL
  • Oracle
  • DRDS
  • OceanBase
  • Mongo
  • Redis
InstanceSource String Yes RDS

The source of the database instance. Valid values:

  • PUBLIC_OWN : indicates a user-created instance in the public network.
  • RDS : indicates an RDS instance .
  • ECS_OWN : indicates a user-created ECS instance .
  • VPC_IDC : a VPC-hosted IDC instance
NetworkType String Yes VPC

The network type. Valid values:

  • CLASSIC : classic network
  • VPC : VPC
EnvType String Yes product

The type of the environment. Valid values:

  • product: the production environment.
  • dev: the development environment.
  • pre: staging environment
  • test: in the test environment,
  • sit:SIT environment
  • uat:UAT environment
  • pet: Stress testing environment
  • stag:STAG environment
Host String Yes dmstest.rds.aliyun.com

The host address of the database instance.

Port Integer Yes 3306

The access port of the database instance.

DatabaseUser String Yes dmstest

The username used to access the database instance.

DatabasePassword String Yes password

The access password of the database instance.

InstanceAlias String Yes Test instance

The alias of the database instance. The alias helps you quickly find the required instance.

DbaUid Long Yes 12345678

The Alibaba Cloud unique ID (Uid) of the database administrator (DBA) of the database instance.

Note To query the UID, log on to the DMS Enterprise console and choose System Management > User Management.
SafeRule String Yes Test use

The security rule of the database instance. Enter the name of the security rule for your enterprise.

Note To query a specified security rule, log on to the DMS enterprise console and choose System Management> security rules. The security rule is displayed in the security rule list.
QueryTimeout Integer Yes 60

The query timeout value. Unit: seconds.

ExportTimeout Integer Yes 600

The timeout period for exporting data. Unit: seconds.

EcsInstanceId String No i-xxxxxxxxx

The ID of the ECS instance to which the database instance belongs.

Note InstanceSource The value is ECS self-built database. This value must be passed in.
VpcId String No vpc-xxxxxxxxxxxxxxxxxxxxx

The ID of the VPC to which the database instance belongs.

Note InstanceSource Set this value to VPC and the on-premises IDC.
EcsRegion String No cn-hangzhou

The region ID of the instance.

Note InstanceSource The value must be set when it is set to RDS, ECS-hosted database, or VPC-connected IDC.
Sid String No dmstest

The system ID (SID) of the database instance.

Note InstanceType You must specify this parameter if it is set to PostgreSQL or Oracle.
DataLinkName String No dblink_test

The name of the data link for cross-database query.

DdlOnline Integer No 2

[Important] specifies whether to enable the online data description language (DDL) service. Currently, this service is available only for the MySQL and PolarDB databases.

  • 0: The service is disabled.
  • 1: The native online DDL service prevails.
  • 2: Data change without table locking provided by DMS prevails.
UseDsql Integer No 1

Specifies whether to enable cross-database query for the database instance. Valid values:

  • 0: disabled
  • 1: Incremental backup is enabled.

Response parameters

Parameter Type Sample response Description
ErrorCode String 404

The error codes.

ErrorMessage String The specified instance already exists.

The error message.

RequestId String F4E2A94B-604F-43FF-93E7-F4EE3DCF412E

The UID of the request.

Success Boolean true
  • true : entry successful
  • false : entry failed

Examples

Sample request


     http(s)://[Endpoint]/? Action=RegisterInstance &Tid=-1 &InstanceType=MySQL &InstanceSource=RDS &NetworkType=VPC &EnvType=product &Host=dmstest.rds.aliyun.com &Port=3306 &DatabaseUser=dmstest &DatabasePassword=password &InstanceAlias=test instance&DbaUid=12345678 &SafeRule=Test Usage&QueryTimeout=60&expouce=port600&<common request parameters> 
   

Sample success responses

XML format


     <RegisterInstanceResponse> <RequestId>D4F02899-CE79-4DFD-9893-5217DA70B363</RequestId> <Success>true</Success> </RegisterInstanceResponse> 
   

JSON


     { "RequestId": "F4E2A94B-604F-43FF-93E7-F4EE3DCF412E", "Success": true } 
   

Error codes

For more information about error codes, see error center.

Python SDK example

The following example shows how to add a database instance in VPC.


     # coding=utf-8 from aliyunsdkcore.client import AcsClient from aliyunsdkdms_enterprise.request.v20181101.RegisterInstanceRequest import RegisterInstanceRequest client = AcsClient( "<your-access-key-id> <your-access-key-secret>", "<your-region-id>")# Example for registering a VPC_IDC instance: request = RegisterInstanceRequest() # tenant ID request.set_Tid(1) # instance host request.set_Host("192.168.16.113")# instance port request.set_Port(3314) # instance db type such as: MySQL request.set_InstanceType("MySQL")# instance Source: VPC_IDC request.set_InstanceSource("VPC_IDC") # network type: type: eg : VPC request.set_NetworkType("VPC") request.set_EnvType("PRODUCT") # request.set_EcsInstanceId()# instance vpc id request.set_VpcId("VPC ID") # instance ecs region eg: cn-hangzhou request.set_EcsRegion("ecs region") # request.set_Sid(); # Logon username request.set_DatabaseUser for the instance db ("instance db logon username") # logon password request.set_DatabasePassword for the instance ("instance db logon password") # The alias of the instance. This function is used to distinguish instance request.set_InstanceAlias("instance Alias") in the DMS enterprise console.# The Alibaba Cloud uid of the dba of the database instance. This user must be added in the DMS enterprise console or through the DMS Enterprise API in advance. request.set_DbaUid(-1) request.set_SafeRule("The rule name ") request.set_QueryTimeout(60) request.set_ExportTimeout(600) response = client.do_action_with_exception(request) print response of the security rule configured in DMS Enterprise