

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 指定 AWS Database Migration Service 任務的任務設定
<a name="CHAP_Tasks.CustomizingTasks.TaskSettings"></a>

每個任務都具備您可以根據資料庫遷移需求設定的設定。您可以在 JSON 檔案中建立這些設定，或使用一些設定，您可以使用 AWS DMS 主控台指定設定。如需取得如何使用任務組態檔案來進行任務設定的相關資訊，請參閱[任務設定範例](#CHAP_Tasks.CustomizingTasks.TaskSettings.Example)。

任務設定有數種主要類型，如下列所示。

**Topics**
+ [任務設定範例](#CHAP_Tasks.CustomizingTasks.TaskSettings.Example)
+ [目標中繼資料任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.TargetMetadata.md)
+ [完全載入任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.FullLoad.md)
+ [時間歷程任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.TimeTravel.md)
+ [記錄任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.Logging.md)
+ [控制資料表任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.ControlTable.md)
+ [串流緩衝區任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.StreamBuffer.md)
+ [變更處理調校設定](CHAP_Tasks.CustomizingTasks.TaskSettings.ChangeProcessingTuning.md)
+ [資料驗證任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.DataValidation.md)
+ [資料重新同步設定](CHAP_Tasks.CustomizingTasks.TaskSettings.DataResyncSettings.md)
+ [變更處理 DDL 處理的任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.DDLHandling.md)
+ [字元替換任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.CharacterSubstitution.md)
+ [前映像任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.BeforeImage.md)
+ [錯誤處理任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.ErrorHandling.md)
+ [儲存任務設定](CHAP_Tasks.CustomizingTasks.TaskSettings.Saving.md)


| 任務設定 | 相關文件 | 
| --- | --- | 
|  **建立任務評估報告** <br />您可以建立任務評估報告，顯示任何可能在遷移期間造成問題的未支援資料類型。您可以在執行任務之前在任務上執行此報告，來找出潛在問題。 | [啟用和使用任務的預遷移評估](CHAP_Tasks.AssessmentReport.md) | 
|  **建立任務** <br />您在建立任務時，可以指定來源、目標和複寫執行個體，以及任何遷移設定。 | [建立任務](CHAP_Tasks.Creating.md) | 
|  **建立進行中複寫任務** <br />您可以設定任務來在來源和目標間提供持續複寫。 | [使用 建立持續複寫的任務 AWS DMS](CHAP_Task.CDC.md) | 
|  **套用任務設定** <br />每個任務都具備您可以根據資料庫遷移需求設定的設定。您可以在 JSON 檔案中建立這些設定，或使用一些設定，您可以使用 AWS DMS 主控台指定設定。 | [指定 AWS Database Migration Service 任務的任務設定](#CHAP_Tasks.CustomizingTasks.TaskSettings) | 
|  **資料驗證** <br />使用資料驗證，將目標資料存放區上的資料與來源資料存放區中的資料 AWS DMS 進行比較。 | [AWS DMS 資料驗證](CHAP_Validating.md) | 
|  **修改任務** <br />在任務停止時，您便可以修改任務的設定。 | [修改任務](CHAP_Tasks.Modifying.md) | 
|  **在任務期間重新載入資料表** <br />若在任務期間發生錯誤，您便可以在任務期間重新載入資料表。 | [在任務期間重新載入資料表](CHAP_Tasks.ReloadTables.md) | 
|  **使用資料表映射** <br />資料表映射使用數種類型的規則來指定資料來源、來源結構描述、資料及任何應在任務期間進行的轉換任務設定。 | 選取規則[選取規則與動作](CHAP_Tasks.CustomizingTasks.TableMapping.SelectionTransformation.Selections.md)<br />轉換規則[轉換規則與動作](CHAP_Tasks.CustomizingTasks.TableMapping.SelectionTransformation.Transformations.md) | 
|  **套用篩選條件** <br />您可以使用來源篩選條件來限制從來源傳輸到目標的記錄數量和類型。例如，您可以指定只將位置是總部的員工移動到目標資料庫。您可以在資料的資料行上套用篩選條件。 | [使用來源篩選條件](CHAP_Tasks.CustomizingTasks.Filters.md) | 
| 監控任務您可以透過數種方法取得任務效能及任務所使用資料表的資訊。 | [監控 AWS DMS 任務](CHAP_Monitoring.md) | 
| 管理任務日誌您可以使用 AWS DMS API 或 檢視和刪除任務日誌 AWS CLI。 | [檢視和管理 DMS AWS 任務日誌](CHAP_Monitoring.md#CHAP_Monitoring.ManagingLogs) | 

## 任務設定範例
<a name="CHAP_Tasks.CustomizingTasks.TaskSettings.Example"></a>

您可以使用 AWS 管理主控台 或 AWS CLI 來建立複寫任務。如果您使用 AWS CLI，您可以透過建立 JSON 檔案來設定任務設定，然後將 JSON 檔案的檔案：// URI 指定為 [CreateReplicationTask](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationTask.html) 操作的 [ ReplicationTaskSettings](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationTask.html#DMS-CreateReplicationTask-request-ReplicationTaskSettings) 參數。

下列範例示範如何使用 AWS CLI 來呼叫 `CreateReplicationTask`操作：

```
aws dms create-replication-task \
--replication-task-identifier MyTask \
--source-endpoint-arn arn:aws:dms:us-west-2:123456789012:endpoint:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABC \
--target-endpoint-arn arn:aws:dms:us-west-2:123456789012:endpoint:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABC \
--replication-instance-arn arn:aws:dms:us-west-2:123456789012:rep:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABC \
--migration-type cdc \
--table-mappings file://tablemappings.json \
--replication-task-settings file://settings.json
```

上述範例使用名為 `tablemappings.json` 的資料表映射檔案。如需資料表映射範例，請參閱：[使用資料表映射指定任務設定](CHAP_Tasks.CustomizingTasks.TableMapping.md)。

任務設定 JSON 檔案看起來與以下內容相似。

```
{
  "TargetMetadata": {
    "TargetSchema": "",
    "SupportLobs": true,
    "FullLobMode": false,
    "LobChunkSize": 64,
    "LimitedSizeLobMode": true,
    "LobMaxSize": 32,
    "InlineLobMaxSize": 0,
    "LoadMaxFileSize": 0,
    "ParallelLoadThreads": 0,
    "ParallelLoadBufferSize":0,
    "ParallelLoadQueuesPerThread": 1,
    "ParallelApplyThreads": 0,
    "ParallelApplyBufferSize": 100,
    "ParallelApplyQueuesPerThread": 1,    
    "BatchApplyEnabled": false,
    "TaskRecoveryTableEnabled": false
  },
  "FullLoadSettings": {
    "TargetTablePrepMode": "DO_NOTHING",
    "CreatePkAfterFullLoad": false,
    "StopTaskCachedChangesApplied": false,
    "StopTaskCachedChangesNotApplied": false,
    "MaxFullLoadSubTasks": 8,
    "TransactionConsistencyTimeout": 600,
    "CommitRate": 10000
  },
    "TTSettings" : {
    "EnableTT" : true,
    "TTS3Settings": {
        "EncryptionMode": "SSE_KMS",
        "ServerSideEncryptionKmsKeyId": "arn:aws:kms:us-west-2:112233445566:key/myKMSKey",
        "ServiceAccessRoleArn": "arn:aws:iam::112233445566:role/dms-tt-s3-access-role",
        "BucketName": "myttbucket",
        "BucketFolder": "myttfolder",
        "EnableDeletingFromS3OnTaskDelete": false
      },
    "TTRecordSettings": {
        "EnableRawData" : true,
        "OperationsToLog": "DELETE,UPDATE",
        "MaxRecordSize": 64
      }
  },
  "Logging": {
    "EnableLogging": false
  },
  "ControlTablesSettings": {
    "ControlSchema":"",
    "HistoryTimeslotInMinutes":5,
    "HistoryTableEnabled": false,
    "SuspendedTablesTableEnabled": false,
    "StatusTableEnabled": false
  },
  "StreamBufferSettings": {
    "StreamBufferCount": 3,
    "StreamBufferSizeInMB": 8
  },
  "ChangeProcessingTuning": { 
    "BatchApplyPreserveTransaction": true, 
    "BatchApplyTimeoutMin": 1, 
    "BatchApplyTimeoutMax": 30, 
    "BatchApplyMemoryLimit": 500, 
    "BatchSplitSize": 0, 
    "MinTransactionSize": 1000, 
    "CommitTimeout": 1, 
    "MemoryLimitTotal": 1024, 
    "MemoryKeepTime": 60, 
    "StatementCacheSize": 50 
  },
  "ChangeProcessingDdlHandlingPolicy": {
    "HandleSourceTableDropped": true,
    "HandleSourceTableTruncated": true,
    "HandleSourceTableAltered": true
  },
  "LoopbackPreventionSettings": {
    "EnableLoopbackPrevention": true,
    "SourceSchema": "LOOP-DATA",
    "TargetSchema": "loop-data"
  },

  "CharacterSetSettings": {
    "CharacterReplacements": [ {
        "SourceCharacterCodePoint": 35,
        "TargetCharacterCodePoint": 52
      }, {
        "SourceCharacterCodePoint": 37,
        "TargetCharacterCodePoint": 103
      }
    ],
    "CharacterSetSupport": {
      "CharacterSet": "UTF16_PlatformEndian",
      "ReplaceWithCharacterCodePoint": 0
    }
  },
  "BeforeImageSettings": {
    "EnableBeforeImage": false,
    "FieldName": "",  
    "ColumnFilter": "pk-only"
  },
  "ErrorBehavior": {
    "DataErrorPolicy": "LOG_ERROR",
    "DataTruncationErrorPolicy":"LOG_ERROR",
    "DataMaskingErrorPolicy": "STOP_TASK",
    "DataErrorEscalationPolicy":"SUSPEND_TABLE",
    "DataErrorEscalationCount": 50,
    "TableErrorPolicy":"SUSPEND_TABLE",
    "TableErrorEscalationPolicy":"STOP_TASK",
    "TableErrorEscalationCount": 50,
    "RecoverableErrorCount": 0,
    "RecoverableErrorInterval": 5,
    "RecoverableErrorThrottling": true,
    "RecoverableErrorThrottlingMax": 1800,
    "ApplyErrorDeletePolicy":"IGNORE_RECORD",
    "ApplyErrorInsertPolicy":"LOG_ERROR",
    "ApplyErrorUpdatePolicy":"LOG_ERROR",
    "ApplyErrorEscalationPolicy":"LOG_ERROR",
    "ApplyErrorEscalationCount": 0,
    "FullLoadIgnoreConflicts": true
  },
  "ValidationSettings": {
    "EnableValidation": false,
    "ValidationMode": "ROW_LEVEL",
    "ThreadCount": 5,
    "PartitionSize": 10000,
    "FailureMaxCount": 1000,
    "RecordFailureDelayInMinutes": 5,
    "RecordSuspendDelayInMinutes": 30,
    "MaxKeyColumnSize": 8096,
    "TableFailureMaxCount": 10000,
    "ValidationOnly": false,
    "HandleCollationDiff": false,
    "RecordFailureDelayLimitInMinutes": 1,
    "SkipLobColumns": false,
    "ValidationPartialLobSize": 0,
    "ValidationQueryCdcDelaySeconds": 0
  }
}
```