

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS CLI 및를 AWS SCT AWS DMS 사용하여 Amazon RDS for Oracle을 Amazon RDS for PostgreSQL로 마이그레이션 CloudFormation
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation"></a>

*Pinesh Singal, Amazon Web Services*

## 요약
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-summary"></a>

이 패턴은 AWS Command Line Interface ()를 사용하여 Oracle DB 인스턴스[용 멀티테라바이트 Amazon Relational Database Service(RDS)](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Oracle.html)를 [Amazon RDS for PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html) DB 인스턴스로 마이그레이션하는 방법을 보여줍니다AWS CLI. 이 접근 방식은 가동 중지 시간을 최소화하며 AWS Management Console에 로그인할 필요가 없습니다.

이 패턴은 AWS Schema Conversion Tool (AWS SCT) 및 AWS Database Migration Service (AWS DMS) 콘솔을 사용하여 수동 구성 및 개별 마이그레이션을 방지하는 데 도움이 됩니다. 이 솔루션은 여러 데이터베이스에 대해 일회성 구성을 설정하고에서 AWS SCT 및를 사용하여 마이그레이션 AWS DMS 을 수행합니다 AWS CLI.

이 패턴은 AWS SCT 를 사용하여 데이터베이스 스키마 객체를 Amazon RDS for Oracle에서 Amazon RDS for PostgreSQL로 변환한 다음 AWS DMS 를 사용하여 데이터를 마이그레이션합니다. 에서 Python 스크립트를 사용하여 CloudFormation 템플릿을 사용하여 AWS SCT 객체와 AWS DMS 태스크를 AWS CLI생성합니다.

## 사전 조건 및 제한 사항
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-prereqs"></a>

