Solved

Oracle database schema import

Posted on 2013-11-20
11
1,151 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 23

Accepted Solution

by:
David earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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)
Comment Utility
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
Comment Utility
"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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle Finace 3 43
run a PARFILE from a Windows Scheduled task - Oracle export 5 31
MS Access question 11 48
Oracle Syntax 8 38
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

772 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

9 Experts available now in Live!

Get 1:1 Help Now