Deploy the Cloud Topology

When deploying the cloud topology for this method of database migration, the database version must be the same as the source database and the patch version should be the same (or higher) than the source database.

Gather the Information Needed to Provision the Topology

Before configuring the Terraform modules, it's a good idea to gather the information that you'll need to provision the standby database.

The following information is needed to input in the terraform.tfvars file to create the bastion database architecture:
  • CIDR block of the Primary VCN
  • DNS label of the VCN
  • Compute shape for the bastion server
  • Database System display name
  • Database name
  • Compute shape for the database server
  • DB admin password for the database
  • Path to the public SSH key to set as the authorized key on the bastion host
  • Path to private SSH key to access the bastion host
  1. Determine the size and CIDR block of the virtual cloud network (VCN) that you want to create, and the DNS label of the VCN.
  2. Determine the compute shapes to be used for the bastion host and the VM DB system.
  3. Verify that the service limits of your tenancy can accommodate all the resources that you want to create.
  4. Determine the database system display name. For example, ActiveDBSystem.
  5. Determine the name of the on-premises database.
    The name of the standby database in OCI must be the same as the name of the primary on-premises database.
  6. Obtain the DB admin password for your database.
  7. Save the path to the public SSH key.
  8. Sate the path to the private SSH key.

Deploy the VM Database and Bastion Topology

The Terraform code to deploy the target cloud topology is available on GitHub. You can use the code to provision the required networking resources, a compute instance for the bastion server, and a virtual machine database system.

  1. Go to GitHub.
  2. Download the code to your local computer.
  3. Complete the prerequisite steps in the README.
  4. Apply the configuration using the Terraform CLI.

Create the Resources

After you set the variables in terraform.tfvars file, use the Terraform CLI to deploy the resources defined in the Terraform configuration.

Terraform stores state information to track your managed infrastructure resources, map the deployed resources to your configuration, track metadata, and improve performance for large infrastructure deployments.

By default, the terraform.tfstate file is stored on the local host. This default behavior is not optimal in IT environments where multiple users need to create and destroy the resources that are defined in a given configuration. To control deploying and managing resources in a multi-user environment, store the Terraform state files in Oracle Cloud Infrastructure Object Storage, and share the state files and lock files between all the users.

Before you begin, ensure that your local machine has internet access. If your local machine is behind a firewall, use an appropriate proxy to allow Terraform to reach the internet.
  1. On the computer where you installed Terraform, go to the directory that contains the terraform.tfvars file.
  2. Set the environment variables by running the following command:
    source ./env-vars
  3. Initialize Terraform, by running the following command:
    terraform init
    The command downloads the oci provider plugin and sets up the directory for use by Terraform.
  4. Verify that the syntax of the configuration has no errors:
    terraform validate
  5. If a syntax error exists, then fix the error, and repeat the previous step.
    To debug problems, you can configure logging:
    • Set the log level by using the TF_LOG environment variable. The supported log levels are TRACE, DEBUG, INFO, WARN, or ERROR. The TRACE level is the most verbose.
    • Set the log file path by using the TF_LOG_PATH environment variable.
  6. Review the resources defined in the configuration.
    terraform plan
    The output shows the details of all the actions that are performed when you apply this configuration, and a summary as shown in the following example.
    Plan: 14 to add, 0 to change, 0 to destroy.

    Note:

    The number 14 in the message is an example. The actual number depends on the settings that you defined in your Terraform configuration.
  7. If you want to make any changes, edit the configuration, validate it, and review the revised plan.
  8. Create the resources:
    terraform apply
  9. At the prompt Do you want to perform these actions?, enter yes.
    As Terraform creates each resource, it displays the status of the operation.

    When all the resources are created, the message Apply complete is displayed, along with the number of resources added, changed, and destroyed.