// 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.OciCliDumpTransferDetails
{
OciHome = "EXAMPLE-ociHome-Value",
WalletLocation = "EXAMPLE-walletLocation-Value"
},
Target = new Oci.DatabasemigrationService.Models.OciCliDumpTransferDetails
{
OciHome = "EXAMPLE-ociHome-Value",
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.Statistics,
TableExistsAction = Oci.DatabasemigrationService.Models.DataPumpTableExistsAction.Skip,
ExcludeParameters = new List<Oci.DatabasemigrationService.Models.DataPumpExcludeParameters>
{
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.Index,
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedView,
Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedViewLog
},
ImportParallelismDegree = 93,
ExportParallelismDegree = 33
},
TablespaceDetails = new Oci.DatabasemigrationService.Models.CreateADBServerlesTablespaceDetails
{
},
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.Full,
MetadataRemaps = new List<Oci.DatabasemigrationService.Models.MetadataRemap>
{
new Oci.DatabasemigrationService.Models.MetadataRemap
{
Type = Oci.DatabasemigrationService.Models.MetadataRemap.TypeEnum.Datafile,
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.High,
LongTransDuration = 390
},
Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
},
AcceptableLag = 24
},
GgsDetails = new Oci.DatabasemigrationService.Models.CreateOracleGgsDeploymentDetails
{
Extract = new Oci.DatabasemigrationService.Models.CreateExtract
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.High,
LongTransDuration = 753
},
Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
},
AcceptableLag = 10
},
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.Integer
}
},
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 = false
}
},
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.Offline,
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_WBcRd",
"EXAMPLE_VALUE_CzVW2TreHjxLxdc4DygX"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_foCbf",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_3KGUR",
"EXAMPLE--Value"
}
}
}
}
};
var createMigrationRequest = new Oci.DatabasemigrationService.Requests.CreateMigrationRequest
{
CreateMigrationDetails = createMigrationDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "FX5FMCPB7PODHEADCUTJ<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;
}
}
}
}