开发者

import data in oracle

I know how to use the "imp" to import the .dmp data . But I wonder if I have to create the tablespace first,for example?

Other people have a oracle database instance,and he create a user "sa_one" whose defaule tablespace is "tabspace_one",then he create some tables under this tablespace.

Then he export the objects under the user "sa_one" to a xx.dmp.

Now,in my machine,I have my own database instance,and I create a user "sa_two" whose defaule tablespace is "tabspace_two".

Now if I want import the xx.dmp to the user "sa_two". I use the cmd:

imp fromuser=sa_one touser=sa_two file=xx.dmp

But I wonder if I have to create a tablespace 开发者_如何学JAVA"tabspace_one" in my database instace?


hguser,

If you do what you said:

imp fromuser=sa_one touser=sa_two file=xx.dmp

Then the data will be imported into the table space that the 'sa_two' schema has set to as a default table space. Although I must admit - I can't find the oracle documentation that explicitly says this it true, but I did find this oracle wiki: http://wiki.oracle.com/thread/1284972/EXP+%26+IMP+only+restores+to+same+tablespace(s)

Alternatively, you could just use EXPDP and IMPDP and issue remap_tablespace for the import.

All else, this is what happens when you try to import to a table space that does not exist:

C:\Users\jslowik\Desktop>impdp user/password@db_name dumpfile=datfile.dat full=y

Import: Release 11.2.0.1.0 - Production on Thu Jun 23 15:34:27 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31626: job does not exist
ORA-31633: unable to create master table "SC_BASE.SYS_IMPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1020
ORA-00959: tablespace 'TABLES' does not exist


Yes, I believe you have to create the tablespace AND give the sa_two user rights on it. I usually use a group of SQL commands like this:

create tablespace my_data
datafile 'C:\Oracle\oradata\orcl\my_data.dbf' size 50m
autoextend on next 10m
/

drop user sa_two cascade
/

create user sa_two
identified by mypassword
quota unlimited on my_data
/

grant connect, resource to sa_two
/

If you use the imp full import, I believe the tablespaces are created for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