# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

import oci

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
database_migration_client = oci.database_migration.DatabaseMigrationClient(
    config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_migration_response = database_migration_client.create_migration(
    create_migration_details=oci.database_migration.models.CreateMySqlMigrationDetails(
        database_combination="MYSQL",
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        type="OFFLINE",
        source_database_connection_id="ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDatabaseConnectionId-Value",
        target_database_connection_id="ocid1.test.oc1..<unique_ID>EXAMPLE-targetDatabaseConnectionId-Value",
        description="EXAMPLE-description-Value",
        display_name="EXAMPLE-displayName-Value",
        freeform_tags={
            'EXAMPLE_KEY_AtDBd': 'EXAMPLE_VALUE_8Ne03ecVFvxCNDpXlGuk'},
        defined_tags={
            'EXAMPLE_KEY_e3EaQ': {
                'EXAMPLE_KEY_DeuEx': 'EXAMPLE--Value'}},
        data_transfer_medium_details=oci.database_migration.models.CreateMySqlObjectStorageDataTransferMediumDetails(
            type="OBJECT_STORAGE",
            object_storage_bucket=oci.database_migration.models.CreateObjectStoreBucket(
                namespace_name="EXAMPLE-namespaceName-Value",
                bucket_name="EXAMPLE-bucketName-Value")),
        initial_load_settings=oci.database_migration.models.CreateMySqlInitialLoadSettings(
            job_mode="SCHEMA",
            is_consistent=True,
            is_tz_utc=False,
            compatibility=[
                "FORCE_INNODB",
                "SKIP_INVALID_ACCOUNTS",
                "STRIP_DEFINERS",
                "STRIP_RESTRICTED_GRANTS",
                "STRIP_TABLESPACES",
                "IGNORE_WILDCARD_GRANTS",
                "STRIP_INVALID_GRANTS"],
            primary_key_compatibility="CREATE_INVISIBLE_PKS",
            is_ignore_existing_objects=True,
            handle_grant_errors="DROP_ACCOUNT"),
        advisor_settings=oci.database_migration.models.CreateMySqlAdvisorSettings(
            is_skip_advisor=False,
            is_ignore_errors=False),
        exclude_objects=[
            oci.database_migration.models.MySqlDatabaseObject(
                schema="EXAMPLE-schema-Value",
                object_name="EXAMPLE-objectName-Value",
                type="EXAMPLE-type-Value")],
        include_objects=[
            oci.database_migration.models.MySqlDatabaseObject(
                schema="EXAMPLE-schema-Value",
                object_name="EXAMPLE-objectName-Value",
                type="EXAMPLE-type-Value")],
        bulk_include_exclude_data="EXAMPLE-bulkIncludeExcludeData-Value",
        hub_details=oci.database_migration.models.CreateGoldenGateHubDetails(
            rest_admin_credentials=oci.database_migration.models.CreateAdminCredentials(
                username="EXAMPLE-username-Value",
                password="EXAMPLE-password-Value"),
            url="EXAMPLE-url-Value",
            vault_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
            key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
            compute_id="ocid1.test.oc1..<unique_ID>EXAMPLE-computeId-Value",
            extract=oci.database_migration.models.CreateExtract(
                performance_profile="LOW",
                long_trans_duration=891),
            replicat=oci.database_migration.models.CreateReplicat(
                performance_profile="HIGH"),
            acceptable_lag=20),
        ggs_details=oci.database_migration.models.CreateMySqlGgsDeploymentDetails(
            replicat=oci.database_migration.models.CreateReplicat(
                performance_profile="HIGH"),
            acceptable_lag=24)),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="EYZWMXN7HDJL6REOERYJ<unique_ID>")

# Get the data from response
print(create_migration_response.data)

Was this article helpful?