Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to Drop a partition if Table has FK constraint on table

sreenivas.g.gaddam-OracleJan 14 2025 — edited Jan 14 2025

Hi all,

We are implementing list partitions on some of tables, one of the requirement is to drop partitions based on partition_key
Here is the simple structure for example

here partitions are based on service_id

Table one as FK on content_id

Table1 has two partitions and Table -2 has two partitions

now the requirement is to clean up service_id=1 data from both tables

Drop partition on table -1 is (service_id=1) is successful, but while dropping partition on table-2 (service_1) is throwing.

ORA-02266: unique/primary keys in table referenced by enabled foreign keys
02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
*Cause: An attempt was made to truncate a table with unique or
primary keys referenced by foreign keys enabled in another table.
Other operations not allowed are dropping/truncating a partition of a
partitioned table or an ALTER TABLE EXCHANGE PARTITION.
*Action: Before performing the above operations the table, disable the

from data perspective there is not FK integrity, only tables having this constraint.

Note - we can not drop that constraint.

Any pointers would be helpful

Comments
Post Details
Added on Jan 14 2025
1 comment
35 views