Drops a subpartition and its data from a composite partitioned table. This operation permanently drops the subpartition's data. Before you run this statement, ensure the subpartition's data is backed up or is no longer needed.
Synopsis
ALTER TABLE table_name DROP SUBPARTITION subpartition_name;Parameters
Parameter | Required | Description | Example |
| Yes | The name of the composite partitioned table that contains the subpartition to be deleted. |
|
| Yes | The name of the subpartition to be deleted. |
|
Notes
You must be the table owner or a privileged user to run this command.
You cannot drop the last subpartition in a table.
DROP SUBPARTITIONacquires a table-level exclusive lockAccessExclusiveLock. This lock blocks all Data Manipulation Language (DML) and most Data Definition Language (DDL) operations on the table. Run this statement during off-peak hours and allow sufficient time for it to complete to avoid blocking other critical operations on the table.
Examples
This example drops the subpartition for user data from the Asia region for the year 2022 to free up storage space. The customer_data table is a Composite Partitioned Table that is partitioned by registration year (Range Partitioning) and subpartitioned by region (List Subpartitioning).
FAQ
Q1: Why do I get the ORA-00942: table or view does not exist error?
A: This error typically occurs for two reasons: 1) you lack ALTER privileges on the target table, or 2) the table or schema name is misspelled. Check your privilege settings and verify that the object names are correct.
Q2: Why does the ORA-14006: invalid partition name fault occur?
A: This error indicates that the specified subpartition name does not exist or is misspelled. You can query the ALL_TAB_SUBPARTITIONS view to verify the correct name of the target subpartition. Note that if the name is not enclosed in double quotation marks, the database typically converts it to uppercase for matching.
Q3: Why do I get the ORA-01031: insufficient privileges error?
A: This error occurs because you do not have ALTER privileges on the target table. Contact your database administrator to grant the necessary privileges.
Q4: Can data be recovered after running DROP SUBPARTITION?
A: No. DROP SUBPARTITION is a physical deletion that bypasses the Recycle Bin. The only way to recover the data is to restore it from a database backup created before the operation.
Related SQL statements
ALTER TABLE DROP PARTITION: Deletes a partition and all its subpartitions.
ALTER TABLE ADD SUBPARTITION: Adds a new subpartition to an existing partition.
ALTER TABLE TRUNCATE SUBPARTITION: Deletes the data in a subpartition but retains its definition.
ALTER TABLE MERGE SUBPARTITION: Merges two subpartitions into a new subpartition.
ALTER TABLE SPLIT SUBPARTITION: Splits one subpartition into two subpartitions.