Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Automate Full Stack Disaster Recovery with OCI CLI for a Cold Standby Topology
Introduction
Oracle Cloud Infrastructure Full Stack Disaster Recovery (Full Stack DR) provides a fully automated and comprehensive disaster recovery orchestration solution for all the layers of a full-stack cloud application, including infrastructure, database, and application. Using Full Stack DR, you can recover your full stack applications across OCI regions, or across availability domains within the same region.
Oracle Cloud Infrastructure Command Line Interface (OCI CLI) is a small-footprint tool that you can use on its own or with the Oracle Cloud Console to complete Oracle Cloud Infrastructure (OCI) tasks. The Command Line Interface (CLI) provides the same core functionality as the Oracle Cloud Console, plus additional commands. Some of these, such as the ability to run scripts, extend Console functionality.
The CLI is built on the OCI SDK for Python and runs on Mac, Windows, or Linux. The Python code makes calls to Oracle Cloud Infrastructure APIs to provide the functionality implemented for the various services. These are REST APIs that use HTTPS requests and responses.
Objectives
Automate the Full Stack Disaster Recovery steps using OCI Command Line Interface (CLI) for a Cold Standby Disaster Recovery topology.
-
Create Disaster Recovery (DR) Protection Groups in Primary and Standby region.
-
Associate DR Protection Groups.
-
Add members to the Primary DR protection group.
-
Create Switchover Plan in the Standby region.
-
Customize the Switchover Plan with a user defined plan group.
-
Execute prechecks for the Switchover Plan in the Standby region.
-
Execute the Switchover Plan in the Standby region.
Note: In this example,we will use FRANKFURT as Primary region and LONDON as Standby region.
Deployment Architecture
Prerequisites
-
Install OCI CLI.
-
Administrator privileges or configure the required OCI Identity and Access Management policies for Full Stack Disaster Recovery. For more information, see Configuring OCI IAM policies to use Full Stack Disaster Recovery and Policies for Full Stack Disaster Recovery.
-
Create Oracle Object Storage bucket in the Primary region and Standby region to store Disaster Recovery operation logs, see Object Storage.
-
Create OCI Compute VM in Primary region (Frankfurt). For more information, see Create OCI Compute.
-
Running Commands on OCI Compute Instance. For more information, see Running Commands on OCI Compute instance.
-
Invoke custom scripts using the run command with Oracle Cloud Infrastructure Full Stack Disaster Recovery. For more information, see OCI run command with Full Stack DR.
Implementation
For this tutorial, we have already created the following resources.
Resources | Primary Region - Frankfurt |
---|---|
Object Storage Bucket | FSDR_storage_primary_test |
Compartment | sathish.mahadev |
Namespace | frrudica1wgd |
Instance memberId | ocid1.instance………………….. |
sourceVnicId | ocid1.vnic.oc1…………………… |
Resources | Standy Region - London |
---|---|
Object Storage Bucket | FSDR_storage_secondary_test |
Compartment | sathish.mahadev |
Namespace | frrudica1wgd |
Task 1: Create DR Protection Groups in Primary and Standby Region
-
It is assumed, you have installed OCI CLI based on your preferred platform. We have installed OCI CLI on a OCI Linux VM. Set the OCI credentials and profile to connect to Frankfurt region.
-
Below is the syntax for creating DR protection group.
Usage:
oci disaster-recovery dr-protection-group create [OPTIONS]
Required Parameters:
--compartment-id, -c [text] --display-name [text] --log-location [complex type]
This is a complex type whose value must be valid JSON.
-
Create JSON file with the following content and name it as
log-location.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.{ "bucket": "FSDR_storage_primary_test", "namespace": "frrudica1wgd" }
-
Use the following command to create DR protection group in the Frankfurt region.
oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Primary_test --log-location file://log-location.json
-
You can verify the DR protection group details in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery, and Disaster Recovery Protection group. Status of the DR protection group should be Active.
-
Set the OCI credentials and profile to connect to London region. Create JSON file with the following content and name it as
log-sec-location.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.{ "bucket": "FSDR_storage_secondary_test", "namespace": "frrudica1wgd" }
-
Use the following command to create DR protection group in the London region.
oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Secondry_test --log-location file://log-sec-location.json
-
You can verify the DR protection group details in the Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.
Task 2: Associate DR Protection Groups
-
Below is the syntax to associate the DR protection groups.
Usage:
oci disaster-recovery dr-protection-group associate [OPTIONS]
Required Parameters:
--dr-protection-group-id [text] --role [text] --peer-id [text] --peer-region [text]
-
Create JSON file with the following content and name it as
AssociateDrProtection.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.{ "peerRegion": "uk-london-1", "peerId": "ocid1.drprotectiongroup.oc1.uk................................", "role": "PRIMARY" }
-
Use the following command to create an association between two regions.
oci disaster-recovery dr-protection-group associate --dr-protection-group-id ocid1.drprotectiongroup.oc1............ --from-json file://AssociateDrProtection.json
-
Primary Region:
You can verify the association between two regions in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.
-
Standby Region:
You can verify the association between two regions in the Standby region (Frankfurt) click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.
-
Task 3: Add members to the DR Protection Groups
Prerequisites
-
Create a New Volume group
fsdr_volume_group_test
. You need to create the new volume group details in the Primary region (Frankfurt), click the Hamburger menu, go to Storage, Volume Groups & Create Volume group. -
Select boot and block volume of the compute instance. In our case we have only the boot volume of the compute instance.
-
Enable Cross region replication and target region.
Required details for moving resources from one region to another region Instance OCID ocid1.instance…………. source Vnic Id ocid1.vnic.oc1…………. destination Compartment Id ocid1.compartment.oc1………….. volume group OCID ocid1.volumegroup.oc1………….
-
Below is the syntax to add members to the DR protection group.
Usage:
oci disaster-recovery dr-protection-group update [OPTIONS]
Required Parameters:
--dr-protection-group-id [text] --members
-
Create JSON file with the following content and name it as
instance_members.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.If you have any advanced options in moving instance add the necessary properties.JSON file to add the members (compute and volume group) to the DR protection group.
{ "displayName": "CLI_FSDR_Primary", "members": [ { "memberId": "ocid1.instance.oc1....................................", "memberType": "COMPUTE_INSTANCE", "isMovable": true, "vnicMapping": [ { "sourceVnicId": "ocid1.vnic.oc1................................", "destinationSubnetId": "ocid1.subnet.oc1........................" } ], "destinationCompartmentId": "ocid1.compartment.oc1...................." }, { "memberId": "ocid1.volumegroup.oc1...................................", "memberType": "VOLUME_GROUP" }], "logLocation": { "bucket": "FSDR_storage_primary", "namespace": "frrudixxxxx" } }
-
Use the following command to add members to the DRPG.
oci disaster-recovery dr-protection-group update --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://instance_members.json --force --debug
-
You can verify the updating DRPG work request status in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Select CLI_FSDR_Primary_test and click Work requests.
-
You can verify Compute and Volume group resources are added successfully in the Primary region (Frankfurt) DRPG, click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, select CLI_FSDR_Primary_test and click Members.
Task 4: Create Switchover Plan in the Standby region
-
Below is the syntax for creating Switchover Plan.
Usage:
oci disaster-recovery dr-plan create [OPTIONS]
Required Parameters:
--dr-protection-group-id [text] --display-name [text] --type [text]
-
Create JSON file with the following content and name it as
CreateDrPlan.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.{ "drProtectionGroupId": "ocid1.drprotectiongroup...........................", "displayName": "My_OCI_DR_Plan", "type": "SWITCHOVER" }
-
Use the following command to create the switchover plan.
oci disaster-recovery dr-plan create --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://CreateDrPlan.json
-
You can verify the DR Plan in the Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, CLI_storage_secondary_test, and Plans.
Task 5: Customize the Switchover Plan with user defined plan groups
-
Full Stack DR allows to create user defined plan groups to customize the DR plans.Get details for the DR plan identified by
drPlanId
which we have created in Task 4.oci disaster-recovery dr-plan get --dr-plan-id ocid1.drplan.oc1......... > dr-plan-get.json
This will create a JSON file called
dr-plan-get.json
with the following content in the current working directory in the OCI Linux VM.{ "data": { "compartment-id": "ocid1.compartment.oc1................................", "defined-tags": { "Oracle-Tags": { "CreatedBy": "oracleidentitycloudservice/sathish.mahadev@oracle.com", "CreatedOn": "2023-11-23T09:22:09.222Z" } }, "display-name": "My OCI DR Plan", "dr-protection-group-id": "ocid1.drprotectiongroup.oc1.................", "freeform-tags": {}, "id": "ocid1.drplan.oc1.eu-frankfurt-1.aaaaaaaacmfg3v..................", "life-cycle-details": null, "lifecycle-state": "ACTIVE", "peer-dr-protection-group-id": "ocid1.drprotectiongroup.oc1............", "peer-region": "uk-london-1", "plan-groups": [ { "display-name": "Built-In Prechecks", "id": "sgid1.group..AwplAFAmPMSjruIpY8m2cw4v.......................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMvn4IpY8m...................", "id": "sgid1.step..PO9O2GisLb05WkUKebi4Hofc0...................", "is-enabled": true, "member-id": "ocid1.instance.oc1.uk-london-1...................", "timeout": 3600, "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK", "user-defined-step": null }, { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMSjrPIH1zlApY...............", "id": "sgid1.step..IwKsQfyM6w78JcvklS2JulU2GdH6l...............", "is-enabled": true, "member-id": "ocid1.instance.oc1.uk-london-1.anw...............", "timeout": 3600, "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK", "user-defined-step": null }, { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMm2cw4v.....................", "id": "sgid1.step..XASO1rLLQkrsOUPN............................", "is-enabled": true, "member-id": "ocid1.instance.oc1...............................", "timeout": 3600, "type": "COMPUTE_INSTANCE_STOP_PRECHECK", "user-defined-step": null }, { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmpY8m2cw4v....................", "id": "sgid1.step..VcHYP3vKNNTrg0gMYuw.........................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "UNKNOWN_ENUM_VALUE", "user-defined-step": null }, { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPY8m2cw4v....................", "id": "sgid1.step..wRdVq2t2d9It8P5TT2CvpMN7sy496o..............", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK", "user-defined-step": null } ], "type": "BUILT_IN_PRECHECK" }, { "display-name": "Stop Compute Instances", "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9.....................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..XEqWbSZn72MsIKfP.....................", "id": "sgid1.step..GhvhuUwDXmyqaJe15ZrFc7......................", "is-enabled": true, "member-id": "ocid1.instance.oc1...............................", "timeout": 3600, "type": "COMPUTE_INSTANCE_STOP", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Switchover Volume Groups", "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM1j........................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..32adaPzUEQ7aH........................", "id": "sgid1.step..ef9UNZtJ1rZIbAmW7aZK........................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "VOLUME_GROUP_RESTORE_SWITCHOVER", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Launch Compute Instances", "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt............................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..5hcYKKlYT............................", "id": "sgid1.step..woJnsXF5wTpY3uf6M...........................", "is-enabled": true, "member-id": "ocid1.instance.oc1...............................", "timeout": 3600, "type": "COMPUTE_INSTANCE_LAUNCH", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Reverse Volume Groups' Replication", "id": "sgid1.group..zPThgbBHnakEowbozz57EWGg.......................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..zPThgbBHnakEo........................", "id": "sgid1.step..w5n1aGHFGCCWGtkfbm9U........................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "VOLUME_GROUP_REVERSE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Terminate Compute Instances", "id": "sgid1.group..dfo08HuDTUIdkpt5l..............................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..dfo08H...............................", "id": "sgid1.step..7SMxaezWR5lYX...............................", "is-enabled": false, "member-id": "ocid1.instance.oc1...............................", "timeout": 3600, "type": "COMPUTE_INSTANCE_TERMINATE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Remove Compute Instances from DR Protection Group", "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4.........................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..pOeXUaXGLb1uhT.......................", "id": "sgid1.step..WilcZMUCDF42M0dhABNy........................", "is-enabled": true, "member-id": "ocid1.instance.oc1...............................", "timeout": 3600, "type": "COMPUTE_INSTANCE_REMOVE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Terminate Volume Groups", "id": "sgid1.group..FfcGwUBiibLFaYFfcnmHv2Q591.....................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..FfcGwUBiibLFaY.......................", "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOI.......................", "is-enabled": false, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "VOLUME_GROUP_TERMINATE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Remove Volume Groups from DR Protection Group", "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0frx.......................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..RWQ1nwbf6JkIir.......................", "id": "sgid1.step..7bPFQyPkxXU4zaywzFNfp.......................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1............................", "timeout": 3600, "type": "VOLUME_GROUP_REMOVE", "user-defined-step": null } ], "type": "BUILT_IN" } ], "system-tags": {}, "time-created": "2023-11-23T09:22:09.690000+00:00", "time-updated": "2023-11-24T06:25:43.748000+00:00", "type": "SWITCHOVER" }, "etag": "b73b71668a7f52474c4c7df9c779d9c7aae77c27109be--gzip" }
-
You can add user-defined groups and steps to a Disaster Recovery (DR) plan after Full Stack DR creates an initial DR plan with built-in groups and steps. You have option to use either script or OCI functions as part of user defined step. For more information,see OCI Full Stack Disaster Recovery User defined plan groups. User defined plan groups can be placed anywhere in the DR plan after the Built-In Prechecks plan group. In this tutorial, we are going to add our user defined plan group (CustGroup-Demo) add the end of the plan. The step will use a simple shell script to create folders and files once the compute instance is launched in the London region.
-
Update the
dr-plan-get.json
which was created in previous step to add a user defined plan group with a step in the end of the file content to the existing plans groups and rename the filedr-plan-get.json
asdr-plan-get_updated.json
.Finally JSON file looks like below after adding the new user defined group.
[ { "display-name": "Built-In Prechecks", "id": "sgid1.group..AwplAFAmPMSjrPIH1zlAIqu....................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmP....................", "id": "sgid1.step..PO9O2GisLb05WkUKeb..................", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK", "user-defined-step": null }, { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMSj.................", "id": "sgid1.step..IwKsQfyM6w78JcvklS2.................", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK", "user-defined-step": null }, { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMSjrP...............", "id": "sgid1.step..XASO1rLLQk2GfJjKYlOf5...............", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_STOP_PRECHECK", "user-defined-step": null }, { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPMSjrP...............", "id": "sgid1.step..VcHYP3vKNNTr6Ha5CB..................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "UNKNOWN_ENUM_VALUE", "user-defined-step": null }, { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..AwplAFAmPM...................", "id": "sgid1.step..wRdVq2..............................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK", "user-defined-step": null } ], "type": "BUILT_IN_PRECHECK" }, { "display-name": "Stop Compute Instances", "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9F1rW.............", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..XEqWbSZn72Ms.................", "id": "sgid1.step..GhvhuUwDXmyqaJe1....................", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_STOP", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Switchover Volume Groups", "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM......................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..32adaPzUEQ7aH1uD.............", "id": "sgid1.step..ef9UNZtJ1rZ.........................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "VOLUME_GROUP_RESTORE_SWITCHOVER", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Launch Compute Instances", "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt3mxvA...................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..5hcYKKlYTRi..................", "id": "sgid1.step..woJnsXF5wTpY3.......................", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_LAUNCH", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Reverse Volume Groups' Replication", "id": "sgid1.group..zPThgbBHnakEowbozz57EW4vAdM9O", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..zPThgbBH.....................", "id": "sgid1.step..w5n1aGHFGCCWGtk.....................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "VOLUME_GROUP_REVERSE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Terminate Compute Instances", "id": "sgid1.group..dfo08HuDTUIdkpt5loA5zB.....................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..dfo08HuDTUIdkpt5lo...........", "id": "sgid1.step..7SMxaezWR5lYXQ......................", "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_TERMINATE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Remove Compute Instances from DR Protection Group", "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4Yw...................", "steps": [ { "display-name": "drtestwls-bastion-instance", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..pOeXUaXGLb1..................", "id": "sgid1.step..WilcZMUCDF42M0dhAB..................", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "COMPUTE_INSTANCE_REMOVE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Terminate Volume Groups", "id": "sgid1.group..FfcGwUBiibLFaYZvHEUmQRDSd..................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..FfcGwUBiibLFaYFfcnmH.........", "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOINqf............", "is-enabled": false, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "VOLUME_GROUP_TERMINATE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "Remove Volume Groups from DR Protection Group", "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0Eti...................", "steps": [ { "display-name": "fsdr_volume_group_test", "error-mode": "STOP_ON_ERROR", "group-id": "sgid1.group..RWQ1nwbf6JkIir...............", "id": "sgid1.step..7bPFQyPkxXU4zaywzFN.................", "is-enabled": true, "member-id": "ocid1.volumegroup.oc1....................", "timeout": 3600, "type": "VOLUME_GROUP_REMOVE", "user-defined-step": null } ], "type": "BUILT_IN" }, { "display-name": "CustGroup-Demo", "steps": [ { "display-name": "Create Folder and Files under /home/opc", "error-mode": "CONTINUE_ON_ERROR", "is-enabled": true, "member-id": "ocid1.instance.oc1.......................", "timeout": 3600, "type": "USER_DEFINED", "user-defined-step": { "run-as-user": "opc", "run-on-instance-id": "ocid1.instance.oc1..........", "run-on-instance-region": "uk-london-1", "script-command": "/home/opc/scripts/testCommand.sh", "step-type": "RUN_LOCAL_SCRIPT" } } ], "type": "USER_DEFINED" } ]
-
Use the command to update the DR plan identified by
drPlanId
by using newly updateddr-plan-get_updated.json
file.oci disaster-recovery dr-plan update --dr-plan-id ocid1.drplan.oc1.eu-frankfurt-1.aaaajfq --from-json file://dr-plan-get_updated.json --debug
-
You can verify newly created user defined group on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions, and My_OCI_DR_Plan.
Task 6: Execute prechecks for the Switchover Plan in the Standby region
-
Below is the syntax to execute prechecks for the Switchover Plan.
Usage:
oci disaster-recovery dr-plan-execution create-switchover-precheck [OPTIONS]
Required Parameters:
--plan-id [text]
-
Create JSON file with the following content and name it as
PrecheckExecution.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.{ "displayName": "My_OCI_DR_Plan", "planId": "ocid1.drplan.oc1.............................................", "executionOptions": { "planExecutionType": "SWITCHOVER_PRECHECK" } }
-
Use the following command to execute prechecks for the Switchover Plan on Standby region (London).
oci disaster-recovery dr-plan-execution create-switchover-precheck --from-json file://PrecheckExecution.json --debug
-
You can verify switchover precheck status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions, and My OCI DR Plan.
Task 7: Execute the Switchover Plan in the Standby region (London)
-
Below is the syntax for executing the Switchover Plan.
Usage:
oci disaster-recovery dr-plan-execution create-switchover [OPTIONS]
Required Parameters:
--plan-id [text]
-
Create JSON file with the following content and name it as
SwitchoverExecution.json
. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.JSON file for Association
{ "displayName": "executeDRplan", "planId": "ocid1.drplan.oc1.............................................", "executionOptions": { "planExecutionType": "SWITCHOVER" } }
Use the following command to execute DR Plan.
oci disaster-recovery dr-plan-execution create --from-json file://SwitchoverExecution.json --debug
-
You can verify plan execution status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, and click Plan executions.
-
You can verify DR plan execution status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions and click ExecuteDRplan.
Next Steps
You have seen how to use OCI CLI commands to create DR protection groups, associate, add members, create DR plan, execute prechecks and DR plan. Use OCI CLI for performing various Full Stack DR lifecycle operations at scale for your buisness systems.
Related Links
Acknowledgments
- Authors - Sathish Mahadev (Implementation Tech Lead - Oracle Lift Services), Vasudeva Manikandan (Implementation Tech Lead - Oracle Lift Services), Suraj Ramesh (Full Stack Disaster Recovery Product Manager)
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Automate Full Stack Disaster Recovery with OCI CLI for a Cold Standby Topology
F90398-01
December 2023
Copyright © 2023, Oracle and/or its affiliates.