產生來源與目標資料庫之間的類型對應

必須要有類型對應,才能瞭解不同來源和目標資料庫之間進行複寫時的資料行為。Oracle GoldenGate 支援許多來源和目標資料庫複製組合。您可以使用 MappingGenerator.py 指令碼來決定這些組合的類型對應。

MappingGenerator.py 是 Python 命令檔,可根據可用的 JSON 組態檔產生來源與目標資料庫之間的類型對應。

先決條件

MappingGenerator.py 程序檔的使用先決條件如下:

執行 MappingGenerator.py 指令碼

若要執行 MappingGenerator.py 指令碼,請使用下列指令:


python MappingGenerator.py source_json_file target_json_file output_txt_file>

在此命令中:

附註:請確定輸出路徑與包含 MappingGenerator.py 及任何輸入 JSON 檔案的路徑不同。{. :infoboxnote}

您可以使用 MappingJSON 目錄下的 source_json_file 和 target_json_file。source_json_file 檔案名稱看起來類似於 AutoSchemadatabase_nameSourceMappings.json,而 target_json_file 檔案名稱看起來類似於 AutoSchemadatabase_nameTargetMappings.json。

您可以選擇 Oracle GoldenGate Autoschema 對應所支援之任何資料庫的 source_json_file 和 target_json_file。

範例

下列範例示範將 MySQL 產生至 Oracle 自動綱要類型對應:


python MappingGenerator.py ./MappingJSON/AutoSchemaMySQLSourceMappings.json ./MappingJSON/AutoSchemaOracleTargetMappings.json /tmp/MySQL_to_Oracle_autoschema_mappings.txt

此命令檔會產生第三個引數中指定之名稱的文字檔。此檔案包含以人為可讀格式產生的類型對應。如需對映類型的範例,請參閱資料類型對映

使用 MappingGenerator.py 的準則

使用 MappingGenerator.py 程序檔時,下列考量十分重要: