从虚拟机导出的创建表的脚本恢复到另一个数据库中执行报错的问题
报错信息:创建表 ORA-00922: 选项缺失或无效
解决办法:
先检查表空间是否正确,这里没错;
再从目标数据库中生成快速ddl文件,将其与创建表的脚本做对比,发现多了如下红色部分语句:
CREATE TABLE "MYDB"."APP_WORK"
( "ID" NUMBER(12,0),
"WORK_CONTENT" VARCHAR2(600 BYTE),
"TUSER_ID" NUMBER(12,0),
"WORKER" VARCHAR2(200 BYTE),
"CTIME" DATE
) 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 " MYDB " ;
--------------------------------------------------------
-- DDL for Index APP_WORK_PK
--------------------------------------------------------
CREATE UNIQUE INDEX " MYDB "."APP_WORK_PK" ON " MYDB "."APP_WORK" ("ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
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 " MYDB " ;
--------------------------------------------------------
-- Constraints for Table APP_WORK
--------------------------------------------------------
ALTER TABLE " MYDB "."APP_WORK" ADD CONSTRAINT "APP_WORK_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
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 " MYDB " ENABLE;
ALTER TABLE " MYDB "."APP_WORK" MODIFY ("ID" NOT NULL ENABLE);
ALTER TABLE " MYDB "."APP_WORK" MODIFY ("WORK_CONTENT" NOT NULL ENABLE);
ALTER TABLE " MYDB "."APP_WORK" MODIFY ("TUSER_ID" NOT NULL ENABLE);
ALTER TABLE " MYDB "."APP_WORK" MODIFY ("WORKER" NOT NULL ENABLE);
ALTER TABLE " MYDB "."APP_WORK" MODIFY ("CTIME" NOT NULL ENABLE);
将红色字体部分删除执行,正确;
原因可能是因为数据库版本不一致。