Question

1.DMS 사용 시 기존 DB에서 테이블 스페이스로 마이그레이션 진행이 아닌, 소스 DB의 구조 그대로 마이그레이션을 진행하고 싶습니다.

기존 시도의 결과 Default Tablespace 영역에 생성이 되는것을 확인하였습니다.

2. 테이블 스페이스 변경 시, JSON 편집기를 통해 한개 씩 지정을 해야하는 것인가?

구성은 아래와 같습니다.

"소스"

    -------------------------------------------------------------------------------------

    DB User               Table-name                Tablespace-name

    -------------------------------------------------------------------------------------

    dbuser-1              dbuser-table1              tablespace-1

    dbuser-1              dbuser-table2              tablespace-2

    dbuser-1              dbuser-table3              tablespace-3

    dbuser-1              dbuser-table4              tablespace-4

    dbuser-1              dbuser-table5              tablespace-5

    dbuser-1              dbuser-table6              tablespace-6    









"대상"

    -------------------------------------------------------------------------------------

    DB User                     Table-name                Tablespace-name

    -------------------------------------------------------------------------------------

    mig-dbuser-1              dbuser-table1              tablespace-1   

    mig-dbuser-1              dbuser-table2              tablespace-2   

    mig-dbuser-1              dbuser-table3              tablespace-3  

    mig-dbuser-1              dbuser-table4              tablespace-4  

    mig-dbuser-1              dbuser-table5              tablespace-5   

    miog-dbuser-1              dbuser-table6             ablespace-6   



Answer


안녕하세요 담당자님,

베스핀글로벌 담당자입니다.


DMS  사용 시 대상 DB에서 기본 테이블 스페이스로 마이그레이션이 아닌, 소스DB의 구조 그대로 마이그레이션을 원하시는 것으로 이해하였습니다.


=> DMS를 이용해 마이그레이션 진행 시 , 테이블 스페이스와 관계 없이 모든 테이블은 대상 DB Default 테이블 스페이스로 마이그레이션 됩니다.

태스크 생성 시 테이블매핑 항목에서 마법사 또는 JSON 편집기로  selection(선택)과 transformation(변환) 모두 설정해주어야 합니다.



*참고문서: https://docs.aws.amazon.com/ko_kr/dms/latest/userguide/CHAP_Target.Oracle.html

태스크 생성 예시

    태스크 생성 시 아래와 같이 설정하시면 스키마(테이블스페이스)/테이블을 그대로 마이그레이션 할 수 있습니다.


선택 규칙만 설정하고 변환 규칙을 설정하지 않는다면, 소스DB의 테이블이 대상DB의 기본 테이블스페이스로 마이그레이션 됩니다.

위와 같이 설정했음에도 대상DB의 원하는 스키마에 테이블이 마이그레이션 되지 않는다면,

아래 두가지 항목을 체크해보시기 바랍니다.


1-1. 스키마와 테이블스페이스가 매핑되었는지 확인

먼저 유저(스키마)와 테이블스페이스가 제대로 매핑되었는지 확인합니다.

//

SELECT USERNAME, DEFAULT_TABLESPACE FROM dba_users;

//


만약, 매핑이 되어있지 않다면, 

//

ALTER USER [유저명] DEFAULT TABLESPACE [테이블스페이스명];

//

유저와 테이블스페이스를 매핑 후 진행해보시기 바랍니다.



1-2. 유저(스키마) 권한 확인

유저에 권한이 충분하지 않다면 제대로 마이그레이션이 되지 않을 수 있습니다.

//

GRANT CONNECT, DBA, RESOURCE TO [유저명];

//

유저에 DBA 권한을 주고 테스트를 진행해보시기를 권장 드립니다.


추가적으로 유저에 권한이 충분하지 않다면 마이그레이션이 원활하게 진행되지 않을 수 있습니다.

//

GRANT CONNECT, DBA, RESOURCE TO [유저명];

//

유저에 DBA 권한을 주고 테스트를 진행해보시기를 권장 드립니다.







