This topic describes how to migrate data from a self-managed SQL Server database whose server cannot access the Internet to an ApsaraDB RDS for SQL Server instance.
Scenarios
- Install a proxy gateway on the bastion host.
- Install the backup gateway that is provided by Database Backup (DBS) on the server on which the self-managed SQL Server database resides.
- Use the physical gateway-based migration feature on the DTS console to migrate data from the self-managed SQL Server database to the ApsaraDB RDS for SQL Server instance.
Prerequisites
- The self-managed SQL Server database meets the following requirements:
- The source database runs SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, or SQL Server 2005. Note The source database resides on an ECS instance, a data center, or on a third-party cloud server. The source database cannot be an RDS instance.
- The
HTTP_PROXY
andHTTPS_PROXY
environment variables are not configured for the server on which the self-managed SQL Server database resides.Important If you configure the environment variables, the system preferentially uses the proxy gateway that is specified by the environment variables. As a result, the proxy gateway that is installed on the bastion host does not take effect, and network connections fail.
- The source database runs SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, or SQL Server 2005.
- The destination RDS instance must meet the following requirements:
- The RDS instance runs SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2012, or SQL Server 2008 R2.
- The RDS instance runs the same major engine version as the self-managed SQL Server database or a later version.
- Before you begin, make sure that the following operations are complete:
- An AccessKey pair is created, and the AccessKey ID and AccessKey secret are obtained. The AccessKey pair is used for identity verification when you register with or log on to the DBS console from your backup gateway. For more information, see Create an AccessKey pair.
- The AliyunDBSFullAccess and AliyunOSSFullAccess permissions are obtained if you want to add a backup gateway as a RAM user. For more information, see Grant permissions to a RAM user. Note
- By default, the preceding permissions are granted to your Alibaba Cloud account when you activate DBS.
- After a backup gateway is added, the backup gateway is available in the DBS console to all RAM users that belong to your Alibaba Cloud account.
- If you want to back up SQL Server databases, you must assign the Sysadmin role to the NT AUTHORITY\SYSTEM account. You can perform this operation by executing the following SQL statements:
ALTER SERVER ROLE [sysadmin] ADD MEMBER [NT AUTHORITY\SYSTEM] GO
Note By default, the NT AUTHORITY\SYSTEM account is used to start AliyunDBSAgent. - If the bastion host runs Linux, make sure that the Java Runtime Environment (JRE) 1.8 is installed on the server on which the self-managed SQL Server database resides. You can download JRE 1.8 from the official website and then install JRE 1.8.
Configuration process
Step | Description |
---|---|
Step 1: Install a proxy gateway | Install a proxy gateway on the bastion host. Proxy gateway: During backup, the proxy gateway receives the data sent from the database server in which the backup gateway is located and forwards the data to Database Backup cloud storage over the Internet. During restoration or database downloading, the proxy gateway receives the data from Database Backup cloud storage and forwards the data to the database server. |
Step 2: Install a backup gateway | Install a backup gateway on the server on which the database is deployed. When you install the backup gateway, enter the IP address of the proxy gateway. The IP address of the proxy gateway is the private IP address of bastion host. Backup gateway: It is installed on the database server. During backup, the database server connects and queries the database, sends data to the bastion host in which the database gateway is installed, and then forwards data over the Internet. During restoration, the database server obtains data over the Internet by using the proxy gateway on a bastion host, and writes data to the database by using the backup gateway. |
Step 3: Migrate data from the self-managed SQL Server database to the RDS instance | In the Data Transmission Service (DTS) console, set the Access Method parameter of the migration task to Physical Protocol to migrate data from the self-managed SQL Server database to the RDS instance. Note For more information about the usage notes, migration description, and supported migration relationships in the DTS console, see Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance by using a physical gateway. |
Step 1: Install a proxy gateway
This section describes how to install a proxy gateway on a Windows or Linux bastion host.
Windows
- Go to the Data Migration Tasks page.
- Log on to the Data Management (DMS) console.
- In the top navigation bar, click DTS.
- In the left-side navigation pane, choose .
Note- Operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Configure the DMS console based on your business requirements.
- You can also go to the Data Migration Tasks page of the new DTS console.
- From the drop-down list next to Data Migration Tasks, select the region in which the data migration instance resides. Note If you use the new DTS console, you must select the region in which the data migration instance resides in the upper-left corner.
- Click Create Task. In the Source Database section of the Configure Source and Destination Database step, click Create Physical Protocol Gateway. Note The Create Physical Protocol Gateway element appears only if you set the Database Type parameter to SQLServer and the Access Method parameter to Physical Protocol.
- In the Installation Command dialog box, configure the Region of Backup Gateway and Network Type of Backup Gateway parameters, copy the download link, and then download the installation package. Note
- Internet: DBS accesses the database by using a public IP address.
- ECS Private Network/VPC: DBS accesses the database by using an Express Connect circuit of Alibaba Cloud.
- Install the proxy gateway on a Windows bastion host.
- Open Task Manager and check whether the proxy gateway is successfully installed. The following figure shows that the proxy gateway is successfully installed.
Linux
Install the proxy gateway on a Linux bastion host by using the link for downloading the backup gateway in the DBS console.
- Log on to the Database Backup (DBS) console.
- In the left-side navigation pane, click Backup Gateways and select a region in the upper-left corner of the page. Note Select a region nearest to your databases. For example, if your databases reside in Hangzhou, we recommend that you install a backup gateway in the China (Hangzhou) region.
- Click Install Backup Gateway in the upper-right corner of the page.
- Configure the Backup Gateway Network Type parameter and copy the command that is used to install backup gateways. Run the command on your database server. Note
- Public Network: You can access DBS by using a public IP address.
- ECS Private Network / VPC: You can access DBS by using an Express Connect circuit from Alibaba Cloud.
- Run the following command to check whether the proxy gateway is installed:
ps aux | grep app_aliyun_proxy
The following figure shows that the installation process runs as expected and the proxy gateway is installed. If you have questions about installation, contact technical support in the DingTalk group (ID 35585947).
Step 2: Install a backup gateway
This section describes how to install a backup gateway on the server on which the self-managed SQL Server database resides.
- Copy the download link from Step 4 in the Step 1: Install a proxy gateway section. Then, download the installation package. Important The link that is used to download the backup gateway must be the same as the download link obtained from Step 4 in the Step 1: Install a proxy gateway section. Otherwise, the server on which the self-managed SQL Server database resides fails to access the Internet.
- Install AliyunDBSAgent on a Windows device or Windows server.
- After the DBS backup gateway is installed, click Installed in the Installation Command dialog box.
- Check whether the DBS backup gateway is started.
- View the new DBS backup gateway. You can click Refresh on the Backup Gateways page of the DBS console to view the new backup gateway.Note The name of the new backup gateway starts with DTS_.