**사전 조건 **
+ 활성. AWS 계정
+ 기존 Amazon RDS for Oracle DB 인스턴스입니다.
+ 기존 Amazon RDS for PostgreSQL DB 인스턴스입니다. 
+ 스크립트 실행을 위한 Windows 또는 Linux OS가 설치된 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스 또는 로컬 시스템입니다.
+ `full-load`, , AWS DMS 마이그레이션 작업 유형에 대한 이해`cdc``full-load-and-cdc`.  자세한 내용은 AWS DMS 설명서의 [작업 생성을](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.Creating.html) 참조하세요. 
+ AWS SCT는 Oracle 및 PostgreSQL 데이터베이스 엔진용 Java Database Connectivity(JDBC) 드라이버와 함께 설치 및 구성되었습니다. 자세한 내용은 AWS SCT 설명서의 [설치 및 구성을 AWS SCT](https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_Installing.html#CHAP_Installing.Procedure) 참조하세요. 
+ 설치된 AWS SCT 폴더의 `AWSSchemaConversionToolBatch.jar` 파일로, 작업 디렉터리에 복사됩니다.
+ 작업 디렉토리에서 `cli-sct-dms-cft.zip` 파일(첨부됨)이 다운로드 및 추출되었습니다.
+ 최신 AWS DMS 복제 인스턴스 엔진 버전입니다. 자세한 내용은 AWS Support 설명서 및 [AWS DMS 릴리스 정보](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReleaseNotes.html)에서 [AWS DMS 복제 인스턴스를 생성하려면 어떻게](https://aws.amazon.com/premiumsupport/knowledge-center/create-aws-dms-replication-instance/) 해야 합니까?를 참조하세요. 
+ AWS CLI 버전 2, 스크립트가 실행되는 EC2 인스턴스 또는 OS의 액세스 키 ID, 보안 액세스 키 및 기본 AWS 리전 이름으로 설치 및 구성됨. 자세한 내용은 AWS CLI 설명서[의 설치 또는 최신 버전으로 업데이트 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) 및 [에 대한 설정 구성을 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) 참조하세요. 
+  CloudFormation 템플릿에 대한 지식. 자세한 내용은 CloudFormation 설명서의 [CloudFormation 작동 방식을](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-overview.html) 참조하세요. 
+ Python 버전 3이 스크립트가 실행되는 EC2 인스턴스 또는 OS에 설치 및 구성되었습니다. 자세한 내용은 [Python 설명서](https://docs.python.org/3/)를 참조하세요. 

**제한 사항 **
+ 소스 Amazon RDS for Oracle DB 인스턴스에 대한 최소 요구 사항은 다음과 같습니다. 
  + Enterprise, Standard, Standard One 및 Standard Two 에디션용 Oracle 버전 12c(12.1.0.2, 12.2.0.1), 18c(18.0.0.0) 및19c(19.0.0.0)입니다.
  + Amazon RDS는 Oracle 18c(18.0.0.0)를 지원하지만, 이 버전은 지원 종료일 이후 Oracle이 더 이상 18c에 대한 패치를 제공하지 않으므로 더 이상 사용되지 않는 버전입니다. 자세한 내용은 Amazon RDS 설명서의 [Amazon RDS for Oracle](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Oracle.html#Oracle.Concepts.Deprecate.11204)에서 참조하세요.
  + Amazon RDS for Oracle 11g는 더 이상 지원되지 않습니다.
+ 대상 Amazon RDS for PostgreSQL DB 인스턴스의 최소 요구 사항은 다음과 같습니다. 
  + PostgreSQL 버전 9(9.5 및 9.6) 10.x, 11.x, 12.x. 및 13.x

**제품 버전**
+ Amazon RDS for Oracle DB 인스턴스 버전 12.1.0.2 이상
+ Amazon RDS for PostgreSQL DB 인스턴스 버전 11.5 이상
+ AWS CLI 버전 2 
+ 의 최신 버전 AWS SCT
+ Python 3의 최신 버전

## 아키텍처
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-architecture"></a>

**소스 기술 스택  **
+ Amazon RDS for Oracle

**대상 기술 스택  **
+ Amazon RDS for PostgreSQL

**소스 및 대상 아키텍처 **

다음 다이어그램은 AWS DMS 및 Python 스크립트를 사용하여 Amazon RDS for Oracle DB 인스턴스를 Amazon RDS for PostgreSQL DB 인스턴스로 마이그레이션하는 방법을 보여줍니다.

![AWS DMS 및 Python을 사용하여 RDS for Oracle DB 인스턴스를 RDS for PostgreSQL DB 인스턴스로 마이그레이션.](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/images/pattern-img/5e041494-2e64-4f09-b6ec-0e0cba3a4972/images/77022e13-46fb-4aa8-ab49-85b0ca4c317a.png)


 

이 다이어그램은 다음의 마이그레이션 워크플로우를 보여줍니다.

1. Python 스크립트는 AWS SCT 를 사용하여 소스 및 대상 DB 인스턴스에 연결합니다.

1. 사용자는 Python 스크립트 AWS SCT 로 시작하여 Oracle 코드를 PostgreSQL 코드로 변환하고 대상 DB 인스턴스에서 실행합니다.

1. Python 스크립트는 소스 및 대상 DB 인스턴스에 대한 AWS DMS 복제 작업을 생성합니다.

1. 사용자는 Python 스크립트를 배포하여 AWS DMS 작업을 시작한 다음 데이터 마이그레이션이 완료된 후 작업을 중지합니다.

**자동화 및 규모 조정**

추가 기능을 제공할 파라미터와 보안 관련 변경 사항을 Python 스크립트에 추가하여 이 마이그레이션을 자동화할 수 있습니다. 

## 도구
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-tools"></a>
+ [AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)는 명령줄 셸의 명령을 통해 AWS 서비스와 상호 작용하는 데 도움이 되는 오픈 소스 도구입니다.
+ [CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)를 사용하면 AWS 리소스를 설정하고, 리소스를 빠르고 일관되게 프로비저닝하고, AWS 계정 및 리전의 수명 주기 동안 리소스를 관리할 수 있습니다. 이 패턴은 Python 스크립트를 사용하여 `.csv` 입력 파일을 `.json` 입력 파일로 변환합니다. `.json` 파일은 Amazon 리소스 이름(ARNs), 마이그레이션 유형, 작업 설정 및 테이블 매핑을 사용하여 여러 AWS DMS 복제 작업을 생성하는 CloudFormation 스택을 생성하는 AWS CLI 명령에 사용됩니다.
+ [AWS Database Migration Service (AWS DMS)](https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html)를 사용하면 데이터 스토어를 또는 클라우드와 온프레미스 설정의 조합 AWS 클라우드 간에 마이그레이션할 수 있습니다. 이 패턴은 AWS DMS 를 사용하여 명령줄에서 실행되는 Python 스크립트로 작업을 생성, 시작 및 중지하고 CloudFormation 템플릿을 생성합니다.
+ [AWS Schema Conversion Tool (AWS SCT)](https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_Welcome.html)는 소스 데이터베이스 스키마와 대부분의 사용자 지정 코드를 대상 데이터베이스와 호환되는 형식으로 자동 변환하여 이기종 데이터베이스 마이그레이션을 지원합니다. 이 패턴에는 설치된 AWS SCT 디렉터리의 `AWSSchemaConversionToolBatch.jar` 파일이 필요합니다.

**코드**

`cli-sct-dms-cft.zip` 파일(첨부됨)에는 이 패턴의 전체 소스 코드가 들어 있습니다.

## 에픽
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-epics"></a>

### 에서 데이터베이스 객체 구성 AWS SCT 및 생성 AWS CLI
<a name="configure-awssct-and-create-database-objects-in-the-cli"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 에서 실행 AWS SCT 되도록를 구성합니다 AWS CLI. | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation.html) | DBA | 
| `run_aws_sct.py` Python 스크립트를 실행합니다. | 다음 명령을 사용하여 `run_aws_sct.py` Python 스크립트를 실행합니다.<br />`$ python run_aws_sct.py database_migration.txt`<br />Python 스크립트는 Oracle에서 PostgreSQL로 데이터베이스 객체를 변환하고 PostgreSQL 형식으로 SQL 파일을 생성합니다. 또한 스크립트는 데이터베이스 객체에 대한 자세한 권장 사항 및 변환 통계를 제공하는 `Database migration assessment report` PDF 파일을 생성합니다. | DBA | 
| Amazon RDS for PostgreSQL에서 객체를 생성합니다. | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation.html) | DBA | 

### AWS CLI 및를 사용하여 AWS DMS 태스크 구성 및 생성 CloudFormation
<a name="configure-and-create-dms-tasks-by-using-the-cli-and-cfn"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
|  AWS DMS 복제 인스턴스를 생성합니다. | 에 로그인하고 [AWS DMS 콘솔](https://console.aws.amazon.com/dms/v2/)을 AWS Management Console연 다음 요구 사항에 따라 구성된 복제 인스턴스를 생성합니다.<br />자세한 내용은 AWS DMS 설명서의 [복제 인스턴스 생성](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.Creating.html) 및 AWS Support 설명서의 [AWS DMS 복제 인스턴스 생성 방법을](https://aws.amazon.com/premiumsupport/knowledge-center/create-aws-dms-replication-instance/) 참조하세요. | DBA | 
| 소스 엔드포인트를 생성합니다. |  AWS DMS 콘솔에서 **엔드포인트**를 선택한 다음 요구 사항에 따라 Oracle 데이터베이스의 소스 엔드포인트를 생성합니다. 추가 연결 속성은 `-2` 값이 포함된 `numberDataTypeScale`이어야 합니다.<br />자세한 내용은 AWS DMS 설명서의 [소스 및 대상 엔드포인트 생성을](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.Creating.html) 참조하세요. | DBA | 
| 대상 엔드포인트를 생성합니다. |  AWS DMS 콘솔에서 **엔드포인트**를 선택한 다음 요구 사항에 따라 PostgreSQL 데이터베이스의 대상 엔드포인트를 생성합니다. <br />자세한 내용은 AWS DMS 설명서의 [소스 및 대상 엔드포인트 생성을](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.Creating.html) 참조하세요. | DevOps 엔지니어 | 
| 에서 실행되도록 AWS DMS 복제 세부 정보를 구성합니다 AWS CLI. | 다음 형식을 사용하여 AWS DMS 소스 엔드포인트 ARN, 대상 엔드포인트 ARN 및 복제 인스턴스 ARN을 사용하여 `dms-arn-list.txt` 파일의 소스 및 대상 엔드포인트와 복제 세부 정보를 구성합니다.<pre>#sourceARN,targetARN,repARN<br />arn:aws:dms:us-east-1:123456789012:endpoint:EH7AINRUDZ5GOYIY6HVMXECMCQ<br />arn:aws:dms:us-east-1:123456789012:endpoint:HHJVUV57N7O3CQF4PJZKGIOYY5<br />arn:aws:dms:us-east-1:123456789012:rep:LL57N77AQQAHHJF4PJFHNEDZ5G</pre> | DBA | 
| `dms-create-task.py` Python 스크립트를 실행하여 AWS DMS 작업을 생성합니다. | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation.html) | DBA | 
|  AWS DMS 작업이 준비되었는지 확인합니다. |  AWS DMS 콘솔의 `Ready` 상태 섹션에서 AWS DMS 작업이 **상태**인지 확인합니다. | DBA | 

### 를 사용하여 AWS DMS 태스크 시작 및 중지 AWS CLI
<a name="start-and-stop-the-dms-tasks-by-using-the-cli"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
|  AWS DMS 작업을 시작합니다. | 다음 명령을 사용하여 `dms-start-task.py` Python 스크립트를 실행합니다.<pre>$ python dms-start-task.py start '<cdc-start-datetime>'</pre>시작 날짜 및 시간은 `'DD-MON-YYYY'` 또는 `'YYYY-MM-DDTHH:MI:SS'` 형식이어야 합니다(예: `'01-Dec-2019'` 또는 `'2018-03-08T12:12:12'`).<br /> AWS DMS 콘솔의 AWS DMS 작업 페이지에 있는 **테이블 통계** 탭에서 **작업** 상태를 검토할 수 있습니다. | DBA | 
| 데이터를 검증합니다. | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation.html)자세한 내용은 AWS DMS 설명서의 [AWS DMS 데이터 검증](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Validating.html)을 참조하세요. | DBA | 
|  AWS DMS 작업을 중지합니다. | 다음 명령을 사용하여 Python 스크립트를 실행합니다.<pre>$ python dms-start-task.py stop</pre>AWS DMS 검증 `failed`상태에 따라 작업이 상태로 중지될 수 있습니다. 자세한 정보는 다음 섹션을 참조하세요. | DBA | 

## 문제 해결
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-troubleshooting"></a>


| 문제 | Solution | 
| --- | --- | 
| AWS SCT 소스 및 대상 테스트 연결이 실패합니다. | 들어오는 트래픽을 수락하도록 JDBC 드라이버 버전과 VPC 보안 그룹 인바운드 규칙을 구성합니다. | 
| 소스 또는 대상 엔드포인트 테스트 실행 실패 | 엔드포인트 설정 및 복제 인스턴스가 `Available` 상태인지 확인합니다. 엔드포인트 연결 상태가 `Successful` 인지 확인합니다. <br />자세한 내용은 AWS Support 설명서의 [AWS DMS 엔드포인트 연결 실패 문제를 해결하려면 어떻게](https://aws.amazon.com/premiumsupport/knowledge-center/dms-endpoint-connectivity-failures/) 해야 합니까?를 참조하세요. | 
| 전체 로드 실행 실패 | 소스 및 대상 데이터베이스의 데이터 유형 및 크기가 일치하는지 확인합니다. <br />자세한 내용은 AWS DMS 설명서의 [의 마이그레이션 작업 문제 해결을 AWS DMS](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Troubleshooting.html) 참조하세요. | 
| 검증 실행 오류가 발생합니다. | 비 프라이머리 키 테이블은 검증되지 않으므로 테이블에 프라이머리 키가 있는지 확인합니다.<br />테이블에 프라이머리 키와 오류가 있는 경우 소스 엔드포인트의 추가 연결 속성에 `numberDataTypeScale=-2`이(가) 있는지 확인합니다.<br />자세한 내용은 AWS DMS 설명서에서 [Oracle을 소스로 사용할 때 엔드포인트 설정 AWS DMS](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.Oracle.html#CHAP_Source.Oracle.ConnectionAttrib), [OracleSettings](https://docs.aws.amazon.com/dms/latest/APIReference/API_OracleSettings.html) 및 [문제 해결을 참조하세요](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Validating.html#CHAP_Validating.Troubleshooting). | 

## 관련 리소스
<a name="migrate-amazon-rds-for-oracle-to-amazon-rds-for-postgresql-with-aws-sct-and-aws-dms-using-aws-cli-and-aws-cloudformation-resources"></a>
+ [설치 및 구성 AWS SCT](https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_Installing.html#CHAP_Installing.Procedure)
+ [AWS DMS소개](https://www.youtube.com/watch?v=ouia1Sc5QGo)(동영상)
+ [AWS CLI 및 PowerShell에 대한 CloudFormation 스택 작업 명령의 예](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-using-cli.html)
+ [의 사용자 인터페이스 탐색 AWS SCT](https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_UserInterface.html)
+ [Oracle 데이터베이스를의 소스로 사용 AWS DMS](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.Oracle.html)
+ [를 사용하여 Oracle 데이터베이스에 연결 AWS SCT](https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_Source.Oracle.html)
+ [PostgreSQL 데이터베이스를의 대상으로 사용 AWS DMS](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.PostgreSQL.html) 
+ [데이터 마이그레이션용 소스](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.html)
+ [마이그레이션에 적합한 대상](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.html)
+ [cloudformation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/index.html)(AWS CLI 문서)
+ [create-stack](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/create-stack.html)(AWS CLI 문서) 
+ [dms](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/index.html)(AWS CLI 문서) 

## 첨부
<a name="attachments-5e041494-2e64-4f09-b6ec-0e0cba3a4972"></a>

이 문서와 관련된 추가 콘텐츠에 액세스하려면 [attachment.zip](samples/p-attach/5e041494-2e64-4f09-b6ec-0e0cba3a4972/attachments/attachment.zip) 파일의 압축을 풉니다.