Amazon Web Services AWS Database Migration Service User Guide
Reklama
Reklama
AWS Database Migration
Service
User Guide
Version API Version 2016-01-01
AWS Database Migration Service User Guide
AWS Database Migration Service: User Guide
Copyright © 2016 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by
Amazon.
AWS documentation posted on the Alpha server is for internal testing and review purposes only. It is not intended for external customers.
AWS Database Migration Service User Guide
Table of Contents
Security Considerations When Using a Microsoft SQL Server Database as a Source for AWS
Configuring Microsoft SQL Server Database as a Source for AWS Database Migration
Version API Version 2016-01-01 iii
AWS Database Migration Service User Guide
Limitations on Using SQL Server as a Target for AWS Database Migration Service ................. 49
Security Requirements When Using SQL Server as a Target for AWS Database Migration
Version API Version 2016-01-01 iv
AWS Database Migration Service User Guide
What Is AWS Database Migration
Service?
AWS Database Migration Service (AWS DMS) can migrate your data to and from most widely used commercial and open-source databases such as Oracle, PostgreSQL, Microsoft SQL Server, Amazon
Aurora, MariaDB, and MySQL. The service supports homogeneous migrations such as Oracle to Oracle, and also heterogeneous migrations between different database platforms, such as Oracle to MySQL or
MySQL to Amazon Aurora.
You can begin a database migration with just a few clicks in the AWS DMS Management Console. When the migration has started, AWS manages all the complexities of the migration process, such as data type transformation, compression, and parallel transfer for faster data transfer. At the same time, AWS ensures that data changes to the source database that occur during the migration process are automatically replicated to the target.
Version API Version 2016-01-01
1
AWS Database Migration Service User Guide
Introduction to AWS Database
Migration Service
You can use the AWS Database Migration Service (AWS DMS) web service to migrate data from your database that is on-premises, on an Amazon Relational Database Service (Amazon RDS) DB instance, or in a database on an Amazon Elastic Compute Cloud (Amazon EC2) instance. You can migrate your data to a database on Amazon RDS, on an Amazon EC2 instance, or on-premises.
You can migrate data between heterogeneous or homogenous database engines. For example, you can use the service to migrate data from an on-premises Oracle database to an Amazon RDS DB instance running Oracle or MySQL.You can also use change data capture (CDC) to include changes to the source database while you are migrating your data.
It is important that you understand and familiarize yourself with the components of AWS DMS. These components include the following:
•
Replication Instances for AWS Database Migration Service (p. 4)
•
Setting Up a Network for Database Migration (p. 5)
•
Setting an Encryption Key for AWS Database Migration Service (p. 9)
•
Sources for AWS Database Migration Service (p. 3)
•
Targets for AWS Database Migration Service (p. 3)
For information on the cost of database migration, go to the AWS Database Migration Service pricing page .
You can use AWS DMS for multiple migration scenarios, as shown in the following illustration. Use AWS
DMS to migrate data in the following ways:
• From an on-premises database to a database on Amazon RDS DB instance
• From an on-premises database to a database on an Amazon EC2 instance
• From a database on an Amazon RDS DB instance to an on-premises database
• From a database on an Amazon RDS DB instance to a database on an Amazon RDS DB instance
• From a database on an Amazon RDS DB instance to a database on an Amazon EC2 instance
• From a database on an Amazon EC2 instance to an on-premises database
• From a database on an Amazon EC2 instance to a database on an Amazon EC2 instance
• From a database on an Amazon EC2 instance to a database on an Amazon RDS DB instance
Version API Version 2016-01-01
2
AWS Database Migration Service User Guide
Sources
Note
To use AWS DMS, one endpoint must always be located on an AWS service. Migration from an on-premises database to another on-premises database is not supported.
Sources for AWS Database Migration Service
You can use the following databases as a source for data migration using AWS Database Migration
Service.
On-premises and EC2 instance databases
• Oracle versions 10g, 11g, and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2005, 2008, 2008R2, 2012, and 2014, for the Enterprise, Standard,
Workgroup, and Developer editions
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• PostgreSQL 9.4 and later
Amazon RDS instance databases (only Oracle, MySQL, and Amazon Aurora are currently supported as sources)
• Oracle versions 11g and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2008R2 and 2012, for the Enterprise, Standard, Workgroup, and
Developer editions. Note that CDC operations are not supported.
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• Amazon Aurora (supported as a MySQL-compatible data source)
Targets for AWS Database Migration Service
You can use the following databases as a target for data replication using AWS Database Migration
Service.
Version API Version 2016-01-01
3
AWS Database Migration Service User Guide
Replication Instances
On-premises and Amazon EC2 instance databases
• Oracle versions 10g, 11g, 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2005, 2008, 2008R2, 2012, and 2014, for the Enterprise, Standard,
Workgroup, and Developer editions
• MySQL, versions 5.5, 5.6, and 5.7
• PostgreSQL, versions 9.3 and later
Amazon RDS instance databases
• Oracle versions 11g and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2008R2 and 2012, for the Enterprise, Standard, Workgroup, and
Developer editions
• MySQL, versions 5.5, 5.6, and 5.7
• PostgreSQL, versions 9.3 and later
• Amazon Aurora (supported as a MySQL-compatible data source)
Replication Instances for AWS Database
Migration Service
You use a replication instance to perform database migration in AWS DMS. AWS DMS creates each replication instance in an Amazon Virtual Private Cloud (Amazon VPC).
AWS DMS currently supports the T2 and C4 instance classes for replication instances. The T2 instance classes are low-cost standard instances designed to provide a baseline level of CPU performance with the ability to burst above the baseline. They are suitable for developing, configuring, and testing your database migration process, and for periodic data migration tasks that can benefit from the CPU burst capability. The C4 instance classes are designed to deliver the highest level of processor performance and achieve significantly higher packet per second (PPS) performance, lower network jitter, and lower network latency. You should use C4 instance classes if you are migrating large databases and want to minimize the migration time.
Each replication instance has a specific configuration of memory and vCPU. The following table shows the configuration for each replication instance type. For pricing information, see the Amazon Database
Migration Service pricing page .
Replication Instance Type
General Purpose dms.t2.micro
dms.t2.small
vCPU
1
1
Memory (GB)
1
2
Version API Version 2016-01-01
4
AWS Database Migration Service User Guide
Public and Private Replication Instances
Replication Instance Type
dms.t2.medium
dms.t2.large
Compute Optimized dms.c4.large
dms.c4.xlarge
dms.c4.2xlarge
dms.c4.4xlarge
2
4
8
16
vCPU
2
2
Memory (GB)
4
8
3.75
7.5
15
30
Public and Private Replication Instances
You can specify whether a replication instance has a public or private IP address that the instance uses to connect to the source and target databases. A replication instance should have a public IP address if the source or target database is located in a network that is not connected to the replication instance's
VPC by using a virtual private network (VPN), AWS Direct Connect, or VPC peering.
A private replication instance has a private IP address that cannot be accessed outside the replication network. A replication instance should have a private IP address when both the source and target databases are located in the same network that is connected to the replication instance's VPC by using a VPN, AWS
Direct Connect, or VPC peering.
A VPC peering connection is a networking connection between two VPCs that enables routing using each
VPC’s private IP addresses as if they were in the same network. For more information about VPC peering, see VPC Peering in the Amazon VPC User Guide.
Setting Up a Network for Database Migration
AWS DMS always creates the replication instance in an Amazon Virtual Private Cloud (Amazon VPC), and you specify the VPC where your replication instance is located. You can use your default VPC for your account and region, or you can create a new VPC. The VPC must have two subnets in at least one
Availability Zone.
The Elastic Network Interface (ENI) allocated for the replication instance in your VPC must be associated with a security group that has rules that allow all traffic on all ports to leave (egress) the VPC. This approach allows communication from the replication instance to your source and target database endpoints, as long as correct egress rules are enabled on the endpoints. We recommend that you use the default settings for the endpoints, which allows egress on all ports to all addresses.
The source and target endpoints access the replication instance that is inside the VPC either by connecting to the VPC or by being inside the VPC. The database endpoints must include network ACLs and security group rules (if applicable) that allow incoming access from the replication instance. Depending on the network configuration you are using, you can use the replication instance VPC security group, the replication instance's private or public IP address, or the NAT Gateway's public IP address. These connections form a network that you use for data migration.
Version API Version 2016-01-01
5
AWS Database Migration Service User Guide
Network Configurations for Database Migration
Network Configurations for Database Migration
You can use several different network configurations with AWS Database Migration Service. The following are common configurations for a network used for database migration.
Configuration with All Database Migration Components in
One VPC
The simplest network for database migration is for the source endpoint, the replication instance, and the target endpoint to all be in the same VPC. This configuration is a good one if your source and target endpoints are on an Amazon Relational Database Service (Amazon RDS) DB instance or an Amazon
Elastic Compute Cloud (Amazon EC2) instance.
The following illustration shows a configuration where a database on an Amazon EC2 instance connects to the replication instance and data is migrated to an Amazon RDS DB instance.
The VPC security group used in this configuration must allow ingress on the database port from the replication instance. You can do this by either ensuring that the security group used by the replication instance has ingress to the endpoints, or by explicitly allowing the private IP address of the replication instance.
Configuration with Two VPCs
If your source endpoint and target endpoints are in different VPCs, you can create your replication instance in one of the VPCs and then link the two VPCs by using VPC peering.
A VPC peering connection is a networking connection between two VPCs that enables routing using each
VPC’s private IP addresses as if they were in the same network. We recommend this method for connecting
VPCs within a region. You can create VPC peering connections between your own VPCs or with a VPC in another AWS account within the same AWS region. For more information about VPC peering, see
VPC Peering in the Amazon VPC User Guide.
The following illustration shows a configuration where the source database on an Amazon EC2 instance in a VPC is connected by using VPC peering to a VPC containing the replication instance and the target database on an Amazon RDS DB instance.
The VPC security groups used in this configuration must allow ingress on the database port from the replication instance.
Version API Version 2016-01-01
6
AWS Database Migration Service User Guide
Creating a Replication Subnet Group
Configuration for a Network to a VPC Using AWS Direct
Connect or a VPN
Remote networks can connect to a VPC using several options such as AWS Direct Connect or a software or hardware VPN connection. These options are often used to integrate existing on-site services, such as monitoring, authentication, security, data, or other systems, by extending an internal network into the
AWS cloud. By using this type of network extension, you can seamlessly connect to AWS-hosted resources such as a VPC.
The following illustration shows a configuration where the source endpoint is an on-premises database in a corporate data center. It is connected by using AWS Direct Connect or a VPN to a VPC that contains the replication instance and a target database on an Amazon RDS DB instance.
In this configuration, the VPC security group must include a routing rule that sends traffic destined for a specific IP address or range to a host that can bridge traffic from the AWS VPC into the on premise VPN.
In this case, the NAT host includes its own security group settings that must allow traffic from the replication instance’s private IP address or security group into the NAT instance.
Configuration for a Network to a VPC Using the Internet
If you don't use a VPN or AWS Direct Connect to connect to AWS resources, you can use the Internet to migrate a database to an Amazon EC2 instance or Amazon RDS DB instance. This configuration involves a public replication instance in a VPC with an Internet gateway that contains the target endpoint and the replication instance.
To add an Internet gateway to your VPC, see Attaching an Internet Gateway in the Amazon VPC User
Guide.
The VPC security group must include routing rules that send traffic not destined for the VPC by default to the Internet gateway. In this configuration, the connection to the endpoint will appear to come from the public IP address of the replication instance, not the private IP address.
Creating a Replication Subnet Group
As part of the network to use for database migration, you need to specify what subnets in your Amazon
Virtual Private Cloud (Amazon VPC) you plan to use. A subnet is a range of IP addresses in your VPC in a given Availability Zone. These subnets can be distributed among the Availability Zones for the region where your VPC is located.
Version API Version 2016-01-01
7
AWS Database Migration Service User Guide
Creating a Replication Subnet Group
You create a replication instance in a subnet that you select, and you can manage what subnet a source or target endpoint uses by using the AWS DMS console.
You create a replication subnet group to define which subnets will be used. You must specify at least one subnet in two different Availability Zones.
To create a replication subnet group
1.
Sign in to the AWS Management Console and choose AWS Database Migration Service. Note that if you are signed in as an AWS Identity and Access Management (IAM) user, you must have the appropriate permissions to access AWS DMS. For more information on the permissions required for
database migration, see IAM Permissions Needed to Use AWS DMS (p. 26) .
2.
In the navigation pane, choose Subnet Groups.
3.
Choose Create Subnet Group.
4.
On the Edit Replication Subnet Group page, shown following, specify your replication subnet group information. The following table describes the settings.
For This Option
Identifier
Description
VPC
Do This
Type a name for the replication subnet group that contains from 8 to 16 printable ASCII characters (excluding /,", and
@). The name should be unique for your account for the region you selected. You can choose to add some intelligence to the name such as including the region and task you are performing, for example
DMS-default-VPC
.
Type a brief description of the replication subnet group.
Choose the VPC you want to use for database migration.
Keep in mind that the VPC must have at least one subnet in at least two Availability Zones.
Version API Version 2016-01-01
8
AWS Database Migration Service User Guide
Setting an Encryption Key
For This Option
Available Subnets
Do This
Choose the subnets you want to include in the replication subnet group. You must select subnets in at least two
Availability Zones.
5.
Choose Add to add the subnets to the replication subnet group.
6.
Choose Create.
Setting an Encryption Key for AWS Database
Migration Service
AWS DMS encrypts the storage used by a replication instance and the endpoint connection information.
To encrypt the storage used by a replication instance, AWS DMS uses a master key that is unique to your AWS account.You can view and manage this master key with AWS Key Management Service (AWS
KMS). You can use the default master key in your account ( aws/dms
) or a custom master key that you create. If you have an existing AWS KMS encryption key, you can also use that key for encryption.
You can specify your own encryption key by supplying a KMS key identifier to encrypt your AWS DMS resources. When you specify your own encryption key, the user account used to perform the database migration must have access to that key. For more information on creating your own encryption keys and giving users access to an encryption key, see the
KMS Developer Guide
.
If you don't specify a KMS key identifier, then AWS DMS uses your default encryption key. KMS creates the default encryption key for AWS DMS for your AWS account. Your AWS account has a different default encryption key for each AWS region.
To manage the keys used for encrypting your AWS DMS resources, you use KMS. You can find KMS in the AWS Management Console by choosing Identity & Access Management on the console home page and then choosing Encryption Keys on the navigation pane. KMS combines secure, highly available hardware and software to provide a key management system scaled for the cloud. Using KMS, you can create encryption keys and define the policies that control how these keys can be used. KMS supports
AWS CloudTrail, so you can audit key usage to verify that keys are being used appropriately. Your KMS keys can be used in combination with AWS DMS and supported AWS services such as Amazon RDS,
Amazon Simple Storage Service (Amazon S3), and Amazon Elastic Block Store (Amazon EBS).
Once you have created your AWS DMS resources with a specific encryption key, you cannot change the encryption key for those resources. Make sure to determine your encryption key requirements before you create your AWS DMS resources.
Tagging AWS Database Migration Service
Resources
You can use AWS Database Migration Service tags to add metadata to your AWS DMS resources. In addition, these tags can be used with IAM policies to manage access to AWS DMS resources and to control what actions can be applied to the AWS DMS resources. Finally, these tags can be used to track costs by grouping expenses for similarly tagged resources.
All AWS DMS resources can be tagged:
Version API Version 2016-01-01
9
AWS Database Migration Service User Guide
Tagging
• Replication instances
• Endpoints
• Replication tasks
An AWS DMS tag is a name-value pair that you define and associate with an AWS DMS resource. The name is referred to as the key. Supplying a value for the key is optional. You can use tags to assign arbitrary information to an AWS DMS resource. A tag key could be used, for example, to define a category, and the tag value could be a item in that category. For example, you could define a tag key of “project” and a tag value of “Salix,” indicating that the AWS DMS resource is assigned to the Salix project. You could also use tags to designate AWS DMS resources as being used for test or production by using a key such as environment=test or environment =production. We recommend that you use a consistent set of tag keys to make it easier to track metadata associated with AWS DMS resources.
Use tags to organize your AWS bill to reflect your own cost structure. To do this, sign up to get your AWS account bill with tag key values included. Then, to see the cost of combined resources, organize your billing information according to resources with the same tag key values. For example, you can tag several resources with a specific application name, and then organize your billing information to see the total cost of that application across several services. For more information, see Cost Allocation and Tagging in
About AWS Billing and Cost Management.
Each AWS DMS resource has a tag set, which contains all the tags that are assigned to that AWS DMS resource. A tag set can contain as many as ten tags, or it can be empty. If you add a tag to an AWS DMS resource that has the same key as an existing tag on resource, the new value overwrites the old value.
AWS does not apply any semantic meaning to your tags; tags are interpreted strictly as character strings.
AWS DMS may set tags on an AWS DMS resource, depending on the settings that you use when you create the resource.
The following list describes the characteristics of an AWS DMS tag.
• The tag key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with "aws:" or "dms:". The string may contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").
• The tag value is an optional string value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with "aws:" or "dms:". The string may contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").
Values do not have to be unique in a tag set and can be null. For example, you can have a key-value pair in a tag set of project/Trinity and cost-center/Trinity.
You can use the AWS Management Console, the AWS CLI, or the AWS DMS API to add, list, and delete tags on AWS DMS resources. When using the AWS CLI or the AWS DMS API, you must provide the
Amazon Resource Name (ARN) for the AWS DMS resource you want to work with. For more information about constructing an ARN, see
Constructing an Amazon Resource Name (ARN) for Use with AWS
Database Migration Service (p. 11)
.
Note that tags are cached for authorization purposes. Because of this, additions and updates to tags on
AWS DMS resources may take several minutes before they are available.
Version API Version 2016-01-01
10
AWS Database Migration Service User Guide
Constructing an ARN
Constructing an Amazon Resource Name (ARN) for Use with AWS Database Migration Service
If you use the AWS CLI or AWS Database Migration Service API to automate your database migration, then you need to know about working with an Amazon Resource Name (ARN). Resources that are created in Amazon Web Services are identified by an ARN, which is a unique identifier. If you use the AWS CLI or AWS DMS API to set up your database migration, you must supply the ARN of the resource you want to work with.
An ARN for an AWS DMS resource uses the following syntax: arn:aws:dms:
<region>
:
<account number>
:
<resourcetype>
:
<name>
In this syntax:
•
<region>
is the AWS Region ID of the region where the AWS DMS resource was created, such as us-west-2
.
The following table shows AWS region names and the values you should use when constructing an
ARN.
Region
US East (N. Virginia) region
US West (N. California) region
US West (Oregon) region
EU (Ireland) region
EU (Frankfurt) Region
Asia Pacific (Tokyo) Region
Asia Pacific (Singapore) Region
Asia Pacific (Sydney) Region
South America (Sao Paulo) Region
China (Beijing) Region
AWS GovCloud (US) Region
Name
us-east-1 us-west-1 us-west-2 eu-west-1 eu-central-1 ap-northeast-1 ap-southeast-1 ap-southeast-2 sa-east-1 cn-north-1 us-gov-west-1
•
<account number>
is your account number with dashes omitted. To find your account number, log in to your AWS account at http://aws.amazon.com, choose My Account/Console, and then choose
My Account.
•
<resourcetype>
is the type of AWS DMS resource.
The following table shows the resource types you should use when constructing an ARN for a particular
AWS DMS resource.
Version API Version 2016-01-01
11
AWS Database Migration Service User Guide
Migration Planning
AWS DMS Resource
Type
Replication instance
ARN Format
Endpoint
Replication task arn:aws:dms:<
region
>: <
account
>:rep: <
replicationinstanceidentifier
> arn:aws:dms:<
region
>:<
account
>:endpoint: <
endpointidentifier
> arn:aws:dms:<
region
>:<
account
>: task:<
taskidentifier
>
•
<name>
is the resource identifier for the AWS DMS resource.
The following table shows examples of ARNs for AWS DMS resources with an AWS account of
123456789012, which were created in the US East (N. Virginia) region, and which have a resource name that begins with dm-
:
Resource Type
Replication instance
Endpoint
Migration task
Sample ARN
arn:aws:dms:us-east-1:123456789012:rep:dm-repl-instance arn:aws:dms:us-east-1:123456789012:endpoint:dm-oracleendpoint arn:aws:dms:us-east-1:123456789012:task:dm-oracle2postgresql-task
Migration Planning for AWS Database Migration
Service
Before you create your replication instance and begin database migration, we recommend that you plan for the following:
• Source and Target Endpoints – You need to know what information and tables in the source database need to be migrated to the target database. AWS DMS supports basic schema migration, including the creation of tables and primary keys. However, AWS DMS doesn't automatically create secondary indexes, foreign keys, user accounts, and so on in the target database.
• Oracle as a Source Endpoint – You must enable supplemental logging for your source Oracle database.
.
• Schema/Code Migration – AWS DMS doesn't perform schema or code conversion. You can use tools such as Oracle SQL Developer, MySQL Workbench, or pgAdmin III to convert your schema. If you want to convert an existing schema to a different database engine, you can use the AWS Schema
Conversion Tool. It can create a target schema and also can generate and create an entire schema: tables, indexes, views, and so on. You can also use the tool to convert PL/SQL or TSQL to PgSQL and other formats.
• Unsupported Data Types – Some source data types need to be converted into the parallel data types for the target database. For tables listing conversions between database data types, see
Reference for AWS Database Migration Service (p. 60)
.
Version API Version 2016-01-01
12
AWS Database Migration Service User Guide
Ongoing Replication
Using AWS Database Migration Service for
Ongoing Replication
Although AWS DMS can provide comprehensive ongoing replication of data, it replicates only a limited amount of data definition language (DDL). AWS DMS doesn't propagate items such as indexes, users, privileges, stored procedures, and other database changes not directly related to table data. You can use
AWS DMS for ongoing replication if you don't need these items. Alternatively, you can propagate these items manually.
Replication Tasks
An AWS Database Migration Service task is where all the work happens. Here you specify what tables and schemas to use for your migration. A task must include the following:
• The source and target databases
• The schema and target tables
Once you define a task, you can run it immediately. The target tables with the necessary metadata definitions are automatically created and loaded, and you can specify that the CDC replication process be started. You can monitor, stop, or restart replication activity using the AWS DMS console or API.
Creating Multiple Tasks
In some migration scenarios, you might have to create several migration tasks. Note that tasks work independently and can run concurrently; each task has its own initial load, CDC, and log reading process.
Tables that are related through data manipulation language (DML) must be part of the same task.
Some reasons to create multiple tasks for a migration include the following:
• The target tables for the tasks reside on different databases, such as when you are fanning out or breaking a system into multiple systems.
• You want to break the migration of a large table into multiple tasks by using filtering.
Note
Because each task has its own change capture and log reading process, changes are not coordinated across tasks. Therefore, when using multiple tasks to perform a migration, make sure that source transactions are wholly contained within a single task.
Migration Methods for AWS Database Migration
Service
AWS Database Migration Service can migrate your data in several ways:
• Migrating Data to the Target Database – This process creates files or tables in the target database, automatically defines the metadata that is required at the target, and populates the tables with data from the source. The data from the tables is loaded in parallel for improved efficiency. This process is the Migrate existing data option in the AWS console and is called
Full Load
in the API.
Version API Version 2016-01-01
13
AWS Database Migration Service User Guide
LOB Support
• Capturing Changes During Migration – This process captures changes to the source database that occur while the data is being migrated from the source to the target. When the migration of the originally requested data has completed, the change data capture (CDC) process then applies the captured changes to the target database. Changes are captured and applied as units of single committed transactions, and several different target tables can be updated as a single source commit. This approach guarantees transactional integrity in the target database. This process is the Migrate existing data
and replicate ongoing changes option in the AWS console and is called
CDC
in the API.
• Replicating Only Data Changes on the Source Database – This process reads the recovery log file of the source database management system (DBMS) and groups together the entries for each transaction. If AWS DMS can't apply changes to the target within a reasonable time (for example, if the target is not accessible), AWS DMS buffers the changes on the replication server for as long as necessary. It doesn't reread the source DBMS logs, which can take a large amount of time. This process is the Replicate data changes only option in the AWS DMS console.
Note
If you restart a task, any tables that have not completed their initial load are restarted.
AWS Database Migration Service LOB Support
AWS Database Migration Service provides full support for using large object data types (BLOBs, CLOBs, and NCLOBs). The following source endpoints have full LOB support:
• Oracle
• Microsoft SQL Server
• ODBC
The following target endpoints have full LOB support:
• Oracle
• Microsoft SQL Server
For endpoints that have full LOB support, you can also set a size limit for LOB data types.
DDL Statements Supported by AWS Database
Migration Service
You can execute data definition language (DDL) statements during the data migration process. These statements run on the replication server and are supported for source or target databases.
Supported DDL statements include the following:
• Create table
• Drop table
• Rename table
• Add column
• Drop column
• Rename column
• Change column data type
Version API Version 2016-01-01
14
AWS Database Migration Service User Guide
Supported DDL Statements
For information about which DDL statements are supported for a specific source or target, see the topic describing that source or target.
Version API Version 2016-01-01
15
AWS Database Migration Service User Guide
Start a Database Migration
Getting Started with AWS Database
Migration Service
AWS Database Migration Service (AWS DMS) helps you migrate databases to AWS easily and securely.
You can migrate your data to and from most widely used commercial and open-source databases, such as Oracle, MySQL, and PostgreSQL. The service supports homogeneous migrations such as Oracle to
Oracle, and also heterogeneous migrations between different database platforms, such as Oracle to
PostgreSQL or MySQL to Oracle.
For information on the cost of database migration using AWS Database Migration Service, see the AWS
Database Migration Service pricing page .
Topics
•
Start a Database Migration with AWS Database Migration Service (p. 16)
•
•
Step 2: Create a Replication Instance (p. 17)
•
Step 3: Specify Database Endpoints (p. 20)
•
•
Start a Database Migration with AWS Database
Migration Service
On the Dashboard page in the AWS DMS console, you can use a wizard to help create your first data migration. Following the wizard process, you allocate a replication instance that performs all the processes for the migration, specify a source and a target database, and then create a task or set of tasks to define what tables and replication processes you want to use. AWS DMS then creates your replication instance and performs the tasks on the data being migrated.
To start an AWS DMS database migration by using the console
1.
Sign in to the AWS Management Console and choose AWS DMS. Note that if you are signed in as an AWS Identity and Access Management (IAM) user, you must have the appropriate permissions
Version API Version 2016-01-01
16
AWS Database Migration Service User Guide
Step 1: Welcome
to access AWS DMS. For more information on the permissions required, see IAM Permissions
.
2.
On the Dashboard page, choose Create Migration.
Step 1: Welcome
You start migration from the console's Welcome page, shown following, which explains the process of database migration using AWS DMS.
To start a database migration from the console's Welcome page
• Choose Next.
Step 2: Create a Replication Instance
Your first task in migrating a database is to create a replication instance that has sufficient storage and processing power to perform the tasks you assign and migrate data from your source database to the target database. The required size of this instance varies depending on the amount of data you need to migrate and the tasks that you need the instance to perform. For more information about replication instances, see
Replication Instances for AWS Database Migration Service (p. 4)
.
The procedure following assumes that you have chosen AWS DMS from the AWS Management Console and started the replication task wizard.
Version API Version 2016-01-01
17
AWS Database Migration Service User Guide
Step 2: Create a Replication Instance
To create a replication instance by using the AWS console
1.
On the Create replication instance page, specify your replication instance information. The following table describes the settings.
For This Option
Name
Description
Instance class
VPC
Do This
Type a name for the replication instance that contains from
8 to 16 printable ASCII characters (excluding /,", and @).
The name should be unique for your account for the region you selected. You can choose to add some intelligence to the name, such as including the region and task you are performing, for example
west2-mysql2mysql-instance1
.
Type a brief description of the replication instance.
Choose an instance class with the configuration you need for your migration. Keep in mind that the instance must have enough storage, network, and processing power to successfully complete your migration. For more information on how to determine which instance class is best for your migration, see
Replication Instances for AWS Database
.
Choose the Amazon Virtual Private Cloud (Amazon VPC) you want to use. If your source or your target database is in an VPC, choose that VPC. If your source and your target databases are in different VPCs, ensure that they are both in public subnets and are publicly accessible, and then choose the VPC where the replication instance is located.
The replication instance must be able to access the data in the source VPC. If neither your source nor your target database is in a VPC, leave this option blank.
Version API Version 2016-01-01
18
AWS Database Migration Service User Guide
Step 2: Create a Replication Instance
For This Option
Publicly accessible
Do This
Choose this option if you want the replication instance to be accessible from the Internet.
2.
Choose the Advanced tab, shown following, to set values for network and encryption settings if you need them.
3.
Specify the additional settings. The following table describes the settings.
For This Option
Allocated storage (GB)
Replication Subnet Group
Availability zone
KMS encryption key
Do This
Choose the amount of storage, in gigabytes, to allocate for the replication instance.
Choose the replication subnet group in your selected VPC where you want the replication instance to be created. If your source database is in a VPC, choose the subnet group that contains the source database as the location for your replication instance. For more information about replication
subnet groups, see Creating a Replication Subnet
Choose the Availability Zone where your source database is located.
Choose the encryption key to use to encrypt replication storage and connection information. If you choose None, the default AWS Key Management Service (AWS KMS) key associated with your account and region is used. For
4.
Choose Next.
Version API Version 2016-01-01
19
AWS Database Migration Service User Guide
Step 3: Specify Database Endpoints
Step 3: Specify Database Endpoints
While your replication instance is being created, you can specify the source and target databases. The source and target databases can be on an Amazon Elastic Compute Cloud (Amazon EC2) instance, an
Amazon Relational Database Service (Amazon RDS) DB instance, or an on-premises database.
The procedure following assumes that you have chosen AWS DMS from the AWS Management Console and specified your replication instance information in the replication task wizard.
To specify source and target database endpoints using the AWS console
1.
On the Connect source and target database endpoints page, specify your connection information for the source and target databases. The following table describes the settings.
For This Option
Endpoint Identifier
Do This
Type the name you want to use to identify the endpoint.
You might want to include in the name the type of endpoint, such as
oracle-source
or
PostgreSQL-target
. The name must be unique for all replication instances.
Version API Version 2016-01-01
20
AWS Database Migration Service User Guide
Step 3: Specify Database Endpoints
For This Option
Source Engine or Target Engine
Server address
Port
User name
Password
Database name/SID
Do This
Choose the type of database that is the endpoint.
Type the server address.
Type the port used by the database.
Type the user name with the permissions required to allow data migration. For information on the permissions required, see the security section for the source database in this user guide.
Type the password for the account with the required permissions.
Type the name of the database to use.
2.
Choose the Advanced tab, shown following, to set values for connection string and encryption key if you need them. You can test the endpoint connection by choosing Run test.
For This Option
Connection string
KMS encryption key
Do This
Type a specific connection string if you want to override the connection string DMS creates using the above settings.
Choose the encryption key to use to encrypt replication storage and connection information. If you choose None, the default AWS Key Management Service (AWS KMS) key associated with your account and region is used. For
Version API Version 2016-01-01
21
AWS Database Migration Service User Guide
Step 4: Create a Task
Step 4: Create a Task
Create a task to specify what tables to migrate, to map data using a target schema, and to create new tables on the target database. As part of creating a task, you can choose the type of migration: to migrate existing data, migrate existing data and replicate ongoing changes, or replicate data changes only.
Using AWS DMS, you can specify precise mapping of your data between the source and the target database. Before you specify your mapping, make sure you review the documentation section on data type mapping for your source and your target database.
The procedure following assumes that you have chosen AWS DMS from the AWS Management Console and specified replication instance information and endpoints in the replication task wizard.
To create a task
1.
On the Create Task page, specify the task options. The following table describes the settings.
For This Option
Task name
Task description
Source endpoint
Target endpoint
Do This
Type a name for the task.
Type a description for the task.
Shows the source endpoint that will be used.
Shows the target endpoint that will be used.
Version API Version 2016-01-01
22
AWS Database Migration Service User Guide
Step 4: Create a Task
For This Option
Replication instance
Migration type
Start task on create
Do This
Shows the replication instance that will be used.
Choose the migration method you want to use. You can choose to have just the existing data migrated to the target database or have ongoing changes sent to the target database in addition to the migrated data.
When this option is selected, the task begins as soon as it is created.
2.
Choose the Task Settings tab, shown following, and specify values for your target table and to enable logging. The task settings shown depend on the Migration type value you select. For example, when you select Migrate existing data, the following options are shown:
When you select Migrate existing data and replicate for Migration type, the following options are shown:
For This Option
Target table preparation mode
Do This
Choose the mode you want to use for the target table.
Version API Version 2016-01-01
23
AWS Database Migration Service User Guide
Monitor Your Task
For This Option
Stop task after full load completes
Enable logging
Do This
Choose an action to complete when the task is completed.
You can continue with CDC updates, pause before applying the CDC updates, or stop after applying the cached changes.
Type a specific connection string if you want to override the connection string DMS creates using the above settings.
3.
Choose the Table mappings tab, shown following, to set values for schema mapping and the mapping method. If you choose Custom, you can specify the target schema and table values. For more
information about table mapping, see Creating a Table Mapping for an AWS Database Migration
4.
Once you have finished with the task settings, choose Create task.
Monitor Your Task
If you select Start task on create when you create a task, your task begins immediately to migrate your data when you choose Create task. You can view statistics and monitoring information for your task by choosing the running task from the AWS Management Console. The following screenshot shows a task selected and the task detail information shown below it.
Version API Version 2016-01-01
24
AWS Database Migration Service User Guide
Monitor Your Task
Version API Version 2016-01-01
25
AWS Database Migration Service User Guide
IAM Permissions Needed to Use AWS DMS
AWS Database Migration Service
Security
AWS Database Migration Service (AWS DMS) uses several processes to secure your data during migration. The service encrypts the storage used by your replication instance and the endpoint connection information using an AWS Key Management Service (AWS KMS) key that is unique to your AWS account.
AWS Database Migration Service also requires that you have the appropriate permissions if you sign in as an AWS Identity and Access Management (IAM) user.
The Amazon Virtual Public Cloud (Amazon VPC) that you use with your replication instance must be associated with a security group that has rules that allow all traffic on all ports to leave (egress) the VPC.
This approach allows communication from the replication instance to your source and target database endpoints, as long as correct ingress is enabled on those endpoints.
If you want to view database migration logs, you need the appropriate Amazon CloudWatch Logs permissions for the IAM role you are using.
Topics
•
IAM Permissions Needed to Use AWS DMS (p. 26)
•
Setting an Encryption Key for AWS Database Migration Service (p. 28)
•
Creating the IAM Role to Use with the AWS CLI and AWS DMS API (p. 28)
•
Network Security for AWS Database Migration Service (p. 29)
IAM Permissions Needed to Use AWS DMS
If you are signed in as an IAM user and want to use AWS DMS, your account administrator must attach the following policy to the IAM user, group, or role that you use to run AWS DMS. For more information about IAM permissions, see the
IAM User Guide
.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
Version API Version 2016-01-01
26
AWS Database Migration Service User Guide
IAM Permissions Needed to Use AWS DMS
"Action": "dms:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "kms:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:CreateRole",
"iam:AttachRolePolicy"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2:DescribeVpcs",
"ec2:DescribeInternetGateways",
"ec2:DescribeAvailabilityZones",
"ec2:DescribeSubnets"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"cloudwatch:Get*",
"cloudwatch:List*"
],
"Resource": "*"
}
]
}
Amazon CloudWatch monitors your AWS DMS migration in real time. CloudWatch collects and tracks metrics that indicate the progress of your migration. You can use CloudWatch Logs to debug problems with a task. To access CloudWatch Logs, the IAM user role that you use must have the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:Describe*",
"logs:Filter*",
"logs:Get*"
],
"Effect": "Allow",
"Resource": "*"
}
Version API Version 2016-01-01
27
AWS Database Migration Service User Guide
Setting an Encryption Key
]
}
Setting an Encryption Key for AWS Database
Migration Service
AWS DMS encrypts the storage used by a replication instance and the endpoint connection information.
To encrypt the storage used by a replication instance, AWS DMS uses a master key that is unique to your AWS account. You can view and manage this master key with AWS KMS. You can use the default master key in your account ( aws/dms
) or a custom master key that you create. If you have an existing
KMS encryption key, you can also use that key for encryption.
You can specify your own encryption key by supplying a KMS key identifier to encrypt your AWS DMS resources. When you specify your own encryption key, the user account used to perform the database migration must have access to that key. For more information on creating your own encryption keys and giving users access to an encryption key, see the
KMS Developer Guide
.
If you don't specify a KMS key identifier, then AWS DMS uses your default encryption key. KMS creates the default encryption key for AWS DMS for your AWS account. Your AWS account has a different default encryption key for each AWS region.
To manage the keys used for encrypting your AWS DMS resources, you use KMS. You can find KMS in the AWS Management Console by choosing Identity & Access Management on the console home page and then choosing Encryption Keys on the navigation pane. KMS combines secure, highly available hardware and software to provide a key management system scaled for the cloud. Using KMS, you can create encryption keys and define the policies that control how these keys can be used. KMS supports
AWS CloudTrail, so you can audit key usage to verify that keys are being used appropriately. Your KMS keys can be used in combination with AWS DMS and supported AWS services such as Amazon RDS,
Amazon Simple Storage Service (Amazon S3), and Amazon Elastic Block Store (Amazon EBS).
Once you have created your AWS DMS resources with a specific encryption key, you cannot change the encryption key for those resources. Make sure to determine your encryption key requirements before you create your AWS DMS resources.
Creating the IAM Role to Use with the AWS CLI and AWS DMS API
If you are using the AWS Management Console to create a replication instance, the IAM role dms-vpc-role
that you need to use the AWS DMS API is created automatically. If you use the AWS
CLI or the AWS DMS API for your database migration, you must create the IAM role by using the following procedure.
To create the dms-vpc-role IAM role for use with the AWS CLI or AWS DMS API
1.
Create a JSON file with the IAM policy below. Name the JSON file dmsAssumeRolePolicyDocument.json
.
Version API Version 2016-01-01
28
AWS Database Migration Service User Guide
Network Security for AWS Database Migration Service
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "dms.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
2.
Create the role using the AWS CLI using the following command.
aws iam create-role --role-name dms-vpc-role --assume-role-policy-document
file://dmsAssumeRolePolicyDocument.json’
3.
Attach the
AmazonDMSVPCManagementRole
policy to the dms-vpc-role using the following command.
aws iam attach-role-policy --role-name dms-vpc-role --policy-arn arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole
You should now have the IAM policies in place to use the AWS CLI or AWS DMS API.
Network Security for AWS Database Migration
Service
The security requirements for the network you create when using AWS Database Migration Service depend on how you configure the network. The general rules for network security for AWS DMS are as follows:
• The replication instance must have access to the source and target endpoints. The security group for the replication instance must have network ACLs or rules that allow egress from the instance out on the database port to the database endpoints.
• Database endpoints must include network ACLs and security group rules that allow incoming access from the replication instance. You can achieve this using the replication instance's security group, the private IP address, the public IP address, or the NAT gateway’s public address, depending on your configuration.
• If your network uses a VPN Tunnel, the EC2 instance acting as the NAT Gateway must use a security group that has rules that allow the replication instance to send traffic through it.
Version API Version 2016-01-01
29
AWS Database Migration Service User Guide
Network Security for AWS Database Migration Service
By default, the VPC security group used by the AWS DMS replication instance has rules that allow egress to 0.0.0.0/0 on all ports. If you modify this security group or use your own security group, egress must, at a minimum, be permitted to the source and target endpoints on the respective database ports.
The network configurations you can use for database migration each require specific security considerations:
•
Configuration with All Database Migration Components in One VPC (p. 6)
— The security group used by the endpoints must allow ingress on the database port from the replication instance. Ensure that the security group used by the replication instance has ingress to the endpoints, or you can create a rule in the security group used by the endpoints that allows the private IP address of the replication instance access.
•
Configuration with Two VPCs (p. 6) — The security group used by the replication instance must have
a rule for the VPC range and the DB port on the database.
•
Configuration for a Network to a VPC Using AWS Direct Connect or a VPN (p. 7)
— a VPN Tunnel allowing traffic to tunnel from the AWS VPC into an on premise VPN. In this configuration, the VPC includes a routing rule that sends traffic destined for a specific IP address or range to a host that can bridge traffic from the AWS VPC into the on premise VPN. If this case, the NAT host includes its own
Security Group settings that must allow traffic from the Replication Instance’s private IP address or security group into the NAT instance.
•
Configuration for a Network to a VPC Using the Internet (p. 7)
— The VPC security group must include routing rules that send traffic not destined for the VPC to the Internet gateway. In this configuration, the connection to the endpoint appears to come from the public IP address on the replication instance.
• Source endpoint is outside the VPC used by the replication instance and uses a NAT gateway
— You can configure a network address translation (NAT) gateway using a single Elastic IP Address bound to a single Elastic Network Interface which then receives a NAT identifier (nat-#####). If the
VPC includes a default route to that NAT Gateway instead of the Internet Gateway, the replication instance will instead appear to contact the Database Endpoint using the public IP address of the Internet
Gateway. In this case, the ingress to the Database Endpoint outside the VPC needs to allow ingress from the NAT address instead of the Replication Instance’s public IP Address.
Version API Version 2016-01-01
30
AWS Database Migration Service User Guide
Sources for Data Migration for AWS
Database Migration Service
AWS Database Migration Service (AWS DMS) can use many of the most popular databases as a source for data replication. The source can be on an Amazon Elastic Compute Cloud (Amazon EC2) instance, an Amazon Relational Database Service (Amazon RDS) instance, or an on-premises database. The source databases include the following.
On-premises and EC2 instance databases
• Oracle versions 10g, 11g, and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2005, 2008, 2008R2, 2012, and 2014, for the Enterprise, Standard,
Workgroup, and Developer editions
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• PostgreSQL 9.4 and later
Amazon RDS instance databases (only Oracle, MySQL, and Amazon Aurora are currently supported as sources)
• Oracle versions 11g, and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2008R2 and 2012 editions, for the Enterprise, Standard, Workgroup, and Developer editions. Note that change data capture (CDC) operations are not supported.
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• Amazon Aurora (supported as a MySQL-compatible data source)
Topics
•
Using an Oracle Database as a Source for AWS Database Migration Service (p. 32)
•
Using a Microsoft SQL Server Database as a Source for AWS Database Migration Service (p. 37)
•
Using a PostgreSQL Database as a Source for AWS Database Migration Service (p. 41)
•
Using a MySQL-Compatible Database as a Source for AWS Database Migration Service (p. 43)
Version API Version 2016-01-01
31
AWS Database Migration Service User Guide
Using Oracle as a Source
Using an Oracle Database as a Source for AWS
Database Migration Service
You can migrate data from one or many Oracle databases using AWS Database Migration Service (AWS
DMS). With an Oracle database as a source, you can migrate data to either another Oracle database or one of the other supported databases.
AWS DMS supports as a migration source all Oracle database editions for versions 10g, 11g, and 12c on an on-premises or EC2 instance, and all Oracle database editions for versions 11g and 12c for an
Amazon RDS DB instance. An Oracle account with the specific access privileges is required.
If you plan to use change data capture (CDC) from your Oracle database, you need to set up supplemental logging. The CDC process for Oracle databases uses Oracle LogMiner.
For additional details on working with Oracle databases and AWS DMS, see the following.
Topics
•
Limitations on Using Oracle as a Source for AWS Database Migration Service (p. 32)
•
Supported Compression Methods (p. 33)
•
User Account Privileges Required for Using Oracle as a Source for AWS Database Migration
•
Configuring an Oracle Database as a Source for AWS Database Migration Service (p. 34)
Limitations on Using Oracle as a Source for AWS
Database Migration Service
The following limitations apply when using an Oracle database as a source for AWS Database Migration
Service (AWS DMS):
• AWS DMS supports Oracle transparent data encryption (TDE) tablespace encryption and AWS Key
Management Service (AWS KMS) encryption. All other forms of encryption are not supported.
• If you are managing supplemental logging and you carry out transformations on any of the columns, make sure that supplemental logging is activated for all fields and columns.
• AWS DMS supports the rename table <table name> to <new table name>
syntax with Oracle version 11 and higher.
• AWS DMS doesn't replicate data changes resulting from partition or subpartition operations (ADD,
DROP, EXCHANGE, and TRUNCATE). To replicate such changes, you need to reload the table being replicated. AWS DMS replicates any future data changes to newly added partitions without your needing to reload the table again. However, UPDATE operations on old data records in these partitions fail and generate a
0 rows affected
warning.
• Oracle LogMiner, which AWS DMS uses for change data capture (CDC), doesn't support updating large binary objects (LOBs) when the UPDATE statement updates only LOB columns.
• For Oracle 11, Oracle LogMiner doesn't support the UPDATE statement for XMLTYPE and LOB columns.
• The data definition language (DDL) statement
ALTER TABLE ADD <column> <data_type> DEFAULT
<>
doesn't replicate the default value to the target, and the new column in the target is set to NULL. If the new column is nullable, Oracle updates all the table rows before logging the DDL itself. As a result,
AWS DMS captures the changes to the counters but doesn't update the target. Because the new column is set to NULL, if the target table has no primary key or unique index, subsequent updates generate a
0 rows affected
warning.
Version API Version 2016-01-01
32
AWS Database Migration Service User Guide
Supported Compression Methods
• Data changes resulting from the
CREATE TABLE AS
statement are not supported. However, the new table is created on the target.
• On Oracle 12c, LogMiner does not support LOB columns.
• When limited-size LOB mode is enabled, AWS DMS replicates empty LOBs on the Oracle source as
NULL values in the target.
• AWS DMS doesn't capture changes made by the Oracle DBMS_REDEFINITION package, such as changes to table metadata and the OBJECT_ID value.
• AWS DMS doesn't support index-organized tables with an overflow segment in change data capture
(CDC) mode when using BFILE. An example is when you access the redo logs without using LogMiner.
• AWS DMS doesn't support table clusters when you use Oracle Binary Reader.
• AWS DMS cannot capture changes from redo logs larger than 4 GB.
Supported Compression Methods
AWS Database Migration Service supports all compression methods supported by LogMiner.
User Account Privileges Required for Using Oracle as a Source for AWS Database Migration Service
To use an Oracle database as a source in an AWS DMS task, the user specified in the AWS DMS Oracle database definitions must be granted the following privileges in the Oracle database. For Oracle databases on Amazon RDS, use the stored procedure located at http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.html#Appendix.Oracle.CommonDBATasks.TransferPrivileges
to assign privileges.
• SELECT ANY TRANSACTION
• SELECT on V_$ARCHIVED_LOG
• SELECT on V_$LOG
• SELECT on V_$LOGFILE
• SELECT on V_$DATABASE
• SELECT on V_$THREAD
• SELECT on V_$PARAMETER
• SELECT on V_$NLS_PARAMETERS
• SELECT on V_$TIMEZONE_NAMES
• SELECT on V_$TRANSACTION
• SELECT on ALL_INDEXES
• SELECT on ALL_OBJECTS
• SELECT on DBA_OBJECTS (required if the Oracle version is earlier than 11.2.0.3)
• SELECT on ALL_TABLES
• SELECT on ALL_USERS
• SELECT on ALL_CATALOG
• SELECT on ALL_CONSTRAINTS
• SELECT on ALL_CONS_COLUMNS
• SELECT on ALL_TAB_COLS
• SELECT on ALL_IND_COLUMNS
• SELECT on ALL_LOG_GROUPS
• SELECT on SYS.DBA_REGISTRY
• SELECT on SYS.OBJ$
Version API Version 2016-01-01
33
AWS Database Migration Service User Guide
Configuring Oracle as a Source
• SELECT on DBA_TABLESPACES
• SELECT on ALL_TAB_PARTITIONS
• SELECT on ALL_ENCRYPTED_COLUMNS
For the requirements specified following, grant the additional privileges named:
• If views are exposed, grant SELECT on ALL_VIEWS.
• When you use a specific table list, for each replicated table grant SELECT.
• When you use a pattern for a specific table list, grant SELECT ANY TABLE.
• When AWS DMS adds supplemental logging automatically (the default behavior), grant ALTER ANY
TABLE.
• When AWS DMS adds supplemental logging automatically (the default behavior) and you use a specific table list, for each replicated table grant ALTER.
Access Privileges Required for Change Data Capture (CDC) on an Oracle Source Database
When using change data capture (CDC) with an Oracle source database, you must grant the following privileges to the user account used for data migration. The CDC process for Oracle uses Oracle LogMiner.
For Oracle versions prior to version 12c, grant the following:
• CREATE SESSION
• EXECUTE on DBMS_LOGMNR
• SELECT on V_$LOGMNR_LOGS
• SELECT on V_$LOGMNR_CONTENTS
For Oracle versions 12c and higher, grant the following:
• LOGMINING (for example, GRANT LOGMINING TO
<user account>
)
Configuring an Oracle Database as a Source for
AWS Database Migration Service
Before using an Oracle database as a data migration source, you need to perform several tasks. For an
Oracle database on Amazon RDS, see the following section. For an Oracle database on premises or on an Amazon EC2 instance, you should do the following:
• Provide Oracle Account Access – You must provide an Oracle user account for AWS Database
Migration Service. The user account must have read/write privileges on the Oracle database, as specified
in User Account Privileges Required for Using Oracle as a Source for AWS Database Migration
• Ensure that ARCHIVELOG Mode Is On – Oracle can run in two different modes, the ARCHIVELOG mode and the NOARCHIVELOG mode. To use Oracle with AWS Database Migration Service, the database in question must be in ARCHIVELOG mode.
• Set Up Supplemental Logging – The following steps, required only when using change data capture
(CDC), show how to set up supplemental logging for an Oracle database. For information on setting
Version API Version 2016-01-01
34
AWS Database Migration Service User Guide
Configuring Oracle as a Source
To set up supplemental logging for an Oracle database
1.
Determine if supplemental logging is enabled for the database:
• Run the following query:
SELECT name, value, description FROM v$parameter WHERE name = 'compatible';
The return result should be from
GE to 9.0.0
.
• Run the following query:
SELECT supplemental_log_data_min FROM v$database;
The returned result should be
YES
or
IMPLICIT
.
• Enable supplemental logging by running the following query:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA
2.
Make sure that the required supplemental logging is added for each table:
• If a primary key exists, supplemental logging must be added for the primary key, either by using the format to add supplemental logging on the primary key or by adding supplemental logging on the primary key columns.
• If no primary key exists and the table has a single unique index, then all of the unique index’s columns must be added to the supplemental log. Using
SUPPLEMENTAL LOG DATA (UNIQUE
INDEX) COLUMNS
doesn't add the unique index columns to the log.
• If no primary key exists and the table has multiple unique indexes, AWS DMS selects the first unique index. AWS DMS uses the first index in an alphabetically ordered ascending list in this case. Supplemental logging must be added on the selected index's columns. Using
SUPPLEMENTAL LOG DATA (UNIQUE INDEX) COLUMNS doesn't add the unique index columns to the log.
• If there is no primary key and no unique index, supplemental logging must be added on all columns.
When the target table primary key or unique index is different than the source table primary key or unique index, you should add supplemental logging manually on the source table columns that make up the target table primary key or unique index.
• If you change the target table primary key, you should add supplemental logging on the selected index's columns, instead of the columns of the original primary key or unique index.
3.
Perform additional logging if necessary, for example if a filter or transformation is defined for a table.
If a table has a unique index or a primary key, you need to add supplemental logging on each column that is involved in a filter or transformation, if those columns are different than the primary key or unique index columns. However, if ALL COLUMNS supplemental logging has been added to the table, you don't need to add any additional logging.
Version API Version 2016-01-01
35
AWS Database Migration Service User Guide
Configuring Oracle as a Source
If a transformation uses only one column, you don't need to add this column to a supplemental logging group. For example,
A+B
requires both columns to be added, but
substring(A, 10)
doesn't need A to be added.
As another example, to replicate a table named
EXAMPLE.TABLE
with primary key ID and filter by column
NAME
, you can run a command similar to the one following to create the log group's supplemental logging:
ALTER TABLE EXAMPLE.TABLE ADD SUPPLEMENTAL LOG GROUP example_log_group
(ID,NAME)
ALWAYS;
Configuring Oracle on an Amazon RDS DB Instance as a
Source for AWS Database Migration Service
Using an Oracle database on an Amazon RDS DB instance as a data migration source requires several settings on the DB instance, including the following:
• Set Up Supplemental Logging – AWS DMS requires database-level supplemental logging to be enabled. To enable database-level supplemental logging, run the following command: exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD');
In addition to running this command, we recommend that you turn on PRIMARY KEY logging at the database level to enable change capture for tables that have primary keys. To turn on PRIMARY KEY logging, run the following command: exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD','PRIMARY KEY');
If you want to capture changes for tables that don't have primary keys, you should alter the table to add supplemental logging using the following command: alter table
table_name
add supplemental log data (ALL) columns;
Additionally, when you create new tables without specifying a primary key, you should either include a supplemental logging clause in the create statement or alter the table to add supplemental logging.
The following command creates a table and adds supplemental logging: create table
table_name
(
column data type
, supplemental log data(ALL) columns);
Version API Version 2016-01-01
36
AWS Database Migration Service User Guide
Using SQL Server as a Source
If you create a table and later add a primary key, you need to add supplemental logging to the table.
The following command alters the table to include supplemental logging: alter table
table_name
add supplemental log data (PRIMARY KEY) columns;
• Enable Automatic Backups – For information on setting up automatic backups, see the
Amazon
RDS User Guide
.
• Set Up Archiving – To retain archived redo logs of your Oracle database instance, which lets AWS
DMS retrieve the log information using LogMiner, execute the following command. In this example, logs are kept for 24 hours.
exec rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours',24);
Make sure that your storage has sufficient space for the archived redo logs during the specified period.
Using a Microsoft SQL Server Database as a
Source for AWS Database Migration Service
You can migrate data from one or many Microsoft SQL Server databases using AWS Database Migration
Service (AWS DMS). With a SQL Server database as a source, you can migrate data to either another
SQL Server database or one of the other supported databases.
AWS DMS supports, as a source, on-premises and Amazon EC2 instance databases for Microsoft SQL
Server versions 2005, 2008, 2008R2, 2012, and 2014. The Enterprise, Standard, Workgroup, and
Developer editions are supported.
AWS DMS supports, as a source, Amazon RDS DB instance databases for SQL Server versions 2008R2 and 2012. The Enterprise, Standard, Workgroup, and Developer editions are supported. Change data capture (CDC) is not supported for source databases on Amazon RDS.
You can have the source SQL Server database installed on any computer in your network. A SQL Server account with access privileges to the database is required for use with AWS DMS.
The source SQL Server database must be configured for full backups.
You cannot specify Windows Authentication for the connection to your source SQL Server.
For additional details on working with SQL Server source databases and AWS DMS, see the following.
Topics
•
Limitations on Using SQL Server as a Source for AWS Database Migration Service (p. 38)
•
Supported Compression Methods (p. 38)
•
Security Considerations When Using a Microsoft SQL Server Database as a Source for AWS Database
Version API Version 2016-01-01
37
AWS Database Migration Service User Guide
SQL Server Limitations
•
Configuring Microsoft SQL Server Database as a Source for AWS Database Migration Service (p. 39)
Limitations on Using SQL Server as a Source for
AWS Database Migration Service
The following limitations apply when using a SQL Server database as a source for AWS DMS:
• If you are using a Microsoft SQL Server database in a replication task, the Microsoft SQL Server
Replication Publisher definitions for the database that was used in the task are not removed when you remove a task. A Microsoft SQL Server system administrator must delete these definitions from Microsoft
SQL Server.
• Tables with more than 8000 bytes of information in a Microsoft SQL Server row, including header and mapping information, are not processed correctly due to limitations in buffer size.
• SQL Server must be configured for full backups.
• The Microsoft SQL Server endpoint does not support the use of sparse tables.
• Windows Authentication is not supported.
• Changes to computed fields in a Microsoft SQL Server are not replicated.
• Microsoft SQL Server partition switching is not supported.
• When using the WRITETEXT and UPDATETEXT utilities, AWS DMS does not capture events applied on the source database.
• The following data manipulation language (DML) pattern is not supported:
SELECT <*> INTO <new_table> FROM <existing_table>
• When using Microsoft SQL Server as a source, column-level encryption is not supported.
• Due to a known issue with Microsoft SQL Server 2008, AWS Database Migration Service doesn't support server level audits on Microsoft SQL Server 2008 as a source endpoint.
For example, running the following command causes AWS Database Migration Service to fail:
USE [master]
GO
ALTER SERVER AUDIT [my_audit_test-20140710] WITH (STATE=on)
GO
• Microsoft SQL Server backup to multiple disks is not supported.
Supported Compression Methods
The following table shows the compression methods AWS DMS supports for each Microsoft SQL Server version.
Version API Version 2016-01-01
38
AWS Database Migration Service User Guide
Security Considerations When Using a Microsoft SQL
Server Database as a Source for AWS Database
Migration Service
Microsoft SQL Server Version Row/Page Compression (at
Partition Level)
Vardecimal Storage Format
2005 No No
2008
2012
Yes
Yes
No
No
Note
Sparse columns and columnar structure compression are not supported.
Security Considerations When Using a Microsoft
SQL Server Database as a Source for AWS
Database Migration Service
The AWS DMS user account must have the sysAdmin fixed server role on the Microsoft SQL Server database you are connecting to. A Microsoft SQL Server system administrator must provide this permission for all AWS DMS users. Windows Authentication is not supported.
Working with Microsoft SQL Server AlwaysOn Availability
Groups
The Microsoft SQL Server AlwaysOn Availability Groups feature is a high-availability and disaster-recovery solution that provides an enterprise-level alternative to database mirroring.
To use AlwaysOn Availability Groups as a source in AWS DMS, do the following:
• Enable the Distribution option on all Microsoft SQL Server instances in your Availability Replicas.
• In the AWS DMS console, open the Microsoft SQL Server source database settings. For Server Name, specify the Domain Name Service (DNS) name or IP address that was configured for the Availability
Group Listener.
When you start an AWS Database Migration Service task for the first time, it might take longer than usual to start because the creation of the table articles is being duplicated by the Availability Groups Server.
After failover, you will see recoverable errors in the log and the task will restart. This functionality is normal because the connection is being forcibly closed by the failover. As soon as the new primary server is available, processing resumes.
Configuring Microsoft SQL Server Database as a
Source for AWS Database Migration Service
Following, you can find information about configuring SQL Server as a source for AWS DMS.
Setting Up Microsoft SQL Server for Replication
If you are using Microsoft SQL Server as the source for database migration, you need to enable your
Microsoft SQL Server database for MS-REPLICATION. In Microsoft SQL Server Management Studio, follow the instructions provided by the Configure Distribution wizard to set up replication, or see the
Microsoft SQL Server documentation .
Version API Version 2016-01-01
39
AWS Database Migration Service User Guide
Configuring Microsoft SQL Server Database as a Source for AWS Database Migration Service
To open the Configure Distribution wizard from Microsoft SQL Server
1.
In Microsoft SQL Server Management Studio, open the context (right-click) menu for the Replication folder, and then choose Configure Distribution.
2.
In the Distributor step, select <Microsoft SQL Server Name> will act as its own distributor. SQL
Server will create a distribution database and log.
Replicating Tables That Don't Have a Primary Key
For Microsoft SQL Server Enterprise edition, AWS DMS automatically sets up MS-REPLICATION for each of the source tables in a replication task. However, MS-REPLICATION requires each of the source tables to have a primary key, which might not always be the case. If you need to replicate tables that don't have a primary key, the Use MS-CDC and Do Not Use MS-Replication or MS-CDC options are available, as described following.
Use MS-CDC
To set up MS-CDC, you first need to enable MS-CDC for the database by running the following command: use [DBname]
EXEC sys.sp_cdc_enable_db
Then you need to enable MS-CDC for each of the source tables by running the following command:
EXECUTE sys.sp_cdc_enable_table @source_schema = N'MySchema', @source_name =
N'MyTable', @role_name = NULL;
Note
Replicating tables that don't have a primary key or a unique index can adversely affect performance, because additional database resources are required to capture the changes.
However, you can prevent performance issues related to the absence of primary keys or a unique index by manually adding indexes to the target tables.
For more information on setting up MS-CDC for specific tables, see the Microsoft SQL Server documentation .
Do Not Use MS-Replication or MS-CDC
If your database is not set up for MS-REPLICATION or MS-CDC, you can still capture tables that don't have a primary key. However, bear in mind that in such a setup only INSERT/DELETE DML events are captured. UPDATE and TRUNCATE TABLE events are ignored.
Also note that a DELETE statement executed on an UPDATED source record will not be applied on the target.
Version API Version 2016-01-01
40
AWS Database Migration Service User Guide
Using PostgreSQL as a Source
Using a PostgreSQL Database as a Source for
AWS Database Migration Service
You can migrate data from one or many PostgreSQL databases using AWS Database Migration Service
(AWS DMS). With a PostgreSQL database as a source, you can migrate data to either another PostgreSQL database or one of the other supported databases. AWS DMS supports a PostgreSQL version 9.4
database as a source for on-premises databases, databases on an EC2 instance, and databases on an
Amazon RDS DB instance. AWS DMS doesn't support change data capture (CDC) on PostgreSQL databases on Amazon RDS.
For additional details on working with PostgreSQL databases and AWS DMS, see the following.
Topics
•
Prerequisites for Using a PostgreSQL Database as a Source for AWS Database Migration
•
Security Requirements When Using a PostgreSQL Database as a Source for AWS Database Migration
•
Limitations on Using a PostgreSQL Database as a Source for AWS Database Migration Service (p. 42)
•
Removing AWS Database Migration Service Artifacts from a PostgreSQL Source Database (p. 43)
•
Advanced Configuration Settings When Using a PostgreSQL Database as a Source for AWS Database
Prerequisites for Using a PostgreSQL Database as a Source for AWS Database Migration Service
For a PostgreSQL database to be a source for AWS DMS, you should do the following:
• Use a PostgreSQL database that is version 9.4.x or later.
• Grant superuser permissions for the user account specified for the PostgreSQL source database.
• Add the IP address of the AWS DMS replication server to the pg_hba.conf
configuration file.
• Set the following parameters and values in the postgresql.conf
configuration file:
• Set wal_level = logical
• Set max_replication_slots >=1
The max_replication_slots
value should be set according to the number of tasks that you want to run. For example, to run five tasks you need to set a minimum of five slots. Slots open automatically as soon as a task starts and remain open even when the task is no longer running. You need to manually delete open slots.
• Set max_wal_senders >=1
The max_wal_senders
parameter sets the number of concurrent tasks that can run.
• Set wal_sender_timeout =0
The wal_sender_timeout
parameter terminates replication connections that are inactive longer than the specified number of milliseconds. Although the default is 60 seconds, we recommend that you set this parameter to zero, which disables the timeout mechanism.
Version API Version 2016-01-01
41
AWS Database Migration Service User Guide
Security Requirements for PostgreSQL as a Source
Security Requirements When Using a PostgreSQL
Database as a Source for AWS Database Migration
Service
The only security requirement when using PostgreSQL as a source is that the user account specified must be a registered user in the PostgreSQL database.
Limitations on Using a PostgreSQL Database as a Source for AWS Database Migration Service
The following change-processing limitations apply when using PostgreSQL as a source for AWS DMS:
• A captured table must have a primary key. If a table doesn't have a primary key, AWS DMS ignores
DELETE record operations for that table.
• AWS DMS ignores an attempt to update a primary key segment. In these cases, the target identifies the update as one that didn't update any rows and that results in a record written to the exceptions table.
• AWS DMS doesn't support the Start Process Changes from Timestamp run option.
• AWS DMS doesn't support change processing on Amazon RDS for PostgreSQL. You can only do a full load.
• Replication of multiple tables with the same name but where each name has a different case (for example table1, TABLE1, and Table1) can cause unpredictable behavior, and therefore AWS DMS doesn't support it.
• AWS DMS supports change processing of CREATE, ALTER, and DROP DDL statements for tables unless the tables are held in an inner function or procedure body block or in other nested constructs.
For example, the following change is not captured:
CREATE OR REPLACE FUNCTION attu.create_distributors1() RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN create table attu.distributors1(did serial PRIMARY KEY,name varchar(40) NOT NULL);
END;
$$;
• AWS DMS doesn't support change processing of TRUNCATE operations.
• AWS DMS doesn't support replication of partitioned tables. When a partitioned table is detected, the following occurs:
• The endpoint reports a list of parent and child tables.
• AWS DMS creates the table on the target as a regular table with the same properties as the selected tables.
• If the parent table in the source database has the same primary key value as its child tables, a
“duplicate key” error is generated.
Note
To replicate partitioned tables from a PostgreSQL source to a PostgreSQL target, you first need to manually create the parent and child tables on the target. Then you define a separate task to
Version API Version 2016-01-01
42
AWS Database Migration Service User Guide
Removing Artifacts from a PostgreSQL Source
replicate to those tables. In such a case, you set the task configuration to Truncate before
loading.
Removing AWS Database Migration Service
Artifacts from a PostgreSQL Source Database
To capture DDL events, AWS DMS creates various artifacts in the PostgreSQL database when a migration task starts. When the task completes, you might want to remove these artifacts. To remove the artifacts, issue the following statements (in the order they appear), where
{AmazonRDSMigration}
is the schema in which the artifacts were created: drop event trigger attrep_intercept_ddl;
Note that the event trigger doesn't belong to a specific schema.
drop function {AmazonRDSMigration}.attrep_intercept_ddl() drop table {AmazonRDSMigration}.attrep_ddl_audit
drop schema {AmazonRDSMigration}
Note
Dropping a schema should be done with extreme caution, if at all. Never drop an operational schema, especially not a public one.
Advanced Configuration Settings When Using a
PostgreSQL Database as a Source for AWS
Database Migration Service
You can use the following advanced settings when migrating data from a PostgreSQL database:
• Capture DDLs – When this option is selected, the following actions occur:
• To capture DDL events, AWS DMS creates various operational artifacts in the PostgreSQL database when the migration task starts. You can later remove these artifacts as described in
Database Migration Service Artifacts from a PostgreSQL Source Database (p. 43)
.
• AWS DMS captures streamed DDL events.
• Create DDL Artifacts in Schema – When this option is selected, AWS DMS creates operational DDL database artifacts in the target database schema. The default schema value is Public.
• Override Connection String Parameters – Select this option if you need to do either of the following:
• Specify internal AWS DMS parameters. Such parameters are rarely required and are therefore not exposed in the user interface.
• Specify pass-through (passthru) values for the specific database client. AWS DMS includes pass-through parameters in the connection sting passed to the database client.
Using a MySQL-Compatible Database as a
Source for AWS Database Migration Service
You can migrate data from one or many MySQL, MariaDB, or Amazon Aurora databases using AWS
Database Migration Service. With a MySQL-compatible database as a source, you can migrate data to
Version API Version 2016-01-01
43
AWS Database Migration Service User Guide
Prerequisites for Using MySQL as a Source
either another MySQL-compatible database or one of the other supported databases. MySQL versions
5.5, 5.6, and 5.7, as well as MariaDB and Amazon Aurora, are supported for on-premises, Amazon RDS, and Amazon EC2 instance databases.
For additional details on working with MySQL-compatible databases and AWS Database Migration Service, see the following sections.
Topics
•
Prerequisites for Using a MySQL Database as a Source for AWS Database Migration Service (p. 44)
•
Limitations on Using a MySQL Database as a Source for AWS Database Migration Service (p. 45)
•
Security Requirements for Using a MySQL Database as a Source for AWS Database Migration
Prerequisites for Using a MySQL Database as a
Source for AWS Database Migration Service
Before you begin to work with a MySQL database as a source for AWS DMS, make sure that you have the following prerequisites:
.
• A MySQL-compatible database with the tables that you want to replicate accessible in your network.
• MySQL Community Edition
• MySQL Standard Edition
• MySQL Enterprise Edition
• MySQL Cluster Carrier Grade Edition
• MariaDB
• Amazon Aurora
• If your source is an Amazon RDS MySQL or MariaDB DB instance or an Amazon Aurora cluster, you must enable automatic backups. For more information on setting up automatic backups, see the
Amazon
RDS User Guide
.
• If you use change data capture (CDC), you must enable and configure binary logging. To enable binary logging, the following parameters must be configured in MySQL’s my.ini
(Windows) or my.cnf
(UNIX) file:
Parameter
server_id log-bin binlog_format expire_logs_days binlog_checksum binlog_row_image
Value
Set this parameter to a value of 1 or greater.
Set the path to the binary log file, such as logbin=E:\MySql_Logs\BinLog
. Don't include the file extension.
Set this parameter to row
.
Set this parameter to a value of 1 or greater. To prevent overuse of disk space, we recommend that you don't use the default value of 0.
Set this parameter to none
.
Set this parameter to full
.
• In order to use change data capture (CDC) with an Amazon RDS MySQL DB instance as a source,
AWS DMS needs access to the binary logs. Amazon RDS is fairly aggressive in clearing binary logs
Version API Version 2016-01-01
44
AWS Database Migration Service User Guide
Limitations on MySQL as a Source
from the DB instance. To use CDC with a MySQL DB instance on Amazon RDS, you should increase the amount of time the binary logs remain on the MySQL DB instance. For example, to increase log retention to 24 hours, you would run the following command:
call mysql.rds_set_configuration('binlog retention hours', 24);
• To replicate clustered (NDB) tables using AWS Database Migration Service, the following parameters must be configured in MySQL’s my.ini
(Windows) or my.cnf
(UNIX) file. Replicating clustered (NDB) tables is required only when you use CDC.
Parameter
ndb_log_bin ndb_log_update_as_write ndb_log_updated_only
Value
Set this parameter to on
. This value ensures that changes in clustered tables are logged to the binary log.
Set this parameter to
OFF
. This value prevents writing UPDATE statements as INSERT statements in the binary log.
Set this parameter to
OFF
. This value ensures that the binary log contains the entire row and not just the changed columns.
Limitations on Using a MySQL Database as a
Source for AWS Database Migration Service
When using a MySQL database as a source, AWS DMS doesn't support the following:
• The DDL statements Truncate Partition, Drop Table, and Rename Table.
• Using an
ALTER TABLE
<table_name>
ADD COLUMN
<column_name>
statement to add columns to the beginning or the middle of a table.
• Capturing changes from tables whose names contain both uppercase and lowercase characters.
• The AR_H_USER header column.
Security Requirements for Using a MySQL
Database as a Source for AWS Database Migration
Service
As a security requirement, the AWS DMS user must have the ReplicationAdmin role with the following privileges:
• REPLICATION CLIENT – This privilege is required for change data capture (CDC) tasks only. In other words, full-load-only tasks don't require this privilege.
• REPLICATION SLAVE – This privilege is required for change data capture (CDC) tasks only. In other words, full-load-only tasks don't require this privilege.
• SUPER – This privilege is required only in MySQL versions prior to 5.6.6.
The AWS DMS user must also have SELECT privileges for the source tables designated for replication.
Version API Version 2016-01-01
45
AWS Database Migration Service User Guide
Using Oracle as a Target
Targets for Data Migration for AWS
Database Migration Service
AWS Database Migration Service (AWS DMS) can use many of the most popular databases as a target for data replication. The target can be on an Amazon Elastic Compute Cloud (Amazon EC2) instance, an Amazon Relational Database Service (Amazon RDS) instance, or an on-premises database. The databases include the following:
On-premises and EC2 instance databases
• Oracle versions 10g, 11g, 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2005, 2008, 2008R2, 2012, and 2014, for the Enterprise, Standard,
Workgroup, and Developer editions
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• PostgreSQL versions 9.3 and later
Amazon RDS instance databases
• Oracle versions 11g and 12c, for the Enterprise, Standard, Standard One, and Standard Two editions
• Microsoft SQL Server versions 2008R2 and 2012, for the Enterprise, Standard, Workgroup, and
Developer editions
• MySQL versions 5.5, 5.6, and 5.7
• MariaDB (supported as a MySQL-compatible data source)
• PostgreSQL versions 9.3 and later
• Amazon Aurora
Using an Oracle Database as a Target for AWS
Database Migration Service
You can migrate data to Oracle database targets using AWS DMS, either from another Oracle database or from one of the other supported databases.
Version API Version 2016-01-01
46
AWS Database Migration Service User Guide
Limitations on Oracle as a Target
AWS DMS supports Oracle versions 10g, 11g, and 12c for on-premises and EC2 instances for the
Enterprise, Standard, Standard One, and Standard Two editions as targets. AWS DMS supports Oracle versions 11g and 12c for Amazon RDS instance databases for the Enterprise, Standard, Standard One, and Standard Two editions.
Topics
•
Limitations on Oracle as a Target for AWS Database Migration Service (p. 47)
•
User Account Privileges Required for Using Oracle as a Target (p. 47)
•
Configuring an Oracle Database as a Target for AWS Database Migration Service (p. 48)
Limitations on Oracle as a Target for AWS
Database Migration Service
Limitations when using Oracle as a target for data migration include the following:
• AWS DMS doesn't support the
Use direct path full load
option for tables with INDEXTYPE
CONTEXT. As a workaround, you can use array load.
• In Batch Optimized Apply mode, loading into the net changes table uses Direct Path, which doesn't support XMLType. As a workaround, you can use Transactional Apply mode.
• AWS DMS cannot create a new schema on the Oracle database. To replicate to a new schema, the new schema name must already exist for the Oracle target. Once you've set a new schema name for the target, you can then specify that name on the Target Metadata and Control Tables tabs of the
AWS DMS Management Console's Task Settings page.
User Account Privileges Required for Using Oracle as a Target
To use an Oracle target in an AWS Database Migration Service task, for the user account specified in the AWS DMS Oracle database definitions you need to grant the following privileges in the Oracle database:
• SELECT ANY TRANSACTION
• SELECT on V$NLS_PARAMETERS
• SELECT on V$TIMEZONE_NAMES
• SELECT on ALL_INDEXES
• SELECT on ALL_OBJECTS
• SELECT on DBA_OBJECTS
• SELECT on ALL_TABLES
• SELECT on ALL_USERS
• SELECT on ALL_CATALOG
• SELECT on ALL_CONSTRAINTS
• SELECT on ALL_CONS_COLUMNS
• SELECT on ALL_TAB_COLS
• SELECT on ALL_IND_COLUMNS
• DROP ANY TABLE
• SELECT ANY TABLE
• INSERT ANY TABLE
• UPDATE ANY TABLE
Version API Version 2016-01-01
47
AWS Database Migration Service User Guide
Configuring Oracle as a Target
• CREATE ANY VIEW
• DROP ANY VIEW
• CREATE ANY PROCEDURE
• ALTER ANY PROCEDURE
• DROP ANY PROCEDURE
• CREATE ANY SEQUENCE
• ALTER ANY SEQUENCE
• DROP ANY SEQUENCE
For the requirements specified following, grant the additional privileges named:
• To use a specific table list, grant SELECT on any replicated table and also ALTER on any replicated table.
• For logon, grant the privilege CREATE SESSION.
• If you are using a direct path, grant the privilege LOCK ANY TABLE.
• If the "DROP and CREATE table" or "TRUNCATE before loading" option is selected in the full load settings, and the target table schema is different from that for the AWS DMS user, grant the privilege
DROP ANY TABLE.
• To store changes in change tables or an audit table when the target table schema is different from that for the AWS DMS user, grant the privileges CREATE ANY TABLE and CREATE ANY INDEX.
Read Privileges Required for AWS Database Migration
Service on the Target Database
The AWS DMS user account must be granted read permissions for the following DBA tables:
• SELECT on DBA_USERS
• SELECT on DBA_TAB_PRIVS
• SELECT on DBA_OBJECTS
• SELECT on DBA_SYNONYMS
• SELECT on DBA_SEQUENCES
• SELECT on DBA_TYPES
• SELECT on DBA_INDEXES
• SELECT on DBA_TABLES
• SELECT on DBA_TRIGGERS
If any of the required privileges cannot be granted to V$xxx, then grant them to V_$xxx.
Configuring an Oracle Database as a Target for
AWS Database Migration Service
Before using an Oracle database as a data migration target, you must provide an Oracle user account to AWS DMS. The user account must have read/write privileges on the Oracle database, as specified in the section
User Account Privileges Required for Using Oracle as a Target (p. 47) .
Version API Version 2016-01-01
48
AWS Database Migration Service User Guide
Using SQL Server as a Target
Using a Microsoft SQL Server Database as a
Target for AWS Database Migration Service
You can migrate data to Microsoft SQL Server databases using AWS DMS. With an SQL Server database as a target, you can migrate data from either another SQL Server database or one of the other supported databases.
For on-premises and Amazon EC2 instance databases, AWS DMS supports as a target SQL Server versions 2005, 2008, 2008R2, 2012, and 2014, for the Enterprise, Standard, Workgroup, and Developer editions.
For Amazon RDS instance databases, AWS DMS supports as a target SQL Server versions 2008R2 and
2012, for the Enterprise, Standard, Workgroup, and Developer editions are supported.
For additional details on working with AWS DMS and SQL Server target databases, see the following.
Topics
•
Limitations on Using SQL Server as a Target for AWS Database Migration Service (p. 49)
•
Security Requirements When Using SQL Server as a Target for AWS Database Migration
Limitations on Using SQL Server as a Target for
AWS Database Migration Service
The following limitations apply when using a SQL Server database as a target for AWS DMS:
• When you manually create a SQL Server target table with a computed column, full load replication is not supported when using the BCP bulk-copy utility. To use full load replication, disable the Use BCP
for loading tables option in the console's Advanced tab.
• When replicating tables with SQL Server spatial data types (GEOMETRY and GEOGRAPHY), AWS
DMS replaces any spatial reference identifier (SRID) that you might have inserted with the default
SRID. The default SRID is 0 for GEOMETRY and 4326 for GEOGRAPHY.
Security Requirements When Using SQL Server as a Target for AWS Database Migration Service
The following describes the security requirements for using AWS DMS with a Microsoft SQL Server target.
• AWS DMS user account must have at least the db_owner user role on the Microsoft SQL Server database you are connecting to.
• A Microsoft SQL Server system administrator must provide this permission to all AWS DMS user accounts.
Version API Version 2016-01-01
49
AWS Database Migration Service User Guide
Using PostgreSQL as a Target
Using a PostgreSQL Database as a Target for
AWS Database Migration Service
You can migrate data to PostgreSQL databases using AWS DMS, either from another PostgreSQL database or from one of the other supported databases.
PostgreSQL versions 9.3 and later are supported for on-premises, Amazon RDS, and EC2 instance databases.
Security Requirements When Using a PostgreSQL
Database as a Target for AWS Database Migration
Service
For security purposes, the user account used for the data migration must be a registered user in any
PostgreSQL database that you use as a target.
Using a MySQL-Compatible Database as a Target for AWS Database Migration Service
You can migrate data to MySQL databases using AWS DMS, either from another MySQL database or from one of the other supported databases.
MySQL versions 5.5, 5.6, and 5.7, as well as MariaDB and Amazon Aurora, are supported.
Prerequisites for Using a MySQL-Compatible
Database as a Target for AWS Database Migration
Service
Before you begin to work with a MySQL database as a target for AWS DMS, make sure that you have the following prerequisites:
When Using MySQL as a Target for AWS Database Migration Service (p. 51)
.
• A MySQL database with the tables that you want to replicate accessible in your network. AWS DMS supports the following MySQL editions:
• MySQL Community Edition
• MySQL Standard Edition
• MySQL Enterprise Edition
• MySQL Cluster Carrier Grade Edition
• MariaDB
• Amazon Aurora
• During a load, you should consider disabling foreign keys. In order to disable foreign key checks on a
MySQL-compatible database during a load, you can add the following command to the Extra Connection
Attributes in the Advanced section of the target MySQL, Aurora, Mariadb endpoint connection information:
Version API Version 2016-01-01
50
AWS Database Migration Service User Guide
Limitations on MySQL as a Target
initstmt=SET FOREIGN_KEY_CHECKS=0
Limitations on Using MySQL as a Target for AWS
Database Migration Service
When using a MySQL database as a source, AWS DMS doesn't support the following:
• The DDL statements Truncate Partition, Drop Table, and Rename Table.
• Using an
ALTER TABLE
<table_name>
ADD COLUMN
<column_name>
statement to add columns to the beginning or the middle of a table.
In addition, when you update a column's value to its existing value, MySQL returns a
0 rows affected warning. In contrast, Oracle performs an update of one row in this case. The MySQL result generates an entry in the attrep_apply_exceptions control table and the following warning:
Some changes from the source database had no impact when applied to the target database. See attrep_apply_exceptions table for details.
Security Requirements When Using MySQL as a
Target for AWS Database Migration Service
When using MySQL as a target for data migration, you must provide MySQL account access to the AWS
DMS user account. This user must have read/write privileges in the MySQL database.
Version API Version 2016-01-01
51
AWS Database Migration Service User Guide
Task Settings
Working with AWS Database
Migration Service Tasks
You use tasks in AWS Database Migration Service (AWS DMS) to apply specific replication requirements to a data migration.You create replication tasks to designate what tables should be migrated and to which target schema should be applied. You can also apply filters to your data and specify if only existing data should be replicated or if change data should be replicated also.
To design a replication task, you must first be sure that you have configured at least one source and one target database to work with AWS DMS. You must also have a replication instance set up. Then you can create the task and specify tables to be replicated.
You can also customize a task by creating new tables or columns in the target database or by selecting only some of the data from each column of a table to be replicated. You do this by using filters.
When you create a task, you can decide on your migration method, which includes either a full load of the existing data, a full load of the data plus ongoing changes, or just a replication of the ongoing changes.
For more information, see the following topics.
Topics
•
Task Settings for AWS Database Migration Service Tasks (p. 52)
•
Creating a Table Mapping for an AWS Database Migration Service Task (p. 54)
Task Settings for AWS Database Migration
Service Tasks
Each task has settings that you can configure according to the needs of your database migration. There are three main types of task settings:
• Target metadata settings
• Full load settings
• Logging settings
Target metadata settings include the following:
Version API Version 2016-01-01
52
AWS Database Migration Service User Guide
Task Settings
•
TargetSchema
– The target table schema name. If this metadata option is empty, the schema from the source table is used. AWS DMS automatically adds the owner prefix for the target database to all tables if no source schema is defined. This option should be left empty for MySQL-type target endpoints.
•
LOB settings
– Settings that determine how large objects (LOBs) are managed. If you set
SupportLobs=true
, you must set one of the following to true
:
•
FullLobMode
– If you set this option to true
, then you must enter a value for the
LobChunkSize option. Enter the size, in kilobytes, of the LOB chunks to use when replicating the data to the target.
The
FullLobMode
option works best for very large LOB sizes but tends to cause slower loading.
•
LimitedSizeLobMode
– If you set this option to true
, then you must enter a value for the
LobMaxSize
option. Enter the maximum size, in kilobytes, for an individual LOB. Enter 0 for unlimited size.
Full load settings include the following:
• To enable or disable full load and change data capture (CDC), set the following:
•
FullLoadEnabled
– Set this option to true
if the task needs to perform a full load on target tables.
•
ApplyChangesEnabled
– Set this option to true
if the task needs to keep target tables up-to-date by applying changes using CDC.
If both
FullLoadEnabled=true
and
ApplyChangesEnabled=true
, the task loads the tables first and then keeps applying incoming changes. While updating a task, you can use these settings only to toggle on and off full load or CDC, or both.
• To indicate how to handle loading the target at full-load startup, specify one of the following values for the
TargetTablePrepMode
option:
•
DO_NOTHING
– Data and metadata of the existing target table are not affected.
•
DROP_AND_CREATE
– The existing table is dropped and a new table is created in its place.
•
TRUNCATE_BEFORE_LOAD
– Data is truncated without affecting the table metadata.
• To delay primary key or unique index creation until after full load completes, set the
CreatePkAfterFullLoad
option. When this option is selected, you cannot resume incomplete full load tasks.
• For full load and CDC-enabled tasks, you can set the following
Stop task after full load completes
options:
•
StopTaskCachedChangesApplied
– Set this option to true
to stop a task after a full load completes and cached changes are applied.
•
StopTaskCachedChangesNotApplied
– Set this option to true
to stop a task before cached changes are applied.
• To allow tables to resume processing from the point of interruption during a full load, set the
ResumeEnabled
option to true
. Otherwise, table loading restarts from the beginning.
Allowing table loading to restart from the point of interruption can cause a slowdown in full-load processing. However, starting extremely large tables from the beginning can cause long delays in completing the full load. In addition, for a table load to be restarted from the point of interruption, the table must have a unique index, and we also recommend that it have a clustered primary key.
If
ResumeEnabled
is set to true
, the following options should be set:
•
ResumeMinTableSize
– Indicates which tables should resume loading when the full-load operation begins again. Tables with fewer rows than the number set for this option restart the full load. The default value is 1,000,000.
•
ResumeOnlyClusteredPKTables
– Indicates whether to resume loading only tables that have clustered primary keys.
• To indicate the maximum number of tables to load in parallel, set the
MaxFullLoadSubTasks
option.
• To set the number of seconds that AWS DMS waits for transactions to close before beginning a full-load operation, if transactions are open when the task starts, set the
TransactionConsistencyTimeout
Version API Version 2016-01-01
53
AWS Database Migration Service User Guide
Saving Task Settings
option. The default value is 600 (10 minutes). AWS DMS begins the full load after the timeout value is reached, even if there are open transactions.
• To indicate the maximum number of events that can be transferred together, set the
CommitRate option.
Logging settings include the
EnableLogging
option, which you set to true
to access Amazon CloudWatch logs.
Saving Task Settings
You can save the settings for a task as a JSON file, in case you want to reuse the settings for another task.
For example, the following JSON file contains settings saved for a task:
{
"TargetMetadata": {
"TargetSchema": "",
"SupportLobs": "true",
"FullLobMode": "true",
"LobChunkSize": 64,
"LimitedSizeLobMode": "false",
"LobMaxSize": 0
},
"FullLoadSettings": {
"FullLoadEnabled": "true",
"ApplyChangesEnabled": "true",
"TargetTablePrepMode": "DROP_AND_CREATE",
"CreatePkAfterFullLoad": "false",
"StopTaskCachedChangesApplied": "false",
"StopTaskCachedChangesNotApplied": "false",
"ResumeEnabled": "true",
"ResumeMinTableSize": 100000,
"ResumeOnlyClusteredPKTables": "true",
"MaxFullLoadSubTasks": 8,
"TransactionConsistencyTimeout": 600,
"CommitRate": 10000
}
}
Creating a Table Mapping for an AWS Database
Migration Service Task
Table mappings specify the source schema and corresponding tables to be migrated to the target endpoint.
The simplest mapping is to migrate all the tables from a source schema to target database. You can use a table mapping to specify individual tables in a database to migrate and the schema that are to be used for the migration.
Version API Version 2016-01-01
54
AWS Database Migration Service User Guide
Creating JSON Files for Table Mapping
Creating JSON Files for Table Mapping
If you use the AWS CLI or AWS Database Migration Service API to perform migrations, you can create a JSON file to specify the table mappings that you want to occur during migration. You can also paste the JSON into the table mapping box when creating a task using the AWS DMS Management Console.
In the JSON file, you can use the types Include, Exclude, and Explicit to indicate the type of table mapping you want. When you use Include or Exclude, you can specify the table name using a search pattern or wildcard characters, for example specifying a table name such as
dept%
, or
%
to include all tables. For the Explicit type of table mapping, you provide an exact table name.
The following code maps all the tables in a source schema called
authors
to similarly named tables in the target schema:
{
"TableMappings": [
{
"Type": "Include",
"SourceSchema": "authors",
"SourceTable": "%"
}, {
"Type": "Include",
"SourceSchema": "authors",
"SourceTable": "%"
}
] }
The following code shows how to include some schemas and tables in the target schema and exclude some schemas and tables from the target schema:
{
"TableMappings": [
{
"Type": "Include",
"SourceSchema": "company",
"SourceTable": “emp%"
},
{
"Type": "Include",
"SourceSchema": “employees",
"SourceTable": “%"
},
{
"Type": "Exclude",
"SourceSchema": “source101",
"SourceTable": “dep%"
},
{
"Type": "Exclude",
"SourceSchema": “source102",
"SourceTable": “%"
},
{
Version API Version 2016-01-01
55
AWS Database Migration Service User Guide
Creating JSON Files for Table Mapping
"Type": "Explicit",
"SourceSchema": "company",
"SourceTable": "managers"
},
{
"Type": "Explicit",
"SourceSchema": "company",
"SourceTable": "locations"
}
]
}
You can also explicitly map tables to the target database, as shown in the following code:
{
"TableMappings": [
{
"Type": "Explicit",
"SourceSchema": "company",
"SourceTable": "managers"
},
{
"Type": "Explicit",
"SourceSchema": "company",
"SourceTable": "locations"
}
]
}
Version API Version 2016-01-01
56
AWS Database Migration Service User Guide
Monitoring AWS Database
Migration Service Tasks
You can monitor the progress of your tasks in AWS Database Migration Service (AWS DMS) tasks using the AWS Management Console, the AWS Command Line Interface (CLI), or AWS DMS API. You can monitor the progress or your data migration and also the resources and network connectivity used.
The AWS DMS console shows basic statistics for each task, including the task status, percent complete, elapsed time, and table statistics, as shown following.
You can select a task and display performance metrics for the task, including throughput, records per second migrated, disk and memory use, and latency.
Version API Version 2016-01-01
57
AWS Database Migration Service User Guide
The AWS DMS console shows performance statistics for each table, including the number of inserts, deletions, and updates.
The AWS DMS console also shows any error messages that occurred during migration.
Version API Version 2016-01-01
58
AWS Database Migration Service User Guide
Version API Version 2016-01-01
59
AWS Database Migration Service User Guide
Source Data Types
Data Conversion Reference for
AWS Database Migration Service
AWS Database Migration Service (AWS DMS) converts source data types into data types on the target database using the conversions listed in the following tables.
Topics
•
•
•
Data Types for AWS Database Migration Service (p. 75)
Source Data Types
You can find data type conversion tables for databases used as a source for AWS Database Migration
Service following.
Topics
•
Source Data Types for Oracle (p. 60)
•
Source Data Types for Microsoft SQL Server (p. 62)
•
Source Data Types for PostgreSQL (p. 65)
•
Source Data Types for MySQL (p. 67)
Source Data Types for Oracle
The Oracle endpoint for AWS DMS supports most Oracle data types. The following table shows the
Oracle source data types that are supported when using AWS DMS and the default mapping to AWS
DMS data types.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
Version API Version 2016-01-01
60
AWS Database Migration Service User Guide
Source Data Types for Oracle
Oracle Data Type
BINARY_FLOAT
BINARY_DOUBLE
BINARY
FLOAT (P)
AWS DMS Data Type
REAL4
REAL8
BYTES
If precision is less than or equal to 24, use REAL4.
NUMBER (P,S)
If precision is greater than 24, use REAL8.
When scale is less than 0, use REAL8
NUMBER according to the
"Expose number as" property in the Oracle source database settings.
When scale is 0:
• And precision is 0, use REAL8.
• And precision is greater than or equal to 2, use INT1.
• And precision is greater than 2 and less than or equal to 4, use INT2.
• And precision is greater than 4 and less than or equal to 9, use INT4.
• And precision is greater than 9, use NUMERIC.
• And precision is greater than or equal to scale, use NUMERIC.
DATE
INTERVAL_YEAR TO
MONTH
INTERVAL_DAY TO
SECOND
TIME
TIMESTAMP
TIMESTAMP WITH TIME
ZONE
TIMESTAMP WITH LOCAL
TIME ZONE
CHAR
VARCHAR2
NCHAR
NAVARCHAR2
RAW
REAL
BLOB
In all other cases, use REAL8.
DATETIME
STRING (with interval year_to_month indication)
STRING (with interval day_to_second indication)
DATETIME
DATETIME
STRING (with timestamp_with_timezone indication)
STRING (with timestamp_with_local_ timezone indication)
STRING
STRING
WSTRING
WSTRING
BYTES
REAL8
BLOB
To use this data type with AWS DMS, you must enable the use of BLOB data types for a specific task. AWS DMS supports BLOB data types only in tables that include a primary key.
Version API Version 2016-01-01
61
AWS Database Migration Service User Guide
Source Data Types for SQL Server
Oracle Data Type
CLOB
NCLOB
LONG
LONG RAW
XMLTYPE
AWS DMS Data Type
CLOB
To use this data type with AWS DMS, you must enable the use of CLOB data types for a specific task. During change data capture (CDC), AWS
DMS supports CLOB data types only in tables that include a primary key.
NCLOB
To use this data type with AWS DMS, you must enable the use of
NCLOB data types for a specific task. During CDC, AWS DMS supports
NCLOB data types only in tables that include a primary key.
CLOB
The LONG data type is not supported in batch-optimized apply mode
(TurboStream CDC mode). To use this data type with AWS DMS, you must enable the use of LOBs for a specific task. During CDC, AWS DMS supports LOB data types only in tables that have a primary key.
BLOB
The LONG RAW data type is not supported in batch-optimized apply mode (TurboStream CDC mode). To use this data type with AWS DMS, you must enable the use of LOBs for a specific task. During CDC, AWS
DMS supports LOB data types only in tables that have a primary key.
CLOB
Support for the XMLTYPE data type requires the full Oracle Client (as opposed to the Oracle Instant Client). When the target column is a CLOB, both full LOB mode and limited LOB mode are supported (depending on the target).
Oracle tables used as a source with columns of the following data types are not supported and cannot be replicated. Replicating columns with these data types result in a null column.
• BFILE
• ROWID
• REF
• UROWID
• Nested Table
• User-defined data types
• ANYDATA
Note
Virtual columns are not supported.
Source Data Types for Microsoft SQL Server
Data migration that uses Microsoft SQL Server as a source for AWS DMS supports most SQL Server data types. The following table shows the SQL Server source data types that are supported when using
AWS DMS and the default mapping from AWS DMS data types.
Version API Version 2016-01-01
62
AWS Database Migration Service User Guide
Source Data Types for SQL Server
For information on how to view the data type that is mapped in the target, see the section for the target endpoint you are using.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
SQL Server Data Types
BIGINT
BIT
DECIMAL
INT
MONEY
NUMERIC (p,s)
SMALLINT
SMALLMONEY
TINYINT
REAL
FLOAT
DATETIME
DATETIME2 (SQL Server 2008 and later)
SMALLDATETIME
DATE
TIME
DATETIMEOFFSET
CHAR
VARCHAR
VARCHAR (max)
NCHAR
AWS DMS Data Types
INT8
BOOLEAN
NUMERIC
INT4
NUMERIC
NUMERIC
INT2
NUMERIC
UINT1
REAL4
REAL8
DATETIME
DATETIME
DATETIME
DATE
TIME
WSTRING
STRING
STRING
CLOB
TEXT
To use this data type with AWS DMS, you must enable the use of CLOB data types for a specific task.
For SQL Server tables, AWS DMS updates LOB columns in the target even for UPDATE statements that don't change the value of the LOB column in
SQL Server.
During CDC, AWS DMS supports CLOB data types only in tables that include a primary key.
WSTRING
Version API Version 2016-01-01
63
BINARY
VARBINARY
VARBINARY (max)
TIMESTAMP
UNIQUEIDENTIFIER
HIERARCHYID
AWS Database Migration Service User Guide
Source Data Types for SQL Server
SQL Server Data Types
NVARCHAR (length)
NVARCHAR (max)
AWS DMS Data Types
WSTRING
NCLOB
NTEXT
To use this data type with AWS DMS, you must enable the use of NCLOB data types for a specific task.
For SQL Server tables, AWS DMS updates LOB columns in the target even for UPDATE statements that don't change the value of the LOB column in
SQL Server.
During CDC, AWS DMS supports CLOB data types only in tables that include a primary key.
BYTES
BYTES
BLOB
IMAGE
For SQL Server tables, AWS DMS updates LOB columns in the target even for UPDATE statements that don't change the value of the LOB column in
SQL Server.
To use this data type with AWS DMS, you must enable the use of BLOB data types for a specific task.
AWS DMS supports BLOB data types only in tables that include a primary key.
BYTES
STRING
Use HIERARCHYID when replicating to a SQL
Server target endpoint.
Use WSTRING (250) when replicating to all other target endpoints.
Version API Version 2016-01-01
64
AWS Database Migration Service User Guide
Source Data Types for PostgreSQL
SQL Server Data Types
XML
GEOMETRY
GEOGRAPHY
AWS DMS Data Types
NCLOB
For SQL Server tables, AWS DMS updates LOB columns in the target even for UPDATE statements that don't change the value of the LOB column in
SQL Server.
To use this data type with AWS DMS, you must enable the use of NCLOB data types for a specific task.
During CDC, AWS DMS supports NCLOB data types only in tables that include a primary key.
Use GEOMETRY when replicating to target endpoints that support this data type.
Use CLOB when replicating to target endpoints that don't support this data type.
Use GEOGRAPHY when replicating to target endpoints that support this data type.
Use CLOB when replicating to target endpoints that do not support this data type.
AWS DMS does not support tables that include fields with the following data types:
• CURSOR
• SQL_VARIANT
• TABLE
Note
User-defined data types are supported according to their base type. For example, a user-defined data type based on DATETIME is handled as a DATETIME data type.
Source Data Types for PostgreSQL
The following table shows the PostgreSQL source data types that are supported when using AWS DMS and the default mapping to AWS DMS data types.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
PostgreSQL Data Types
INTEGER
SMALLINT
BIGINT
AWS DMS Data Types
INT4
INT2
INT8
Version API Version 2016-01-01
65
CHAR
CHAR(N)
VARCHAR(N)
TEXT
BYTEA
TIMESTAMP
TIMESTAMP (z)
DATE
TIME
TIME (z)
INTERVAL
BOOLEAN
ENUM
CIDR
INET
MACADDR
BIT (n)
BIT VARYING (n)
DECIMAL(P,S)
REAL
DOUBLE
SMALLSERIAL
SERIAL
BIGSERIAL
MONEY
AWS Database Migration Service User Guide
Source Data Types for PostgreSQL
PostgreSQL Data Types
NUMERIC (p,s)
AWS DMS Data Types
If precision is from 0 through 38, then use NUMER-
IC.
If precision is 39 or greater, then use STRING.
If precision is from 0 through 38, then use NUMER-
IC.
If precision is 39 or greater, then use STRING.
REAL4
REAL8
INT2
INT4
INT8
NUMERIC(38,4)
Note: The MONEY data type is mapped to FLOAT in SQL Server.
WSTRING (1)
WSTRING (n)
WSTRING (n)
NCLOB
BLOB
TIMESTAMP
TIMESTAMP
DATE
TIME
TIME
STRING (128)—1 YEAR, 2 MONTHS, 3 DAYS, 4
HOURS, 5 MINUTES, 6 SECONDS
STRING (1) F or T
STRING (64)
STRING (50)
STRING (50)
STRING (18)
STRING (n)
STRING (n)
Version API Version 2016-01-01
66
AWS Database Migration Service User Guide
Source Data Types for MySQL
PostgreSQL Data Types
UUID
TSVECTOR
TSQUERY
XML
POINT
LINE
LSEG
BOX
PATH
POLYGON
CIRCLE
JSON
ARRAY
COMPOSITE
INT4RANGE
INT8RANGE
NUMRANGE
STRRANGE
AWS DMS Data Types
STRING
CLOB
CLOB
CLOB
STRING (255) "(x,y)"
STRING (255) "(x,y,z)"
STRING (255) "((x1,y1),(x2,y2))"
STRING (255) "((x1,y1),(x2,y2))"
CLOB "((x1,y1),(xn,yn))"
CLOB "((x1,y1),(xn,yn))"
STRING (255) "(x,y),r"
NCLOB
NCLOB
NCLOB
STRING (255)
STRING (255)
STRING (255)
STRING (255)
Source Data Types for MySQL
The following table shows the MySQL database source data types that are supported when using AWS
DMS and the default mapping from AWS DMS data types.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
MySQL Data Types
INT
MEDIUMINT
BIGINT
TINYINT
DECIMAL(10)
BINARY
BIT
AWS DMS Data Types
INT4
INT4
INT8
INT1
NUMERIC (10,0)
BYTES(1)
BOOLEAN
Version API Version 2016-01-01
67
MySQL Data Types
BIT(64)
BLOB
LONGBLOB
MEDIUMBLOB
TINYBLOB
DATE
DATETIME
TIME
TIMESTAMP
YEAR
DOUBLE
FLOAT
VARCHAR (45)
VARCHAR (2000)
VARCHAR (4000)
VARBINARY (4000)
VARBINARY (2000)
CHAR
TEXT
LONGTEXT
MEDIUMTEXT
TINYTEXT
GEOMETRY
POINT
LINESTRING
POLYGON
MULTIPOINT
MULTILINESTRING
AWS Database Migration Service User Guide
Source Data Types for MySQL
AWS DMS Data Types
BYTES(8)
BYTES(66535)
BLOB
BLOB
BYTES(255)
DATE
DATETIME
STRING
DATETIME
INT2
REAL8
REAL(DOUBLE)
The supported FLOAT range is -1.79E+308 to -
2.23E-308, 0 and 2.23E-308 to 1.79E+308
If the FLOAT values are not in the range specified here, map the FLOAT data type to the STRING data type.
WSTRING (45)
WSTRING (2000)
WSTRING (4000)
BYTES (4000)
BYTES (2000)
WSTRING
WSTRING (65535)
NCLOB
NCLOB
WSTRING (255)
BLOB
BLOB
BLOB
BLOB
BLOB
BLOB
Version API Version 2016-01-01
68
AWS Database Migration Service User Guide
Target Data Types
MySQL Data Types
MULTIPOLYGON
GEOMETRYCOLLECTION
AWS DMS Data Types
BLOB
BLOB
Note
If the DATETIME and TIMESTAMP data types are specified with a “zero” value (that is,
0000-00-00), you need to make sure that the target database in the replication task supports
"zero" values for the DATETIME and TIMESTAMP data types. If they are not supported, you can use a transformation to specify a supported value (for example, 1970). Otherwise, they are recorded as null on the target.
The following MySQL data types are supported in full load only:
MySQL Data Types
ENUM
SET
AWS DMS Data Types
STRING
STRING
Target Data Types
You can find data type conversion tables for databases used as a target for AWS Database Migration
Service following.
Topics
•
Target Data Types for Oracle (p. 69)
•
Target Data Types for Microsoft SQL Server (p. 71)
•
Target Data Types for PostgreSQL (p. 72)
•
Target Data Types for MySQL (p. 73)
Target Data Types for Oracle
A target Oracle database used with AWS DMS supports most Oracle data types. The following table shows the Oracle target data types that are supported when using AWS DMS and the default mapping from AWS DMS data types. For more information about how to view the data type that is mapped from the source, see the section for the source you are using.
AWS DMS Data Type
BOOLEAN
BYTES
DATE
TIME
DATETIME
INT1
Oracle Data Type
NUMBER (1)
RAW (length)
DATETIME
TIMESTAMP (0)
TIMESTAMP (scale)
NUMBER (3)
Version API Version 2016-01-01
69
AWS DMS Data Type
INT2
INT4
INT8
NUMERIC
REAL4
REAL8
STRING
UINT1
UINT2
UINT4
UINT8
WSTRING
BLOB
CLOB
NCLOB
AWS Database Migration Service User Guide
Target Data Types for Oracle
Oracle Data Type
NUMBER (5)
NUMBER (10)
NUMBER (19)
NUMBER (p,s)
FLOAT
FLOAT
With date indication: DATE
With time indication: TIMESTAMP
With timestamp indication: TIMESTAMP
With timestamp_with_timezone indication: TIMESTAMP WITH
TIMEZONE
With timestamp_with_local_timezone indication: TIMESTAMP WITH
LOCAL TIMEZONE With interval_year_to_month indication: INTERVAL
YEAR TO MONTH
With interval_day_to_second indication: INTERVAL DAY TO SECOND
In all other cases: VARCHAR2 (Length)
NUMBER (3)
NUMBER (5)
NUMBER (10)
NUMBER (19)
NAVARCHAR2 (length)
BLOB
To use this data type with AWS DMS, you must enable the use of BLOBs for a specific task. BLOB data types are supported only in tables that include a primary key
CLOB
To use this data type with AWS DMS, you must enable the use of CLOBs for a specific task. During CDC, CLOB data types are supported only in tables that include a primary key.
NCLOB
To use this data type with AWS DMS, you must enable the use of
NCLOBs for a specific task. During CDC, NCLOB data types are supported only in tables that include a primary key.
Version API Version 2016-01-01
70
AWS Database Migration Service User Guide
Target Data Types for SQL Server
AWS DMS Data Type
XMLTYPE
Oracle Data Type
The XMLTYPE target data type is only relevant in Oracle-to-Oracle replication tasks.
When the source database is Oracle, the source data types are replicated
"as is" to the Oracle target. For example, an XMLTYPE data type on the source is created as an XMLTYPE data type on the target.
Target Data Types for Microsoft SQL Server
The following table shows the Microsoft SQL Server target data types that are supported when using
AWS DMS and the default mapping from AWS DMS data types. For additional information about AWS
DMS data types, see
Data Types for AWS Database Migration Service (p. 75) .
AWS DMS Data Type
BOOLEAN
BYTES
DATE
TIME
DATETIME
INT1
INT2
INT4
INT8
NUMERIC
REAL4
REAL8
STRING
SQL Server Data Type
TINYINT
VARBINARY(length)
For SQL Server 2008 and later, use DATE.
For earlier versions, if the scale is 3 or less use DATETIME. In all other cases, use VARCHAR (37).
For SQL Server 2008 and later, use DATETIME2 (%d).
For earlier versions, if the scale is 3 or less use DATETIME. In all other cases, use VARCHAR (37).
For SQL Server 2008 and later, use DATETIME2 (scale).
For earlier versions, if the scale is 3 or less use DATETIME. In all other cases, use VARCHAR (37).
SMALLINT
SMALLINT
INT
BIGINT
NUMBER (p,s)
REAL
FLOAT
If the column is a date or time column, then do the following:
• For SQL Server 2008 and later, use DATETIME2.
• For earlier versions, if the scale is 3 or less use DATETIME. In all other cases, use VARCHAR (37).
If the column is not a date or time column, use VARCHAR (length).
Version API Version 2016-01-01
71
AWS Database Migration Service User Guide
Target Data Types for PostgreSQL
AWS DMS Data Type
UINT1
UINT2
UINT4
UINT8
WSTRING
BLOB
CLOB
NCLOB
SQL Server Data Type
TINYINT
SMALLINT
INT
BIGINT
NVARCHAR (length)
VARBINARY(max)
IMAGE
To use this data type with AWS DMS, you must enable the use of BLOBs for a specific task. AWS DMS supports BLOB data types only in tables that include a primary key.
VARCHAR(max)
To use this data type with AWS DMS, you must enable the use of CLOBs for a specific task. During CDC, AWS DMS supports CLOB data types only in tables that include a primary key.
NVARCHAR(max)
To use this data type with AWS DMS, you must enable the use of
NCLOBs for a specific task. During CDC, AWS DMS supports NCLOB data types only in tables that include a primary key.
Target Data Types for PostgreSQL
The PostgreSQL database endpoint for AWS DMS supports most PostgreSQL database data types. The following table shows the PostgreSQL database target data types that are supported when using AWS
DMS and the default mapping from AWS DMS data types. Unsupported data types are listed following the table.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
AWS DMS Data Type
BOOL
BYTES
DATE
TIME
TIMESTAMP
INT1
INT2
PostgreSQL Data Type
BOOL
BYTEA
DATE
TIME
If the scale is from 0 through 6, then use TIMESTAMP.
If the scale is from 7 through 9, then use VARCHAR (37).
SMALLINT
SMALLINT
Version API Version 2016-01-01
72
AWS Database Migration Service User Guide
Target Data Types for MySQL
AWS DMS Data Type
INT4
INT8
NUMERIC
REAL4
REAL8
STRING
UINT1
UINT2
UINT4
UINT8
WSTRING
BCLOB
NCLOB
CLOB
PostgreSQL Data Type
INTEGER
BIGINT
DECIMAL (P,S)
FLOAT4
FLOAT8
If the length is from 1 through 21,845, then use VARCHAR (length in bytes).
If the length is 21,846 through 2,147,483,647, then use VARCHAR
(65535).
SMALLINT
INTEGER
BIGINT
BIGINT
If the length is from 1 through 21,845, then use VARCHAR (length in bytes).
If the length is 21,846 through 2,147,483,647, then use VARCHAR
(65535).
BYTEA
TEXT
TEXT
Note
When replicating from a PostgreSQL source, AWS DMS creates the target table with the same data types for all columns, apart from columns with user-defined data types. In such cases, the data type is created as "character varying" in the target.
Target Data Types for MySQL
The following table shows the MySQL database target data types that are supported when using AWS
DMS and the default mapping from AWS DMS data types.
For additional information about AWS DMS data types, see
Data Types for AWS Database Migration
AWS DMS Data Types
BOOLEAN
MySQL Data Types
BOOLEAN
Version API Version 2016-01-01
73
INT1
INT2
INT4
INT8
NUMERIC
REAL4
REAL8
STRING
DATE
TIME
TIMESTAMP
UINT1
UINT2
UINT4
UINT8
WSTRING
BLOB
AWS Database Migration Service User Guide
Target Data Types for MySQL
AWS DMS Data Types
BYTES
MySQL Data Types
If the length is from 1 through 65,535, then use
VARBINARY (length).
If the length is from 65,536 through 2,147,483,647, then use LONGLOB.
DATE
TIME
If the scale is from 0 through 6, then use BIGDAT-
ETIME.
If the scale is from 7 through 9, then use VARCHAR
(37).
TINYINT
SMALLINT
INTEGER
BIGINT
DECIMAL (p,s)
FLOAT
DOUBLE PRECISION
If the length is from 1 through 21,845, then use
VARCHAR (length).
If the length is from 21,846 through 2,147,483,647, then use LONGTEXT.
UNSIGNED TINYINT
UNSIGNED SMALLINT
UNSIGNED INTEGER
UNSIGNED BIGINT
If the length is from 1 through 32,767, then use
VARCHAR (length).
If the length is from 32,768 through 2,147,483,647, then use LONGTEXT.
If the length is from 1 through 65,535, then use
BLOB.
If the length is from 65,536 through 2,147,483,647, then use LONGBLOB.
If the length is 0, then use LONGBLOB (full LOB support).
Version API Version 2016-01-01
74
CLOB
AWS Database Migration Service User Guide
AWS DMS Data Types
AWS DMS Data Types
NCLOB
MySQL Data Types
If the length is from 1 through 65,535, then use
TEXT.
If the length is from 65,536 through 2,147,483,647, then use LONGTEXT with ucs2 for CHARACTER
SET.
If the length is 0, then use LONGTEXT (full LOB support) with ucs2 for CHARACTER SET.
If the length is from 1 through 65535, then use
TEXT.
If the length is from 65536 through 2147483647, then use LONGTEXT.
If the length is 0, then use LONGTEXT (full LOB support).
Data Types for AWS Database Migration Service
AWS Database Migration Service uses built-in data types to migrate data from one database to another.
The following table shows the built-in data types and their descriptions.
AWS DMS Data Types
STRING
WSTRING
BOOLEAN
BYTES
DATE
TIME
DATETIME
INT1
INT2
INT4
INT8
NUMERIC
REAL4
REAL8
Description
A character string.
A double-byte character string.
A Boolean value.
A binary data value.
A date value: year, month, day.
A time value: hour, minutes, seconds.
A timestamp value: year, month, day, hour, minute, second, fractional seconds. The fractional seconds have a maximum scale of 9 digits.
A one-byte, signed integer.
A two-byte, signed integer.
A four-byte, signed integer.
An eight-byte, signed integer.
An exact numeric value with a fixed precision and scale.
A single-precision floating-point value.
A double-precision floating-point value.
Version API Version 2016-01-01
75
AWS DMS Data Types
UINT1
UINT2
UINT4
UINT8
BLOB
CLOB
NCLOB
AWS Database Migration Service User Guide
AWS DMS Data Types
Description
A one-byte, unsigned integer.
A two-byte, unsigned integer.
A four-byte, unsigned integer.
An eight-byte, unsigned integer.
Binary large object. This data type can be used only with Oracle endpoints.
Character large object. For more information and a list of endpoints that support using LOBs, see
AWS Database Migration Service LOB Support (p. 14) .
Native character large object. For more information and a list of endpoints that support using LOBs,
see AWS Database Migration Service LOB Support (p. 14) .
Version API Version 2016-01-01
76
AWS Database Migration Service User Guide
Document History
The following table describes the important changes to the documentation since the last release of the
AWS Database Migration Service.
• API version: 20151225
• Latest documentation update: January 21, 2016
Change
Public preview release
Description
Released the preview documentation for AWS Database
Migration Service.
Date Changed
January 21, 2016
Version API Version 2016-01-01
77
Stiahnuť
Reklama