UNDROP VOLUME
Applies to: Databricks SQL
Databricks Runtime 19.11 and above
Unity Catalog only
The UNDROP VOLUME command recovers a dropped volume in Unity Catalog by its volume ID. Use it to restore a volume that was accidentally dropped. You can recover a dropped volume for 7 days after the drop.
Restoring a volume is a metadata operation, so both managed and external volumes can be undropped. The parent schema and catalog must still exist.
To find the ID of a dropped volume, use SHOW VOLUMES DROPPED.
If a live volume in the same schema already uses the name of the volume you want to recover, rename or drop that volume first with ALTER VOLUME or DROP VOLUME, then run UNDROP VOLUME.
Volume metadata, such as privileges granted on the volume and tags, is recovered. For a managed volume, the files stored in the volume are also recovered.
Syntax
UNDROP VOLUME WITH ID volume_id
Parameter
-
volume_idA
STRINGliteral in the form of a UUID that identifies the dropped volume, as displayed by SHOW VOLUMES DROPPED.
There is no form that recovers a volume by name. You must identify the volume by its ID.
Permissions
UNDROP VOLUME requires one of the following:
- You own, or have
MANAGEon, the volume, and you haveCREATE VOLUMEandUSE SCHEMAon the schema, andUSE CATALOGon the catalog. - You own, or have
MANAGEon, the schema, and you haveUSE CATALOGon the catalog. - You own, or have
MANAGEon, the catalog. - You own the metastore.
In addition, you must have the privileges required to create the volume you restore. For example, to restore an external volume, you must have CREATE EXTERNAL VOLUME on the external location.
After the command runs, ownership defaults to the previous volume owner.
Limitations
You can undrop a volume only within 7 days after it was dropped. After the recovery period passes, the volume is permanently purged and cannot be recovered.
Examples
-- Use SHOW VOLUMES DROPPED to find the ID of the dropped volume.
> SHOW VOLUMES DROPPED IN my_catalog.my_schema;
catalog schema volume_name volume_id owner comment created_at created_by
----------- ---------- ------------ ------------------------------------ ------------- ------- ----------------------------- -------------
my_catalog my_schema my_volume 6ca7be55-8f58-47a7-85ee-7a59082fd17a alf@melmak.et 2023-05-03 AD at 18:17:00 UTC alf@melmak.et
-- Undrop the volume by its ID.
-- Enclose the volume ID in single quotation marks.
> UNDROP VOLUME WITH ID '6ca7be55-8f58-47a7-85ee-7a59082fd17a';
OK