Solved

Oracle database schema import

Posted on 2013-11-20
11
1,172 Views
Last Modified: 2013-12-12
I need to copy an Oracle database from a database A to database B. Someone created a database dump file (schema export, schema name account1) for me: abc.dmp.gz
The dump files has 9 underlying tables with records of the source database A and schema account1.

Now I need to import the above to my local database B (Oracle again). Could you let me know the command I need to use to import the dump file into my database B. In the database B I do not have a schema named account1. Thanks a lot.
0
Comment
Question by:toooki
11 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 39662351
Your import command should look like that:

imp system/xxxxxx fromuser=account1 touser=account1 file=abc.dmp commit=Y ignore=Y log=imp_abc.log
0
 
LVL 19

Expert Comment

by:Thommy
ID: 39662354
Before importing verify that your schema is created in your database.

Elsewhere create a schema: Create user account1...
0
 
LVL 23

Expert Comment

by:David
ID: 39662438
It will significantly improve your chances if if you unpack the gzip compressed file, first. http://www.gnu.org/software/gzip/

Thommy and I are also assuming you're using the older imp/exp executables rather than Datapump.  Correct us if that's incorrect, there's different syntax.
0
 
LVL 19

Expert Comment

by:Thommy
ID: 39662569
OK, unpacking the gz file before importing should go without saying!

Of course, it is true what dvz mentioned: I was assuming the older import/export utilities

If your dump file is from a newer datapump export then it's a little bit more complicated, because you cannot access your dmp file directly. For the DIRECTORY parameter you have to refer to a database directory object, which specifies the location where impdp utility can find your dmp file.

The import command should go like that:
impdp system/xxxxx   SCHEMAS=account1
                                          DIRECTORY=DATA_PUMP_DIR
                                          DUMPFILE=abc.dmp       
                                          LOGFILE=impdp_abc.log


For database directory objects please see CREATE DIRECTORY
0
 

Author Comment

by:toooki
ID: 39663978
Thank you all. I do not have access to the database server but I have access to the database via a regular user. So I think the imp or impdp commands shall not work for me.
Is there any way to import the data via a regular Oracle database user?
Thanks a lot.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 23

Accepted Solution

by:
David earned 250 total points
ID: 39664043
imp/exp require access to the drive holding the .exp file, whether it's on the server or the client.  Secondly, on the client, they would have to be installed (as part of the standard Oracle client install).

So it's feasible for a user to export and import one's own tables, etc. -- but anything higher would require system privileges to be granted.
0
 
LVL 19

Expert Comment

by:Thommy
ID: 39665107
If your .exp file is a newer type datapump export, then you cannot import from an Oracle client machine. expdp/impdp utilities are server-based and not part of an Oracle client installation. For executing datapump you definitely need access to the database server!

Can you actually clarify what kind of .exp file you have? Do you have an export logfile that comes with your .exp file? From a logfile you can determine the kind of utility that was used for exporting, exp.exe or expdp.exe.

You can even try importing by imp.exe from your client machine. If it's not a valid older type export file, you will get following errors:
IMP-00010: not a valid export file, header failed verification
IMP-00000: Import terminated unsuccessfully
0
 

Assisted Solution

by:Ven_Aluri
Ven_Aluri earned 250 total points
ID: 39679278
unzip the dumpfile

SQL > Create user account1 identified by password default tablespace users;
SQL > create dump directory
SQL > grant read,write on directory dumpdir to system

$ impd system/password directory=dumpdir dumpfile=abc.dmp logilfe=abc_imp.log
fromuser=account1 touser=account1 remap_tablespace=Source_tablespacename:Users
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39679446
Ven_Aluri,

I see you are new to the site.  Welcome.

I don't see how your impdp command will help answer this question when the asker stated " I do not have access to the database server" in http:#a39663978

You also posted this "SQL > create dump directory" implying it is a SQL command.  It isn't.

In the doc links I have, I don't see a FROMUSER/TOUSER parameter for datapump.  Those are original imp parameters.  If you have reference material for them in datapump import,  please post it, I'll take a look.
0
 
LVL 23

Expert Comment

by:David
ID: 39681825
"Importing Objects of One Schema to another Schema

The following example loads all tables belonging to hr schema to scott schema

$impdp SYSTEM/password DIRECTORY=dpump_dir1 DUMPFILE=hr.dmp

REMAP_SCHEMA=hr:scott

If SCOTT account exist in the database then hr objects will be loaded into scott schema. If scott account does not exist, then Import Utility will create the SCOTT account with an unusable password because, the dump file was exported by the user SYSTEM and imported by the user SYSTEM who has DBA privileges. "

HTH
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now