You are on page 1of 2

8/9/13

The ORACLE Import/Export Utilities

DESY HOME

IT HOME

Print Preview

Print Window

The ORACLE Import/Export Utilities


Export, Import are complementary utilities which allow you to write data in an ORACLE-binary format from the database into operating system files and to read data back from those operating system files. EXPORT, IMPORT are used for the following tasks: backup ORACLE data in operating system files restore tables that where dropped save space or reduce fragmentation in the database move data from one owner to another

Because of the special binary format, files which had been created by the EXPORT utility can only be read by IMPORT. Both tools are only used to maintain ORACLE database objects. To load data from other systems into the database you have to use SQL*LOADER or other programs. To store data from database into readable operating system files you may use e.g. REPORTS, SQLPLUS. It is a prerequisite that oraenv or coraenv (if you are working in a c-shell) was executed before you export, import data. Consider, if you stored data in the database by using an national language support (NLS) other than AMERICAN you have to change your environment before import, export. Example for a german environment:
NLS_LANG=GERMAN_GERMANY.WE8ISO8859P1 export NLS_LANG

EXPORT
Exporting of ORACLE database objects is controlled by parameters. To get familiar with EXPORT parameters type: exp help=y You will get a short description and the default settings will be shown. The EXPORT utility may be used in three ways: Interactive dialogue Simply type exp. You will be prompted for your ORACLE userid, password. All other prompts answer by pressing the return key. This is the easiest way to export all data you stored in the ORALE database. You may assign other values than the defaults to the parameters but in most cases it is unnecessary. Controlled through bypassed parameters You may bypass parameters when you export data from the database. Type: exp < userid/password> < parameter> = < value> ,< parameter> = < value> ,... Example of exporting scott's tables EMP and DEPT to file empdept.expdat and storing all messages to file empdept.log: exp scott/tiger file=empdept.expdat tables=(EMP,DEPT) log=empdept.log Parameterfile controlled Instead of typing the parameters on the commandline you may use a parameter file where the parameters are stored. The syntax for this method is: exp < userid/password> parfile= < filename>

Do not ignore warnings and messages! Look at your logfile and repeat EXPORT until you get messages like:
A b o u tt oe x p o r ts p e c i f i e dt a b l e s. . . .e x p o r t i n gt a b l e E M P .e x p o r t i n gt a b l e D E P T E x p o r tt e r m i n a t e ds u c c e s s f u l l yw i t h o u tw a r n i n g s . 1 4r o w se x p o r t e d 4r o w se x p o r t e d

\
www-it.desy.de/systems/services/databases/oracle/impexp/impexp.html.en 1/2

8/9/13

The ORACLE Import/Export Utilities

IMPORT
Like EXPORT the IMPORT utility is controlled by parameters. To get familiar with these parameters type: imp help=y You will get a short description of usage and default settings of parameters. To start IMPORT simply type imp. You will be prompted for your ORACLE userid, password. The next prompts depend on what you answer. In most cases you may answer the prompts by pressing the return key. But the following prompts you have to answer carefully. I m p o r tf i l e :e x p d a t . d m p>

If your data was exported to file expdat.dmp press return, otherwise enter the filename where the exported data resides.
I g n o r ec r e a t ee r r o rd u et oo b j e c te x i s t e n c e( y e s / n o ) :y e s>

This is a flag to indicate how object creation errors should be handeld. If you import into an existing table and you set IGNORE=Y, rows could be duplicated if they where already present in the table.
I m p o r te n t i r ee x p o r tf i l e( y e s / n o ) :y e s>n o U s e r n a m e :

If your exportfile consists of more objects than you want to import, enter no. In this case you will be prompted for the Username (this is normally your ORACLE account).
E n t e rt a b l en a m e s .N u l ll i s tm e a n sa l lt a b l e sf o ru s e r E n t e rt a b l en a m eo r.i fd o n e :

After entering the username you will be prompted for table names until you press the return key without entering a table name. Than IMPORT will be started. Instead of the dialogue method you may use parameters. This is analogous to the methods described for EXPORT. Examples: imp < userid/password> tables=(table1,table2) Tables table1, table2 will be imported from the default file export.dmp into the database. imp < userid/password> parfile= < filename> Import will be controlled by the named parameterfile. After importing you should get messages like:
i m p o r t i n gS C O T T ' so b j e c t si n t oS C O T T .i m p o r t i n gt a b l e" D E P T " .i m p o r t i n gt a b l e" E M P " I m p o r tt e r m i n a t e ds u c c e s s f u l l yw i t h o u tw a r n i n g s . Imprint 2013 Last update: 17. Jul. 2003 4r o w si m p o r t e d 1 4r o w si m p o r t e d

www-it@desy.de

www-it.desy.de/systems/services/databases/oracle/impexp/impexp.html.en

2/2

You might also like