Drops a subpartition and its data from a composite partitioned table. This operation permanently removes the subpartition data. Before you run this statement, ensure the data is backed up or 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 dropped. |
|
| Yes | The name of the subpartition to be dropped. |
|
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 when you lack ALTER privileges on the target table or when 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 error occur?
A: This error indicates that the specified subpartition name does not exist or is misspelled. Query the ALL_TAB_SUBPARTITIONS view to verify the correct name. If the name is not enclosed in double quotation marks, the database converts it to uppercase for matching.
Q3: Why do I get the ORA-01031: insufficient privileges error?
A: 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 permanent 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: Drops a partition and all its subpartitions.
ALTER TABLE ADD SUBPARTITION: Adds a new subpartition to an existing partition.
ALTER TABLE TRUNCATE SUBPARTITION: Removes 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.