做一个exp/imp lab: create a user apple1 default tablespace user1.
create a user apple2 default tablespace user2.
apple1 create a table ABC on user1 tablespace.
我准备把ABC这个table汇出,然后汇入到apple2的schema名为QQQ的table,并且希望这个table要放在apple2的default tablespace (也就是user2)。
1. exp full=y compress=n rows =y file=test.dmp
2. imp system/jakfjks file=test.dmp fromuser=apple1 touser=apple2 tables=(ABC)
importing APPLE1's objects into APPLE2
IMP-00017: following statement failed with ORACLE error 1658:
"CREATE TABLE "ABC" ("ID" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXT"
"RANS 255 STORAGE(INITIAL 131072 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE ""
"USER1" LOGGING NOCOMPRESS"
IMP-00003: ORACLE error 1658 encountered
ORA-01658: unable to create INITIAL extent for segment in tablespace USER1
Import terminated successfully with warnings.
奇怪,我明明是要import到user2这个tablespace上,为什么是user1 tablespace出现无法create extent的错误讯息?要新增extent应该也是在user2这个tablespace上呀?
这是因为,当你import的时候,他就像在执行 建立table的script,并且带着这些参数 "TABLESPACE " "USER1" "LOGGING NOCOMPRESS" in the script,也就是说他会把table建立在原来的user1 tablespace但owner会为apple2 。
如果我不希望原来的ABC和新增的QQQ这两个table放在同一个tablespace上怎么办呢?
alter user apple2 quota unlimited on user2;
alter user apple2 quota 0 on user1;
So while importing this ABC get imported to user2 tablespace it won't use user1 tablespace~~