问题
I am trying to bring the partitioned data back into the original table. But getting the following error. I swapped the partitioned data into AR_TBCAM.BKP_COST_EVENT_P2016 table via this command
ALTER TABLE BKP_COST_EVENT EXCHANGE PARTITION P2016 WITH TABLE AR_TBCAM.BKP_COST_EVENT_P2016 INCLUDING INDEXES WITHOUT VALIDATION;
But I want to bring the data back into the TBCAM.BKP_COST_EVENT table.
Meanwhile I have split the p2016 into 3 partitions -p2014,p2015,p2016 based on year.
As per suggestion, I am issuing the same command to bring back the data into the partitioned table. But getting the following error:
ALTER TABLE BKP_COST_EVENT EXCHANGE PARTITION P2016 WITH TABLE AR_TBCAM.BKP_COST_EVENT_P2016 INCLUDING INDEXES WITHOUT VALIDATION
Error report -
ORA-14097: column type or size mismatch in ALTER TABLE EXCHANGE PARTITION
14097. 00000 - "column type or size mismatch in ALTER TABLE EXCHANGE PARTITION"
*Cause: The corresponding columns in the tables specified in the
ALTER TABLE EXCHANGE PARTITION are of different type or size
*Action: Ensure that the two tables have the same number of columns
with the same type and size.
DDL for partitioned table:
--------------------------------------------------------
-- File created - Monday-May-11-2020
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table BKP_COST_EVENT
--------------------------------------------------------
CREATE TABLE "TBCAM"."BKP_COST_EVENT"
( "MDL_VER_ID" NUMBER(*,0),
"EVENT_ID" NUMBER(*,0),
"EVENT_TYP_ID" NUMBER(*,0),
"TRIGGER_TYP_ID" NUMBER(*,0),
"EVENT_START_DT" DATE,
"EVENT_END_DT" DATE,
"EVENT_DURATION_DAYS" NUMBER(*,0),
"EVENT_DESC" VARCHAR2(300 BYTE),
"EQUIP_ID" NUMBER(*,0),
"SITE_ID" NUMBER(*,0),
"EQUIP_CUM_ACT_HRS" NUMBER(14,2),
"EQUIP_CUM_ACT_STARTS" NUMBER(*,0),
"EQUIP_CUM_FFHRS" NUMBER(14,2),
"EQUIP_CUM_FFSTARTS" NUMBER(*,0),
"EQUIP_CUM_CI_FFHRS" NUMBER(14,2),
"EQUIP_CUM_CI_FFSTARTS" NUMBER(*,0),
"PROJ_PART_PURCHASE_COST" NUMBER(14,2),
"PROJ_PART_PURCHASE_PRICE" NUMBER(14,2),
"PROJ_PART_REPAIR_COST" NUMBER(14,2),
"PROJ_PART_REPAIR_PRICE" NUMBER(14,2),
"PROJ_SERV_COST" NUMBER(14,2),
"PROJ_SERV_PRICE" NUMBER(14,2),
"PROJ_FALLOUT_PRICE" NUMBER(14,2),
"PROJ_FALLOUT_COST" NUMBER(14,2),
"ACT_PART_PURCHASE_COST" NUMBER(14,2),
"ACT_PART_PURCHASE_PRICE" NUMBER(14,2),
"ACT_REPAIR_COST" NUMBER(14,2),
"ACT_REPAIR_PRICE" NUMBER(14,2),
"ACT_SERV_COST" NUMBER(14,2),
"ACT_SERV_PRICE" NUMBER(14,2),
"ACT_FALLOUT_PRICE" NUMBER(14,2),
"ACT_FALLOUT_COST" NUMBER(14,2),
"MANUAL_EVENT_IND" VARCHAR2(1 BYTE),
"RECONFIG_ID" NUMBER(*,0),
"ACTUALIZE_IND" VARCHAR2(1 BYTE),
"COSMOS_EVENT_ID" NUMBER(9,0),
"CREATED_BY" NUMBER(*,0),
"CREATED_DT" DATE,
"UPDATED_DT" DATE,
"UPDATED_BY" NUMBER(*,0),
"DELIMIT_PART_KIT_ID" NUMBER,
"COMMENTS" VARCHAR2(1000 BYTE),
"REASON_ID" NUMBER(*,0),
"MANUAL_CBM_IND" VARCHAR2(1 BYTE),
"PERSISTENT_ID" VARCHAR2(1000 BYTE),
"ORIGINAL_EVENT_TYP_ID" NUMBER,
"EOT_CAUSED_BY" VARCHAR2(30 BYTE),
"EOT_EVENT_TYP_ID" NUMBER,
"INSPECTION_FLAG" VARCHAR2(1 BYTE),
"OFS_ID" VARCHAR2(100 BYTE),
"OFS_STATUS" VARCHAR2(30 BYTE),
"EQUIP_EVE_INV_ACT_HRS" NUMBER(14,2),
"EQUIP_EVE_INV_ACT_STARTS" NUMBER(*,0),
"EQUIP_EVE_INV_FFHRS" NUMBER(14,2),
"EQUIP_EVE_INV_FFSTARTS" NUMBER(*,0),
"EQUIP_SEC_INV_ACT_HRS" NUMBER(14,2),
"EQUIP_SEC_INV_ACT_STARTS" NUMBER(*,0),
"EQUIP_SEC_INV_FFHRS" NUMBER(14,2),
"EQUIP_SEC_INV_FFSTARTS" NUMBER(*,0),
"NON_MAINT_FLAG" VARCHAR2(5 BYTE),
"UNSCHD_MANEVT_FLAG" VARCHAR2(1 BYTE),
"VARIANCE_CAT_ID" NUMBER,
"VARIANCE_SUBCAT_ID" NUMBER,
"VARIANCE_COMMENT" VARCHAR2(255 BYTE),
"FUTURE_MOB_TYP" NUMBER,
"UNPLAN_PROJ_PART_PURCHSE_COST" NUMBER(14,2),
"UNPLAN_PROJ_PART_PURCHSE_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_PART_REPAIR_COST" NUMBER(14,2),
"UNPLAN_PROJ_PART_REPAIR_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_SERV_COST" NUMBER(14,2),
"UNPLAN_PROJ_SERV_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_FALLOUT_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_FALLOUT_COST" NUMBER(14,2),
"UNPLAN_ACT_PART_PURCHSE_COST" NUMBER(14,2),
"XTRAWRK_ACT_PART_PURCHSE_COST" NUMBER(14,2),
"UNPLAN_ACT_PART_PURCHSE_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_PART_PURCHSE_PRICE" NUMBER(14,2),
"UNPLAN_ACT_REPAIR_COST" NUMBER(14,2),
"XTRAWRK_ACT_REPAIR_COST" NUMBER(14,2),
"UNPLAN_ACT_REPAIR_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_REPAIR_PRICE" NUMBER(14,2),
"UNPLAN_ACT_SERV_COST" NUMBER(14,2),
"XTRAWRK_ACT_SERV_COST" NUMBER(14,2),
"UNPLAN_ACT_SERV_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_SERV_PRICE" NUMBER(14,2),
"UNPLAN_ACT_FALLOUT_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_FALLOUT_PRICE" NUMBER(14,2),
"UNPLAN_ACT_FALLOUT_COST" NUMBER(14,2),
"XTRAWRK_ACT_FALLOUT_COST" NUMBER(14,2),
"UNPLAN_PROJ_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_INSPECT_COST" NUMBER(14,2),
"UNPLAN_ACT_INSPECT_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_ACT_INSPECT_COST" NUMBER(14,2),
"XTRAWRK_ACT_INSPECT_COST" NUMBER(14,2),
"UNPLAN_OUTSTAND_INSPECT_PRICE" NUMBER(14,2),
"XTRAWRK_OUTSTAND_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_OUTSTAND_INSPECT_COST" NUMBER(14,2),
"XTRAWORK_OUTSTAND_INSPECT_COST" NUMBER(14,2),
"BUSINESS_GRP_EVENT_ID" NUMBER,
"FUTURE_MOB_EVENT" VARCHAR2(5 BYTE),
"OFS_EVENT_DT" DATE,
"OFS_EVENT_NAME" VARCHAR2(20 BYTE),
"EVENTHOURS" NUMBER(*,0)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA"
PARTITION BY RANGE ("CREATED_DT")
(PARTITION "P13" VALUES LESS THAN (TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "AR_TBCAM_TABLES" ,
PARTITION "P14" VALUES LESS THAN (TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "AR_TBCAM_TABLES" ,
PARTITION "P2016" VALUES LESS THAN (TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "AR_TBCAM_TABLES" ,
PARTITION "P2017" VALUES LESS THAN (TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA" ,
PARTITION "P2018" VALUES LESS THAN (TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA" ,
PARTITION "P2019" VALUES LESS THAN (TO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA" ,
PARTITION "P" VALUES LESS THAN (MAXVALUE) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA" ) ;
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."MDL_VER_ID" IS 'This column holds the unique identifier for the model version';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_ID" IS 'Unique Id for the event (Sequential number)';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_TYP_ID" IS 'This is a unique identifier for an event type. It is a running serial number.
From Event type master table';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."TRIGGER_TYP_ID" IS 'Unique id for a trigger type';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_START_DT" IS 'Start date for the event, as computed by the system during simulation.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_END_DT" IS 'End date of the event as computed by the system during simulation';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_DURATION_DAYS" IS 'Duration (in days) of the event';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENT_DESC" IS 'Event description (displayed on UI)';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EQUIP_ID" IS 'Unique Identifier for Equipment.
LMS_CONTRACT_VERSION_UNIT.ID_UNIT
For site level events,this will be null';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."SITE_ID" IS 'Unique id for a site. LMS_CONTRACT_VERSION_SITE. ID_SITE
';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EQUIP_CUM_ACT_HRS" IS 'Actual Hours when this event will occur.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EQUIP_CUM_ACT_STARTS" IS 'Actual Starts when this event will occur';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EQUIP_CUM_FFHRS" IS 'Actual FFHours when this event will occur';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EQUIP_CUM_FFSTARTS" IS 'Actual FFStarts when this event will occur';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_PART_PURCHASE_COST" IS 'Total Purchase cost of all parts coming in during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_PART_PURCHASE_PRICE" IS 'Total Purchase price of all parts coming in during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_PART_REPAIR_COST" IS 'Total Repair cost of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_PART_REPAIR_PRICE" IS 'Total Repair price of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_SERV_COST" IS 'Total cost of all services items that occur during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_SERV_PRICE" IS 'Total price of all services items that occur during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_FALLOUT_PRICE" IS 'Total Fallout price of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."PROJ_FALLOUT_COST" IS 'Total Fallout cost of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_PART_PURCHASE_COST" IS 'Actual Purchase cost of all parts coming in during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_PART_PURCHASE_PRICE" IS 'Actual Purchase price of all parts coming in during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_REPAIR_COST" IS 'Actual repair cost of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_REPAIR_PRICE" IS 'Actual repair price of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_SERV_COST" IS 'Actual service cost of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_SERV_PRICE" IS 'Actual service price of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_FALLOUT_PRICE" IS 'Actual Fallout price of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACT_FALLOUT_COST" IS 'Actual Fallout cost of all parts going out during this event.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."MANUAL_EVENT_IND" IS 'This field stores yes (Y) and no (N) value for manually added event and system generated event respectively.';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."RECONFIG_ID" IS 'Unique id for a reconfiguration (sequential number)';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."ACTUALIZE_IND" IS 'This field stores the indicator whether the event actually happened (';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."COSMOS_EVENT_ID" IS 'This is Unique Identifier to identify the Cosmos event ';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."CREATED_BY" IS 'The user who created the record';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."CREATED_DT" IS 'Date when the record was created';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."UPDATED_DT" IS 'LMS_CATALOG_VERSION.DT_UPDATE_DATETIME
';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."UPDATED_BY" IS 'LMS_CATALOG_VERSION.ID_UPDATE_USER
';
COMMENT ON COLUMN "TBCAM"."BKP_COST_EVENT"."EVENTHOURS" IS 'This column holds the hours at which the event occured';
--------------------------------------------------------
-- DDL for Index COSPK_EVENT_EVENT_TYP_ID
--------------------------------------------------------
CREATE UNIQUE INDEX "TBCAM"."COSPK_EVENT_EVENT_TYP_ID" ON "TBCAM"."BKP_COST_EVENT" ("MDL_VER_ID", "EVENT_ID")
PCTFREE 20 INITRANS 5 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSINDEX" ;
--------------------------------------------------------
-- DDL for Index COSFK_EVENT_EVENT_TYP_ID
--------------------------------------------------------
CREATE INDEX "TBCAM"."COSFK_EVENT_EVENT_TYP_ID" ON "TBCAM"."BKP_COST_EVENT" ("EVENT_TYP_ID")
PCTFREE 10 INITRANS 5 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSINDEX" ;
ALTER INDEX "TBCAM"."COSFK_EVENT_EVENT_TYP_ID" UNUSABLE;
--------------------------------------------------------
-- Constraints for Table BKP_COST_EVENT
--------------------------------------------------------
ALTER TABLE "TBCAM"."BKP_COST_EVENT" ADD CONSTRAINT "COSPK_EVENT_EVENT_TYP_ID_PR" PRIMARY KEY ("MDL_VER_ID", "EVENT_ID") DISABLE;
ALTER TABLE "TBCAM"."BKP_COST_EVENT" ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("MDL_VER_ID" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("EVENT_ID" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("EVENT_TYP_ID" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("ACTUALIZE_IND" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("CREATED_BY" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("CREATED_DT" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("UPDATED_DT" NOT NULL ENABLE);
ALTER TABLE "TBCAM"."BKP_COST_EVENT" MODIFY ("UPDATED_BY" NOT NULL ENABLE);
DDL for Non-Partitioned Table:
CREATE TABLE "AR_TBCAM"."BKP_COST_EVENT_P2016"
( "MDL_VER_ID" NUMBER(*,0),
"EVENT_ID" NUMBER(*,0),
"EVENT_TYP_ID" NUMBER(*,0),
"TRIGGER_TYP_ID" NUMBER(*,0),
"EVENT_START_DT" DATE,
"EVENT_END_DT" DATE,
"EVENT_DURATION_DAYS" NUMBER(*,0),
"EVENT_DESC" VARCHAR2(300 BYTE),
"EQUIP_ID" NUMBER(*,0),
"SITE_ID" NUMBER(*,0),
"EQUIP_CUM_ACT_HRS" NUMBER(14,2),
"EQUIP_CUM_ACT_STARTS" NUMBER(*,0),
"EQUIP_CUM_FFHRS" NUMBER(14,2),
"EQUIP_CUM_FFSTARTS" NUMBER(*,0),
"EQUIP_CUM_CI_FFHRS" NUMBER(14,2),
"EQUIP_CUM_CI_FFSTARTS" NUMBER(*,0),
"PROJ_PART_PURCHASE_COST" NUMBER(14,2),
"PROJ_PART_PURCHASE_PRICE" NUMBER(14,2),
"PROJ_PART_REPAIR_COST" NUMBER(14,2),
"PROJ_PART_REPAIR_PRICE" NUMBER(14,2),
"PROJ_SERV_COST" NUMBER(14,2),
"PROJ_SERV_PRICE" NUMBER(14,2),
"PROJ_FALLOUT_PRICE" NUMBER(14,2),
"PROJ_FALLOUT_COST" NUMBER(14,2),
"ACT_PART_PURCHASE_COST" NUMBER(14,2),
"ACT_PART_PURCHASE_PRICE" NUMBER(14,2),
"ACT_REPAIR_COST" NUMBER(14,2),
"ACT_REPAIR_PRICE" NUMBER(14,2),
"ACT_SERV_COST" NUMBER(14,2),
"ACT_SERV_PRICE" NUMBER(14,2),
"ACT_FALLOUT_PRICE" NUMBER(14,2),
"ACT_FALLOUT_COST" NUMBER(14,2),
"MANUAL_EVENT_IND" VARCHAR2(1 BYTE),
"RECONFIG_ID" NUMBER(*,0),
"ACTUALIZE_IND" VARCHAR2(1 BYTE),
"COSMOS_EVENT_ID" NUMBER(9,0),
"CREATED_BY" NUMBER(*,0),
"CREATED_DT" DATE,
"UPDATED_DT" DATE,
"UPDATED_BY" NUMBER(*,0),
"DELIMIT_PART_KIT_ID" NUMBER,
"COMMENTS" VARCHAR2(1000 BYTE),
"REASON_ID" NUMBER(*,0),
"MANUAL_CBM_IND" VARCHAR2(1 BYTE),
"PERSISTENT_ID" VARCHAR2(1000 BYTE),
"ORIGINAL_EVENT_TYP_ID" NUMBER,
"EOT_CAUSED_BY" VARCHAR2(30 BYTE),
"EOT_EVENT_TYP_ID" NUMBER,
"INSPECTION_FLAG" VARCHAR2(1 BYTE),
"OFS_ID" VARCHAR2(100 BYTE),
"OFS_STATUS" VARCHAR2(30 BYTE),
"EQUIP_EVE_INV_ACT_HRS" NUMBER(14,2),
"EQUIP_EVE_INV_ACT_STARTS" NUMBER(*,0),
"EQUIP_EVE_INV_FFHRS" NUMBER(14,2),
"EQUIP_EVE_INV_FFSTARTS" NUMBER(*,0),
"EQUIP_SEC_INV_ACT_HRS" NUMBER(14,2),
"EQUIP_SEC_INV_ACT_STARTS" NUMBER(*,0),
"EQUIP_SEC_INV_FFHRS" NUMBER(14,2),
"EQUIP_SEC_INV_FFSTARTS" NUMBER(*,0),
"NON_MAINT_FLAG" VARCHAR2(5 BYTE),
"UNSCHD_MANEVT_FLAG" VARCHAR2(1 BYTE),
"VARIANCE_CAT_ID" NUMBER,
"VARIANCE_SUBCAT_ID" NUMBER,
"VARIANCE_COMMENT" VARCHAR2(255 BYTE),
"FUTURE_MOB_TYP" NUMBER,
"UNPLAN_PROJ_PART_PURCHSE_COST" NUMBER(14,2),
"UNPLAN_PROJ_PART_PURCHSE_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_PART_REPAIR_COST" NUMBER(14,2),
"UNPLAN_PROJ_PART_REPAIR_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_SERV_COST" NUMBER(14,2),
"UNPLAN_PROJ_SERV_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_FALLOUT_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_FALLOUT_COST" NUMBER(14,2),
"UNPLAN_ACT_PART_PURCHSE_COST" NUMBER(14,2),
"XTRAWRK_ACT_PART_PURCHSE_COST" NUMBER(14,2),
"UNPLAN_ACT_PART_PURCHSE_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_PART_PURCHSE_PRICE" NUMBER(14,2),
"UNPLAN_ACT_REPAIR_COST" NUMBER(14,2),
"XTRAWRK_ACT_REPAIR_COST" NUMBER(14,2),
"UNPLAN_ACT_REPAIR_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_REPAIR_PRICE" NUMBER(14,2),
"UNPLAN_ACT_SERV_COST" NUMBER(14,2),
"XTRAWRK_ACT_SERV_COST" NUMBER(14,2),
"UNPLAN_ACT_SERV_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_SERV_PRICE" NUMBER(14,2),
"UNPLAN_ACT_FALLOUT_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_FALLOUT_PRICE" NUMBER(14,2),
"UNPLAN_ACT_FALLOUT_COST" NUMBER(14,2),
"XTRAWRK_ACT_FALLOUT_COST" NUMBER(14,2),
"UNPLAN_PROJ_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_PROJ_INSPECT_COST" NUMBER(14,2),
"UNPLAN_ACT_INSPECT_PRICE" NUMBER(14,2),
"XTRAWRK_ACT_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_ACT_INSPECT_COST" NUMBER(14,2),
"XTRAWRK_ACT_INSPECT_COST" NUMBER(14,2),
"UNPLAN_OUTSTAND_INSPECT_PRICE" NUMBER(14,2),
"XTRAWRK_OUTSTAND_INSPECT_PRICE" NUMBER(14,2),
"UNPLAN_OUTSTAND_INSPECT_COST" NUMBER(14,2),
"XTRAWORK_OUTSTAND_INSPECT_COST" NUMBER(14,2),
"BUSINESS_GRP_EVENT_ID" NUMBER,
"FUTURE_MOB_EVENT" VARCHAR2(5 BYTE),
"OFS_EVENT_DT" DATE,
"OFS_EVENT_NAME" VARCHAR2(20 BYTE),
"EVENTHOURS" NUMBER(*,0)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 8388608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "CAMSDATA" ;
回答1:
Please check the column order and datatypes of the exchangees. I'd use the data dictionary views ALL_TAB_COLS
as it's most reliable. For instance, for the example tables
CREATE TABLE t(a NUMBER, b NUMBER, c CHAR, d DATE)
PARTITION BY RANGE (d) (PARTITION p1 VALUES LESS THAN (DATE '2014-01-01'));
CREATE TABLE p(a NUMBER, b NUMBER, d DATE, c CHAR);
ALTER TABLE t EXCHANGE PARTITION p1 WITH TABLE p;
ORA-14097: column type or size mismatch in ALTER TABLE EXCHANGE PARTITION
you'll find the following differences (I used USER_TAB_COLS
for simplification):
WITH
t AS (SELECT * FROM user_tab_cols WHERE table_name = 'T'),
p AS (SELECT * FROM user_tab_cols WHERE table_name = 'P')
SELECT internal_column_id, t.column_name, t.data_type, p.column_name, p.data_type
FROM t FULL OUTER JOIN p USING (internal_column_id);
1 A NUMBER A NUMBER
2 B NUMBER B NUMBER
3 C CHAR D DATE <= different column order
4 D DATE C CHAR <=
But the differences could be more subtle, like the differences in the datatype:
CREATE TABLE q(a NUMBER, b NUMBER, d DATE, c VARCHAR2(1));
ALTER TABLE t EXCHANGE PARTITION p1 WITH TABLE q;
1 A NUMBER A NUMBER
2 B NUMBER B NUMBER
3 C CHAR C VARCHAR2 <= different data type
4 D DATE C DATE
It is important to use DBA/ALL/USER_TAB_COLS
and not DBA/ALL/USER_TAB_COLLUMNS
, as it shows all the hidden columns.
EDIT: A more complete query would look like
WITH
t AS (SELECT * FROM user_tab_cols WHERE table_name = 'T'),
p AS (SELECT * FROM user_tab_cols WHERE table_name = 'P')
SELECT column_id,
t.column_name, t.data_type, t.data_length,
p.column_name, p.data_type, p.data_length
FROM t FULL OUTER JOIN p USING (column_id)
WHERE t.column_name IS NULL -- column missing
OR p.column_name IS NULL -- column missing
OR t.column_name <> p.column_name -- column name different
OR t.data_type <> p.data_type -- datatype different
OR t.data_length <> p.data_length -- data size different;
EDIT:
Unused columns (which are displayed in DBA/ALL/USER_UNUSED_COL_TABS
) will also prevent a partition exchange:
CREATE TABLE p(a NUMBER, b NUMBER, c CHAR, d DATE, e NUMBER);
ALTER TABLE p SET UNUSED (e);
ALTER TABLE t EXCHANGE PARTITION p1 WITH TABLE p;
ORA-14097: column type or size mismatch in ALTER TABLE EXCHANGE PARTITION
ALTER TABLE p DROP UNUSED COLUMNS;
ALTER TABLE t EXCHANGE PARTITION p1 WITH TABLE p;
Table T altered.
回答2:
I was able to Exchange partition once I put all the constraints to the storage table similar to the partitioned table.
来源:https://stackoverflow.com/questions/61720937/alter-table-exchange-partition-giving-error