// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DatabasemigrationService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Databasemigration
{
public class CreateMigrationExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createMigrationDetails = new Oci.DatabasemigrationService.Models.CreateOracleMigrationDetails
{
DataTransferMediumDetails = new Oci.DatabasemigrationService.Models.CreateOracleNfsDataTransferMediumDetails
{
ObjectStorageBucket = new Oci.DatabasemigrationService.Models.CreateObjectStoreBucket
{
NamespaceName = "EXAMPLE-namespaceName-Value",
BucketName = "EXAMPLE-bucketName-Value"
},
Source = new Oci.DatabasemigrationService.Models.CurlTransferDetails
{
WalletLocation = "EXAMPLE-walletLocation-Value"
},
Target = new Oci.DatabasemigrationService.Models.CurlTransferDetails
{
WalletLocation = "EXAMPLE-walletLocation-Value"
},
SharedStorageMountTargetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sharedStorageMountTargetId-Value"
},
InitialLoadSettings = new Oci.DatabasemigrationService.Models.CreateOracleInitialLoadSettings
{
DataPumpParameters = new Oci.DatabasemigrationService.Models.CreateDataPumpParameters
{
IsCluster = false,
Estimate = Oci.DatabasemigrationService.Models.DataPumpEstimate.Blocks,
TableExistsAction = Oci.DatabasemigrationService.Models.DataPumpTableExistsAction.Truncate,
ExcludeParameters = new List<Oci.DatabasemigrationService.Models.DataPumpExcludeParameters>
{
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.Index,
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedView,
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedViewLog
},
ImportParallelismDegree = 37,
ExportParallelismDegree = 121
},
TablespaceDetails = new Oci.DatabasemigrationService.Models.CreateNonADBRemapTablespaceDetails
{
RemapTarget = "EXAMPLE-remapTarget-Value"
},
ExportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
{
Name = "EXAMPLE-name-Value",
Path = "EXAMPLE-path-Value"
},
ImportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
{
Name = "EXAMPLE-name-Value",
Path = "EXAMPLE-path-Value"
},
JobMode = Oci.DatabasemigrationService.Models.JobModeOracle.Schema,
MetadataRemaps = new List<Oci.DatabasemigrationService.Models.MetadataRemap>
{
new Oci.DatabasemigrationService.Models.MetadataRemap
{
Type = Oci.DatabasemigrationService.Models.MetadataRemap.TypeEnum.Tablespace,
OldValue = "EXAMPLE-oldValue-Value",
NewValue = "EXAMPLE-newValue-Value"
}
}
},
AdvisorSettings = new Oci.DatabasemigrationService.Models.CreateOracleAdvisorSettings
{
IsSkipAdvisor = true,
IsIgnoreErrors = false
},
HubDetails = new Oci.DatabasemigrationService.Models.CreateGoldenGateHubDetails
{
RestAdminCredentials = new Oci.DatabasemigrationService.Models.CreateAdminCredentials
{
Username = "EXAMPLE-username-Value",
Password = "EXAMPLE-password-Value"
},
Url = "EXAMPLE-url-Value",
ComputeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-computeId-Value",
VaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
KeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
Extract = new Oci.DatabasemigrationService.Models.CreateExtract
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Low,
LongTransDuration = 582
},
Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.High
},
AcceptableLag = 4
},
GgsDetails = new Oci.DatabasemigrationService.Models.CreateOracleGgsDeploymentDetails
{
Extract = new Oci.DatabasemigrationService.Models.CreateExtract
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.High,
LongTransDuration = 412
},
Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
},
AcceptableLag = 16
},
AdvancedParameters = new List<Oci.DatabasemigrationService.Models.MigrationParameterDetails>
{
new Oci.DatabasemigrationService.Models.MigrationParameterDetails
{
Value = "EXAMPLE-value-Value",
Name = "EXAMPLE-name-Value",
DataType = Oci.DatabasemigrationService.Models.AdvancedParameterDataTypes.Boolean
}
},
SourceContainerDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceContainerDatabaseConnectionId-Value",
SourceStandbyDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceStandbyDatabaseConnectionId-Value",
ExcludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
{
new Oci.DatabasemigrationService.Models.OracleDatabaseObject
{
Owner = "EXAMPLE-owner-Value",
ObjectName = "EXAMPLE-objectName-Value",
Type = "EXAMPLE-type-Value",
IsOmitExcludedTableFromReplication = true
}
},
IncludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
{
new Oci.DatabasemigrationService.Models.OracleDatabaseObject
{
Owner = "EXAMPLE-owner-Value",
ObjectName = "EXAMPLE-objectName-Value",
Type = "EXAMPLE-type-Value",
IsOmitExcludedTableFromReplication = false
}
},
BulkIncludeExcludeData = "EXAMPLE-bulkIncludeExcludeData-Value",
Description = "EXAMPLE-description-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
Type = Oci.DatabasemigrationService.Models.MigrationTypes.Online,
DisplayName = "EXAMPLE-displayName-Value",
SourceDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDatabaseConnectionId-Value",
TargetDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-targetDatabaseConnectionId-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_n0wfc",
"EXAMPLE_VALUE_ahHpbXkFfvXSgtC3u2rT"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_7CN0w",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_LN18h",
"EXAMPLE--Value"
}
}
}
},
AssessmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-assessmentId-Value"
};
var createMigrationRequest = new Oci.DatabasemigrationService.Requests.CreateMigrationRequest
{
CreateMigrationDetails = createMigrationDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "X6DQJCYAMETT6CUILZLI<unique_ID>"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new DatabaseMigrationClient(provider, new ClientConfiguration()))
{
var response = await client.CreateMigration(createMigrationRequest);
// Retrieve value from the response.
var id = response.Migration.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateMigration Failed with {e.Message}");
throw e;
}
}
}
}