"소스"

    -------------------------------------------------------------------------------------

    DB User               Table-name                Tablespace-name

    -------------------------------------------------------------------------------------

    dbuser-1              dbuser-table1              tablespace-1

    dbuser-1              dbuser-table2              tablespace-2

    dbuser-1              dbuser-table3              tablespace-3

    dbuser-1              dbuser-table4              tablespace-4

    dbuser-1              dbuser-table5              tablespace-5

    dbuser-1              dbuser-table6              tablespace-6    





"대상"

    -------------------------------------------------------------------------------------

    DB User                     Table-name                Tablespace-name

    -------------------------------------------------------------------------------------

    mig-dbuser-1              dbuser-table1              tablespace-1   

    mig-dbuser-1              dbuser-table2              tablespace-2   

    mig-dbuser-1              dbuser-table3              tablespace-3  

    mig-dbuser-1              dbuser-table4              tablespace-4  

    mig-dbuser-1              dbuser-table5              tablespace-5   

    miog-dbuser-1              dbuser-table6             ablespace-6


상기의 구조대로 마이그레이션 진행 할 경우는 아래와 같습니다. 

2-1. 대상DB에서 AWS_TABLESPACE_1~6 생성


2-2. AWS_DBUSER_1 유저 생성


2-3. 테스트를 위해 AWS_DBUSER_1에 DBA권한 부여

*prd환경이라면 최소권한을 부여해야 합니다.


2-4. AWS콘솔에서 [대상 엔드포인트 - 엔드포인트 구성 - 사용자 이름]에 AWS_DBUSER_1 기입


2-5. [태스크 생성 - 테이블매핑] 에서 JSON편집기 이용 JSON 작성

*여러 테이블스페이스를 동시에 마이그레이션할 시, selection과 transformation이 한 쌍으로 연속되게 작성되어야 함.

예시 JSON에서는 AWS_TABLESPACE_1~3만 작성하였음.


{

  "rules": [

    {

      "rule-type": "selection",

      "rule-id": "368474243",

      "rule-name": "368474243",

      "object-locator": {

        "schema-name": "DBUSER_1",        // 소스DB 스키마

        "table-name": "DBUSER_TABLE1"        // 소스DB 테이블

      },

      "rule-action": "include"

    },

    {

      "rule-type": "transformation",

      "rule-id": "439011094",

      "rule-name": "439011094",

      "rule-action": "rename",

      "rule-target": "table-tablespace",        // 마법사에서는 선택할 수 없음. 오직 JSON편집기로만 마이그레이션 시 테이블스페이스명 변경 가능.

      "object-locator": {

        "schema-name": “DBUSER_1",        // 소스DB 스키마

        "table-name": "DBUSER_TABLE1",        // 소스DB 테이블

        "table-tablespace-name": TABLESPACE_1"        // 소스DB 테이블스페이스

      },

      "value": "MIG_TABLESPACE_1"        // 대상DB 테이블스페이스

    },

    {

      "rule-type": "selection",

      "rule-id": "368474245",

      "rule-name": "368474245",

      "object-locator": {

        "schema-name": "DBUSER_1",

        "table-name": "DBUSER_TABLE2"

      },

      "rule-action": "include"

    },

    {

      "rule-type": "transformation",

      "rule-id": "439011096",

      "rule-name": "439011096",

      "rule-action": "rename",

      "rule-target": "table-tablespace",

      "object-locator": {

        "schema-name": DBUSER_1",

        "table-name": "DBUSER_TABLE2",

        "table-tablespace-name": "ABLESPACE_2"

      },

      "value": "MIG_TABLESPACE_2"

    },

    {

      "rule-type": "selection",

      "rule-id": "368474244",

      "rule-name": "368474244",

      "object-locator": {

        "schema-name": "DBUSER_1",

        "table-name": "DBUSER_TABLE3"

      },

      "rule-action": "include"

    },

    {

      "rule-type": "transformation",

      "rule-id": "439011095",

      "rule-name": "439011095",

      "rule-action": "rename",

      "rule-target": "table-tablespace",

      "object-locator": {

        "schema-name": "DBUSER_1",

        "table-name": "DBUSER_TABLE3",

        "table-tablespace-name": "TABLESPACE_3"

      },

      "value": "TABLESPACE_3"

    }

  ]

}


위 JSON으로 태스크를 실행하면  아래 이미지와 같은 결과를 얻을 수 있습니다.