Delete database clusters

You can delete database clusters with the GDC console or the Distributed Cloud CLI.

Console

  1. From the main menu of the GDC console, choose Database Service.
  2. Select the database cluster to delete.
  3. Click DELETE.
  4. Optional: If backup was previously enabled, select Delete all backups. This results in a permanent deletion. Otherwise, backups will be automatically deleted once the project's retention period expires.
  5. Confirm deletion by typing the cluster's ID.
  6. Click DELETE to finish.

gdcloud CLI

Use the following command to delete a database cluster:

gdcloud database clusters delete CLUSTER_NAME

Replace the following:

  • CLUSTER_NAME with the name of the database cluster to delete.

API

kubectl patch dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME -p '{"spec":{"isDeleted": true}}' --type=merge -n USER_PROJECT
kubectl delete dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME -n USER_PROJECT # for database clusters with backup enabled, this will permanently delete the database.

Replace the following variables:

  • DBENGINE_NAME, the name of the database engine. This is one of alloydbomni, postgresql, or oracle.
  • USER_PROJECT, the name of the user project where the database cluster was created.
  • DBCLUSTER_NAME, the name of the database cluster.

For database clusters without backup, only the first step is needed. For databases with backup, running the first command only will delete the database while keeping its backups (and therefore the database cluster is still recoverable). These backups will be deleted after their retention time if no action is taken. The second command can be used to immediately delete the database cluster and all of its backups.