DROP VOLUME

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 13.3 LTS and above check marked yes Unity Catalog only

Deletes the specified volume.

Note

When you delete a managed volume, the data files are retained to allow for a 7-day recovery window. After the recovery window ends, the data files are permanently deleted (purged) within 48 hours. For details about the data file lifecycle, billing, and recovery, see Object storage lifecycle in Unity Catalog.

If an external volume is dropped, the metadata about the volume is removed from the catalog, but the underlying files are not deleted.

To drop a volume you must have the MANAGE privilege on the volume, be its owner, or be the owner of the schema, catalog, or metastore the volume resides in.

Warning

A dropped volume cannot be recovered.

Syntax

DROP VOLUME [ IF EXISTS ] volume_name

Parameter

  • IF EXISTS

    If specified, no error is thrown when the volume does not exist.

  • volume_name

    The name of the volume to be dropped. If the volume cannot be found Azure Databricks raises an error.

Examples

– Drop a volume named 'my_volume'
> DROP VOLUME my_volume
  OK

– Drop a volume named `my_volume` under catalog `my_catalog` and schema `my_schema
> DROP VOLUME my_catalog.my_schema.my_volume
  OK

– The volume must exist
> DROP VOLUME my_volume
  Error

– Drop a volume named `my_volume` only if it exists
> DROP VOLUME IF EXISTS my_volume
  OK