This page describes how to delete an ODB Network and ODB Subnets.

Deleting an ODB Network or an ODB Subnet permanently removes it.
You can't undo this later.

## Before you begin

- Make sure that you have the required Identity and Access Management (IAM) roles and
  permissions to delete an ODB Network and ODB Subnets
  as described in [Deploy Oracle Database@Google Cloud environment](https://docs.cloud.google.com/oracle/database/docs/setup-oracle-database-environment.md.txt#deploy-odb-environment).

- Delete the Oracle Database@Google Cloud resources associated with the ODB Network and the
  ODB Subnet that you want to delete.

- If you've Database Connections using the ODB Network, then you can't
  delete the ODB Network. You must first [delete the Database Connections](https://docs.cloud.google.com/oracle/database/docs/delete-database-connection.md.txt).

## Delete an ODB Subnet

To delete your ODB Subnet, do the following:

### Console

1. Go to the **ODB Network** page.

   [Go to ODB Network](https://console.cloud.google.com/oracle/odb-networks/)
2. Click the ODB Network network for which you want to delete a subnet.

3. Go to the **Subnets** section.

4. For the subnet which you want to delete, click **View actions** ,
   and then click **Delete**.

5. In the **Delete ODB Subnet?** dialog, type the subnet name to confirm
   deletion of your subnet.

6. Click **Confirm**.

### gcloud

Use the `gcloud oracle-database odb-networks odb-subnets delete`
command to delete an ODB Subnet.

    gcloud oracle-database odb-networks odb-subnets delete ODB_SUBNET_ID \
        --project=PROJECT_ID \
        --location=REGION \
        --odb-network=ODB_NETWORK_ID

Replace the following:

- <var translate="no">ODB_SUBNET_ID</var>: the ID of the ODB Subnet.
- <var translate="no">PROJECT_ID</var>: the ID of your Google Cloud project which contains the ODB Subnet to be deleted. If you're using a Shared VPC, then this is the ID of your host project.
- <var translate="no">REGION</var>: the region of the ODB Subnet.
- <var translate="no">ODB_NETWORK_ID</var>: the ID of the ODB Network to which the ODB Subnet belongs.

### API

To delete an ODB Subnet, run the following `curl` command:

```
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://oracledatabase.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/odbNetworks/ODB_NETWORK_ID/odbSubnets/ODB_SUBNET_ID"
```

Replace the following:

- <var translate="no">PROJECT_ID</var>: the ID of your Google Cloud project which contains the ODB Subnet to be deleted. If you're using a Shared VPC, then this is the ID of your host project.
- <var translate="no">REGION</var>: the region of the ODB Subnet.
- <var translate="no">ODB_NETWORK_ID</var>: the ID of the ODB Network to which the ODB Subnet belongs.
- <var translate="no">ODB_SUBNET_ID</var>: the ID of the ODB Subnet.

## Delete an ODB Network

Before deleting an ODB Network, you must delete its
ODB Subnets.

To delete your ODB Network, do the following:

### Console

1. Go to the **ODB Network** page.

   [Go to ODB Network](https://console.cloud.google.com/oracle/odb-networks/)
2. Click the ODB Network network which you want to delete.

3. For the ODB Network which you want to delete, click **View actions** ,
   and then click **Delete**.

4. In the **Delete ODB Network?** dialog, type the ODB Network
   name to confirm deletion of your ODB Network.

5. Click **Confirm**.

### gcloud

Use the `gcloud oracle-database odb-networks delete` command to delete an
ODB Network.

    gcloud oracle-database odb-networks delete ODB_NETWORK_ID \
        --project=PROJECT_ID \
        --location=REGION

Replace the following:

- <var translate="no">ODB_NETWORK_ID</var>: the ID of your ODB Network.
- <var translate="no">PROJECT_ID</var>: the ID of your Google Cloud project which contains the ODB Network to be deleted. If you're using a Shared VPC, then this is the ID of your host project.
- <var translate="no">REGION</var>: the region of the ODB Network.

### API

To delete an ODB Network, run the following `curl` command:

```
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://oracledatabase.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/odbNetworks/ODB_NETWORK_ID"
```

Replace the following:

- <var translate="no">PROJECT_ID</var>: the ID of your Google Cloud project which contains the ODB Network to be deleted. If you're using a Shared VPC, then this is the ID of your host project.
- <var translate="no">REGION</var>: the region of your ODB Network.
- <var translate="no">ODB_NETWORK_ID</var>: the ID of your ODB Network.