Recovering a Compartment

Learn how to recover a compartment.

To recover a compartment, you must first select it from the list on the Compartment page. You may have to use the state filter to see the deleted compartment. Remember that deleted compartments are renamed by appending a random string of characters to the original compartment name. For example, CompartmentA might become CompartmentA.qR5hP2BD. Oracle displays the deleted compartment on the Compartments page for 90 days.

When you recover a deleted compartment, the name isn't changed. For example, if you recover a deleted compartment named CompartmentA.qR5hP2BD, the name remains the same. Because policy statements are updated to use the new names of deleted compartments, any policy statements that had referenced the deleted compartment now reference the recovered compartment.

    1. Open the navigation menu and click Identity & Security. Under Identity, click Compartments. A list of the compartments in your tenancy is displayed.
    2. In State, select Deleted.
    3. For the compartment you want to recover, click the Actions menu (Actions Menu), and then click Restore.
    4. At the prompt, click Restore.
  • Use the recover command and required parameters to recover a compartment:

    export compartment_id=compartment_ocid # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/iam/compartment/recover.html#cmdoption-compartment-id
    oci iam compartment recover --compartment-id compartment_ocid
    

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the RecoverCompartment operation to recover a compartment.