I got ” ORA-14404: partitioned table contains partitions in a different tablespace ” error in Oracle database during the drop tablespace.
ORA-14404: partitioned table contains partitions in a different tablespace
Details of error are as follows.
SQL> DROP TABLESPACE TBS_TEST INCLUDING CONTENTS AND DATAFILES; DROP TABLESPACE TBS_TEST INCLUDING CONTENTS AND DATAFILES * ERROR at line 1: ORA-14404: partitioned table contains partitions in a different tablespace
If you want to learn more details about Tablespace, read the following post.
https://ittutorial.org/create-tablespace-and-create-permanent-undo-and-temp-tablespace-add-datafile-tablespace-in-oracle/
partitioned table contains partitions in a different tablespace
This ORA-14404 errors are related with the partitioned table contains partitions in a different tablespace.
To solve this error, you need to move these partitions in a different tablespace to the same tablespace.
You can use the following post to learn how to move partitions to another tablespace.
How to Move Tables, Index Rebuild, Partitions and Subpartitions to Another Tablespace in Oracle
You can use the following script to move these partitions to different tablespace.
ALTER TABLE TABLE_OWNER.TABLE_NAME MOVE PARTITION PARTITION_NAME TABLESPACE NEW_TABLESPACE_NAME NOLOGGING;
You can generate the move all partitions script under this tablespace as follows.
select 'ALTER TABLE '||TABLE_OWNER ||'.'||table_name||' MOVE PARTITION '||partition_name||' TABLESPACE NEW_TABLESPACE_NAME UPDATE INDEXES;' from dba_tab_partitions where TABLESPACE_NAME = 'TBS_TEST';
You can generate the move all subpartitions script as follows.
SELECT 'ALTER TABLE ' ||TABLE_OWNER ||'.' ||TABLE_NAME ||' MOVE SUBPARTITION ' ||SUBPARTITION_NAME ||' TABLESPACE NEW_TABLESPACE_NAME parallel 64 UPDATE INDEXES;' FROM DBA_TAB_SUBPARTITIONS where TABLESPACE_NAME = 'TBS_TEST';
Once you moved these partitions to the different tablespace, you can drop the tablespace as follows.
SQL> DROP TABLESPACE TBS_TEST INCLUDING CONTENTS AND DATAFILES; Tablespace dropped.
Do you want to learn Oracle Database for Beginners, then read the following articles.
Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )