Clone a JRF or non-JRF Instance using a Script

Learn how to clone an instance by using the clone script.

Note:

This cloning procedure is not recommended for upgrading WLS versions.
In this procedure,
  • Original instance, is the WebLogic Server instance you want to clone.
  • Cloning instance, is the WebLogic Server instance you will create to clone the Original instance.
Methods: There are two methods to clone an instance.
  • Method 1: Do not destroy the stack and run the script to create the required cloned volumes.
  • Method 2: Manually create cloned volumes and destroy the source stack.
Method 1: Do not destroy the stack and run the script to create the required cloned volumes.
  1. Create a domain. This is the Cloning instance. See Create a Stack.

    Note:

    • You must create the Cloning instance using the same configuration as the Original instance, in the same compartment and region.
    • It is recommended to stop the source instance servers before running the cloning script. This is specifically recommended for JRF instances, as having 2 WebLogic domains using the same infrastructure schemas is not supported by Oracle WebLogic Server.
    • If your instance uses an existing VCN with a new subnet, then the CIDR range for the subnet created in the Cloning instance differs from the CIDR range of the subnet in the Original instance.
  2. In the Original instance, delete any load balancer using a reserved IP. See Remove the Load Balancer.
  3. In the Original instance, if you have assigned an SSL certificate to the source load balancer, then set up SSL certificates on the load balancer in Cloning instance. See Add a Certificate to the Load Balancer.
  4. Stop all the servers in the Original instance. See Start and Stop a Domain.
  5. Log in to each node of the Cloning instance as an opc user.
  6. Run the create_clone.py script on each of the nodes. The create_clone.py script is located at /opt/scripts/cloning:
    • If you want to clone only the data block volumes:
      python3 create_clone.py -s <Cloning_instance_stack_OCID>
    • If you want to clone both the data block and Middleware volumes:
      python3 create_clone.py -s <Cloning_instance_stack_OCID> -m true

    Note:

    Do not run the script on Cloning instance nodes that correspond to nodes added on the Original instance with the Do Not Update Domain Configuration for Scale Out selected. The metadata for these nodes will be missing, resulting in failures at various steps in the script. On such nodes you must extend the domain in the same manner as you did on the Original instance.

    If the clone script fails at a particular stage, complete the steps in Clone Script Failed, and then return to this procedure to continue with the next step.

  7. Access the WebLogic console of the Cloning instance to verify the updates you performed to the instance. See Access the WebLogic Console.
  8. Destroy and Delete the Original instance. See Delete a Stack.

Method 2: Manually create cloned volumes and destroy the source stack.

Note:

This method is recommended when you are using VCN peering or running low on limits, such as, compute or load balancer.
  1. Clone the data block volumes of the Original instance. See Cloning a Volume.

    As required, you can also clone the Middleware volumes.

  2. Destroy and then delete the stack in Original instance. See Destroy Stack Resources and Delete the Stack.
  3. Create a domain. This is the Cloning instance. See Create a Stack.

    Note:

    You must create the Cloning instance using the same configuration as the Original instance, in the same compartment and region.
  4. Log in to each node of the Cloning instance as an opc user.
  5. Run the create_clone.py script on each of the nodes. The create_clone.py script is located at /opt/scripts/cloning:
    • If you have cloned only the data block volumes:
      python3 create_clone.py -d <Cloning_instance_data_volume_OCID>
    • If you have cloned both the data block and Middleware volumes:
      python3 create_clone.py -d <Cloning_instance_data_volume_OCID> -m <Cloning_instance_Middleware_volume_OCID>'

    Note:

    Do not run the script on Cloning instance nodes that correspond to nodes added on the Original instance with the Do Not Update Domain Configuration for Scale Out selected. The metadata for these nodes will be missing, resulting in failures at various steps in the script. On such nodes you must extend the domain in the same manner as you did on the Original instance.

    If the clone script fails at a particular stage, complete the steps in Clone Script Failed, and then return to this procedure to continue with the next step.

  6. Access the WebLogic console of the Cloning instance to verify the updates you performed to the instance. See Access the WebLogic Console.

You have successfully cloned the instance.

If you run terraform apply after cloning, complete the following steps:
  1. If you add nodes, it restores any volumes that was previously destroyed by the cloning script.
    The restored volumes can be identified if they have the following name formata:
    • <clone_prefix>-data-block-<number>
    • <clone_prefix>-mw-block-<number>

    Detach and delete the restored volumes. See Deleting a Volume.

  2. If OCI logging is added then OCI logging has to be run independently on the compute instance running the administration server.
    Run the following commands on the administration server:
    python3 update_metadata.py -k use_oci_logging -v true
    python3 update_logging.py