Permanently drops a subpartition and its data from a composite partitioned table. Back up the data before you run this statement.
Synopsis
ALTER TABLE table_name DROP SUBPARTITION subpartition_name;Parameters
|
Parameter |
Required |
Description |
Example |
|
|
Yes |
The composite partitioned table that contains the subpartition to drop. |
|
|
|
Yes |
The subpartition to drop. |
|
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 DML and most DDL operations on the table. Run this statement during off-peak hours to avoid blocking other operations.
Examples
This example drops a subpartition from the customer_data composite partitioned table, which uses range partitioning by year and list subpartitioning by region.
FAQ
Q1: Why do I get the ORA-00942: table or view does not exist error?
A: You lack ALTER privileges on the target table, or the table or schema name is misspelled. Verify your privileges and object names.
Q2: Why does the ORA-14006: invalid partition name error occur?
A: The subpartition name does not exist or is misspelled. Query ALL_TAB_SUBPARTITIONS to verify the name. Without double quotation marks, the database converts the name to uppercase for matching.
Q3: Why do I get the ORA-01031: insufficient privileges error?
A: You lack ALTER privileges on the target table. Contact your DBA to grant the required privileges.
Q4: Can data be recovered after running DROP SUBPARTITION?
A: No. DROP SUBPARTITION permanently deletes data and bypasses the Recycle Bin. Restore from a backup taken 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.