Oracle中刪除表空間時,遇到了ORA-14404錯誤。
錯誤信息以下:
SQL> DROP TABLESPACE PART1 INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE PART1 INCLUDING CONTENTS AND DATAFILES
ORA-14404: partitioned table contains partitions in a different tablespace
一樣查看官方文檔的說明:
Oracle Error: ORA-14404
Error Description: Partitioned table contains partitions in a different tablespace
Error Cause: An attempt was made to drop a tablespace which contains tables whose partitions are not completely contained in this tablespace.
Action: Find tables with partitions which span the tablespace being dropped and some other tablespace(s). Drop these tables or move partitions to a different tablespace. |
問題分析:
ORA-14404錯誤說明有某個表不單單隻在當前表空間,在其餘表空間也存有數據。解決方法,Oracle的建議也比較清晰,要麼刪除這個表,要麼把移動partitions到一個單獨的表空間中。對於我來講,我刪除此表便可。
首先須要找到究竟是哪張表跨越了不一樣表空間:
SQL> SELECT x.table_name,x.partition_name,x.tablespace_name 表空間1, y.tablespace_name 表空間2
2 FROM dba_tab_partitions x, dba_tab_partitions y
3 WHERE x.tablespace_name ='PART1' AND y.tablespace_name <> 'PART1' AND x.table_name=y.table_name;
TABLE_NAME PARTITION_NAME 表空間1 表空間2
------------------------------ ------------------------------ ------------------------------ ------------------------------
RANGE_PART YR0 PART1 PART2
RANGE_PART YR0 PART1 PART3
RANGE_PART YR0 PART1 PART4
即找到名稱爲RANGE_PART的分區表的數據在表空間PART1、PART2和PART3上,接下來刪除此表便可。
SQL> drop table RANGE_PART;Table dropped