[Oracle]ORA-14400:插入的分區關鍵字未映射到任何分區


今天在使用測試庫的時候發生ORA-14400:inserted partition key does not map to any partition

解決過程:

  經過百度,發現出現ORA-14400是表分區出現問題。  

  1.確定該表是否已經添加了表分區。    

select partition_name,high_value from user_tab_partitions t where table_name='table_name';

  2.查詢表分區綁定的字段名稱。   

select * from user_part_key_columns t where name='table_name';

  3.查看當前表分區的具體情況

select * from user_tab_partitions t where table_name='table_name';

  4.查詢表分區綁定的字段的最大值。注:此處的table_name應為當前表對應的原始庫中的源表。

select max(key_column) from table_name t;

  5.將查詢到的表分區綁定字段的最大值插入到當前表中進行測試,發現報錯。

insert into table_name(table_column1,table_column2,......,key_column) values(value1,value2,......,key_value);

  6.經過以上環節確定源表中出現錯誤數據,並且由於錯誤數據的時間跨度大於當前分區的范圍,導致ORA-14400錯誤的出現,但是由於該數據必須保留,因此對表分區進行擴展。

  7.擴展當前表分區以保證范圍大於綁定字段的最大值。

復制代碼
alter table  table_name add partition part_key_column_029 values less than (to_date('2029-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS','NLS_CALENDAR=GREGORIAN'))

       tablespace tablespace_name

       pctfree 10

        initrans 1

       maxtrans255,

......,

alter table  table_name add partition part_key_column_049 values less than (to_date('2049-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS','NLS_CALENDAR=GREGORIAN'))
       tablespace tablespace_name        pctfree 10        initrans 1        maxtrans255,
復制代碼

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM