Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import one schema into another new schema - Oracle [closed]

Tags:

oracle

I have a data dmp file exported from one schema user1 using the exp commandline utility.

I want to import this dump onto another newly created (empty) schema user 2 using the imp commandline utility.

I tried a few things like:

imp system/password@tesdb fromuser=user1 touser=user2 file=E:\Data\user1.dmp log=E:\Data\user1.log

I get an error

IMP-00002: failed to open user1.dmp for read
Import file: EXPDAT.DMP >

Any help appreciated.

like image 501
Ram Avatar asked Feb 28 '13 18:02

Ram


People also ask

How do I copy a table from one schema to another schema in Oracle?

right click on table >> Table>>COPY>> select the schema where you want to copy.

Can a user have multiple schemas in Oracle?

It is not possible. In Oracle, a user = a schema. When you create an Oracle user, it is tied to the schema with the same username. You cannot create any additional schemas for that user.


1 Answers

After you correct the possible dmp file problem, this is a way to ensure that the schema is remapped and imported appropriately. This will also ensure that the tablespace will change also, if needed:

impdp system/<password> SCHEMAS=user1 remap_schema=user1:user2 \
            remap_tablespace=user1:user2 directory=EXPORTDIR \
            dumpfile=user1.dmp logfile=E:\Data\user1.log

EXPORTDIR must be defined in oracle as a directory as the system user

create or replace directory EXPORTDIR as 'E:\Data';
grant read, write on directory EXPORTDIR to user2;
like image 174
Adam Avatar answered Sep 24 '22 15:09

Adam