We help IT Professionals succeed at work.

The best way to transfer a database?

JDN
JDN asked
on
Medium Priority
1,013 Views
Last Modified: 2008-03-03
Hi Oracle Experts,

I like to know if there's an easy way to transfer an Oracle database from our server to the Personal Oracle on my notebook. I normally make an export on the server using then EXP.EXE tool, and import the database dump in my notebook using the IMP.EXE tool. This export/import works, but I always have to delete all tables in my Personal Oracle database (using the Orcale DBA Studio) before I use the import tool. If I don't delete all tables, the import tool is displaying a lot of scrolling text while importing data. Due to this scrolling text, the import takes a very long time. When I delete all tables in the destination table first, the import is a lot faster.
In the DBA Studio on my notebook there is a menu option Export, Import, Backup and Recovery, but all these menu's generate an error message "This wizard can only be launched when the application is connected to the Oracle Management Server"....?
So, my question is: is there a way to import a database dump without deleting all tables in the destination database first, and without waiting a long time for the many text lines scrolling over the screen?

Thanks for any help!
Comment
Watch Question

Commented:
You should be importing using a parmfile for more flexability. Use the "ignore=y" parm to avoid deleting your objects.


Have you tried to restore the database to your notebook? I have moved many databases from one server to another by restoring the database. You may find this quicker yet.

good luck
Commented:
Hello JDN,

There are a couple of ways to do that.  

The first is to import with IGNORE=Y DESTROY=N option turned on.  This will only import the rows not already in the database. Turning COSTRAINTS=N will skip the verification.

The second is to drop the user DELETE USER USERNAME CASCADE(schema owner), recreate him with the right parameters and then do the import.  It will speed up the process.  

Use INDEXES=N to speed up the import and then run the scripts separately later to create the indexes.

Let me know which one works for you.

Regards,

Debu

Mark GeerlingsDatabase Administrator
CERTIFIED EXPERT

Commented:
One option is to truncate all tables and run import with "ignore=Y" so it doesn't complain about the tables and indexes already existing.  I don't know if either of those options are easy (or even possible) through Oracle's GUI tools, they certainly are available through SQL*Plus or Server Manager (for the truncate) and from a DOS prompt (to run import with a parameter file).  

If you have any referential integrity constraints (foreign keys) these will also have to be disabled before doing the truncates.  Also, any table triggers will need to be disabled.  You can do all of these with script files that are not that difficult to write or with PL\SQL and the "execute immediate" command.
JDN

Author

Commented:
Can you give me an example of using a parmfile with IMP? I am using IMP interactive, and answered the "Ignore..." question with "Yes". But then there's also a lot of scrolling text, which slows down the import.

Dbrower, I tried to use Backup/Restore from the DBA Studio, but as I said: there's always an error message "This wizard can only be launched..." (see my topic).

Thanks,
JDN

Commented:
imp parfile=<parfile_name> will do it.

Commented:
Check out the ORACLE SERVER UTILITIES book. This book has a description of all parms and their meaning. Hhere is an example:




imp parfile=my_parms

my_parms
userid=username/password
file=/dump_file_name
log=/import.log
COSTRAINTS=N
DESTROY=N
ignore=y
indexes=n
commit=y
full=y
recordlength=10240000
feedback=10000
JDN

Author

Commented:
Dbrower,

I used your parfile, but there's still a lot of text scrolling in the DOS box. I see text lines like:

Column 12:
Column 13:
Column 14:
etc

It takes a very long time to import the dump file this way. Is this really the only way to do the job with Oracle. I want to transfer the database daily to my notebook.
I know in the Enterprise Manager of MS SQL Server, there's a simple way to export and import a database dump. The only thing you see moving is a progress bar. Is'nt there in Oracle a similar way, perhaps using a third party tool?

JDN

Commented:
"imp parfile=<para_file_name>" will do it.

Commented:
The other way (faster) to do it is to use SQL*Loader instead of export and import.  Export the tables you require in a fixed format ASCII file. Truncate them in the target database. Then, use SQL*Loader Direct approach (this bypasses inserts, etc) to load the data and then use the index script to re-index later.  This will be the fastest way to do a daily job.
Mark GeerlingsDatabase Administrator
CERTIFIED EXPERT

Commented:
Sorry, one of the (few?) advantages to MS SQL Server is the GUI tools it comes with.  Oracle did not get to be popular because of its GUI tools - many of them are far from user-friendly or complete.  You may find the command-line approach will work better with Oracle.  Most experienced Oracle DBA's use command-line tools extensively, even for Oracle on Windows.

Yes, the command to run import from a DOS prompt is as dpd0809 indicated, but you still need to do the work of truncating the tables, disabling constraints and triggers (and another task I just thought of: dropping sequences) *BEFORE* running import.  Otherwise you will still have all of those error messages to deal with when import runs.

Commented:
If you need this data every day, you may also consider writing a script to:

1) Truncate all the tables.
2) Disable all constraints.
3) Drop all indexes.
4) Use SQL*Net (parallely) to populate all the data.
5) Recreate indexes with UNRECOVERABLE option.
6) Enable the constraints.

This may be faster if you have a fast network, and not in Archivedlog mode (you should not be on your laptop).
JDN

Author

Commented:
I'am very familiar with SQL Server, Markgeer, Oracle is new for me. That's why I asked for help.

I understand from all your reactions that the Oracle command line tools are the only way to do the job.
Anyway, I will continue to import my database this way. Dpd0809 was the first with a complete answer, so I'll give him the points...

Thanks all.

Commented:
you can copy your database to your notebook without exp/imp.
on your Production database run this script:
alter database bakup controlfile to trace;
this will create a controlfile script.

on your notebook:
restore the database to your notebook
change the controlfile script to meet your configuration on your notebook
after that run the script
befoor you open your database with
alter database open resetlogs;
recover your database if it is in archivemode using archives.

ADAM

Explore More ContentExplore courses, solutions, and other research materials related to this topic.