You are on page 1of 11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

Log in

Serious about Oracle. Home About ORA Training Downloadable Plug-and-Play Sandboxes (Virtual Machines) RSS feed 2008-2014 ORA Training Blog

Oracle Export and Import utility tutorial


Like 0 0 Tw eet 0 Share

Oracle Data Export and Import utility


The Import and Export utilities work together; Export sends database definitions and actual data to an export file and Import can read the file to perform many different tasks. You can use Export and Import for many important database tasks, such as restoring a table, generating CREATE scripts, copying data among Oracle databases, migrating among Oracle versions, and moving tables from one schema to another. Oracles export (exp) and import (imp) utilities are used to perform logical database backup and recovery. When exporting, database objects are dumped to a binary file which can then be imported into another Oracle database. These utilities can be used to move data between different machines, databases or schema. However, as they use a proprietary binary file format, they can only be used between Oracle databases. One cannot export data and expect to import it into a non-Oracle database. Various parameters are available to control what objects are exported or imported. To get a list of available parameters, run the exp or imp utilities with the help=yes parameter i.e. exp help=yes or imp help=yes. The export/import utilities are commonly used to perform the following tasks: Back up and recover objects. Perhaps the most widely used Export and Import feature is the capability to serve as a useful backup solution. Most Oracle installations use full online or hot backups to back up the entire database in the event of a CPU, network, or disk failure. This works well because all data can be restored to the very millisecond that the database crashed. However, Export and Import provide for extra safety. If just one table in the entire database needs to be recovered during a full backup, the entire database would have to be recovered on another machine, and the one table would be copied back over into the original database. This incredibly time- and resourceconsuming task could become a real headache in distributed databases. Export and Import can save you this trouble by exporting the entire database and importing just the tables that need to be recovered. Now that point-in-time recovery is an option for tablespaces in Oracle8, Export and Import can also serve as a backup and recovery mechanism for the entire database. Copy objects among schemas. You can use Export and Import to copy all object types such as tables, indexes, grants, procedures, and views from one schema to another. You can specify which objects you want to move, and provide the FROM and TO schemas. Oracle does the rest automatically. Copy objects among Oracle databases. You can export a table in one Oracle database and import that table into another. Many businesses export key tables and send the export files to a remote office location, which can then use Import to load the data into its local database. This is a form of one-way data replication to remote locations. Generate CREATE scripts. Export and Import contain powerful options that allow you to generate CREATE scripts for tables, partitions, indexes, object-type definitions, views, grants, constraints, rollback segments, tablespaces, and all other objects in the database. This safeguards the structure of your objects, in case one gets corrupted or deleted. Migrate databases from one Oracle version to another. You can upgrade (or downgrade) the version of Oracle by using the Export and Import utilities. For example, you can export an Oracle7 database, copy the export file to an Oracle8 database server, and then import into the Oracle8 server. This process, called migration, makes the data and application function in an Oracle8 environment. Of course, we always recommend complete testing before relying on the results of a migration. Defragment a tablespace. Fragmentation occurs when tables and indexes are created, dropped, enlarged, and reduced in size over time. Fragmentation also occurs when an objects storage parameters are sized improperly. To defragment a tablespace, you can export a tablespace, coalesce the free space (or drop and recreate the tablespace), and import the objects again. 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. SQL*Loader is similar to Import in that it can load data; the main difference is that Import can read only Oracle export files. SQL*Loader can read text files generated by nonOracle databases.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. While still supported on 10g the original import (imp) and export (exp) utilities were replaced in 10g with the faster and more advanced Data Pump-based import-export, impdp and expdp. NOTE: It is generally advised not to use exports as the only means of backing-up a database. Physical backup methods (for example, when you use RMAN) are normally much quicker and supports point in time based recovery (apply archivelogs after recovering a database). Also, exp/imp is not practical for large database environments. On 11g just imp will be still available, so if you using 10g, now is the time to starting using data pump.

Prerequisites/Requirements
exp and imp are utilities present in the $ORACLE_HOME/bin directory and are installed when Oracle is installed. Their prime purpose is to move logical objects out of and into the
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 1/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

database respectively for example dumping all of the tables owned by a user to a single file is achieved using the exp utility. It is important to distinguish between dumping data in this manner and backing up the database which is normally achieved using the rman utility. $ORACLE_HOME, $ORACLE_SID and $PATH environment variables need to be set appropriately in a unix environment and the %ORACLE_SID% environment variable needs to be set in a windows environment, before executing these commands. If you login as the owner of the oracle software (usually the oracle user on unix) these are likely to have been set in the users profile. The Oracle Database instance needs to be up in order to export/import data. Type imp help=y or exp help=y for a detailed explanation of the available options for these utilities. 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 In order to use exp and imp, the catexp.sql script must be run. catexp.sql basically creates the exp_full_database and imp_full_database roles. It is found under $ORACLE_HOME/rdbms/admin: SQL> @?/rdbms/admin/catexp catexp is called by catalog.sql. Note: SQL*Plus provides a shortcut to refer to the ORACLE_HOME directory: the question mark (?). One must have the create session privilege for being able to use exp. If objects of another users schema need to be exported, the EXP_FULL_DATABASE role is required. Before one imports rows into already populated tables, one needs to truncate or drop these tables to get rid of the old data. If not, the new data will be appended to the existing tables or itll get rejected. Either way, use the same syntax when you are ready to import the data. One must always DROP existing Sequences before re-importing. If the sequences are not dropped, they will generate numbers inconsistent with the rest of the database. Note: It is also advisable to drop indexes before importing to speed up the import process. Indexes can easily be recreated after the data was successfully imported. Control and Configure Export-Import FULL, OWNER, and TABLE are the three types of exports. A FULL export exports all objects, structures, and data within the database for all schemas. OWNER exports only those objects owned by the specified user accounts. TABLE exports only the specified tables and partitions for specific user accounts. Because dozens of object types can be exported, its important to distinguish what gets exported with each export category: With TABLE, the specified table (or cluster or partition) is exported with its indexes, referential integrity constraints, synonyms, and triggers. With OWNER specified, all the specified schemas objects are exported. This includes database links, sequences, packages/procedures/functions, object-type definitions, clusters/tables/partitions, postable actions, synonyms, views, triggers, snapshots/snapshot logs, job queues, and refresh groups. With the FULL option, all objects described in OWNER are exported for every user account, in addition to tablespace definitions, profiles, user definitions (and encrypted passwords), roles, resource costs, rollback segment definitions, directory aliases, user history table, and auditing options. You can use the Export and Import utilities in interactive or non-interactive mode. In interactive mode, Oracle steps you through the process, prompting for basic Import/Export session information. This method, however, limits you to the simple prompts that Oracle provides. You have more flexibility in non-interactive mode because you can supply up to 23 parameters for the Export utility and 24 parameters for the Import utility. The parameters may be supplied at the command line or by specifying a command file that contains all parameters and values. You can automate Export and Import sessions by using a command file, or repeat them over and over again manually. The syntax of running Export and Import is as follows: EXP KEYWORD=value or keyword=(value1,value2,,valueN) IMP KEYWORD=value or keyword=(value1,value2,,valueN) Replace KEYWORD with the parameter, and value with what should be the parameters value. For example, use the following to export the entire database: EXP USERID=SYSTEM/MANAGER FULL=Y Use the following to import the EMP and DEPT tables owned by the SCOTT user account: IMP USERID=SYSTEM/MANAGER FROMUSER=SCOTT TABLES= (EMP,DEPT)The following examples demonstrate how the imp/exp utilities can be used: exp scott/tiger file=emp.dmp log=emp.log tables=emp rows=yes indexes=no exp scott/tiger file=emp.dmp tables=(emp,dept) imp scott/tiger file=emp.dmp full=yes imp scott/tiger file=emp.dmp fromuser=scott touser=scott tables=dept Using a parameter file: exp userid=scott/tiger@orcl parfile=export.txt where export.txt contains: BUFFER=100000 FILE=account.dmp FULL=n OWNER=scott GRANTS=y COMPRESS=y NOTE: If you do not like command line utilities, you can import and export data with the Schema Manager GUI that ships with Oracle Enterprise Manager (OEM). 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 ORACLE database. You may assign other values than the defaults to the parameters but in most cases it is unnecessary. Controlled through bypassed parameters
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 2/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

You may bypass parameters when you export data from the database. Type: exp <userid/password> <parameter>=<value>,<parameter>=<value>, Example of exporting scotts 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 1 4r o w se x p o r t e d .e x p o r t i n gt a b l e D E P T 4r o w se x p o r t e d 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 . L i k eE x p o r tt h eI m p o r tu t i l i t yi sc o n t r o l l e db yp a r a m e t e r s .T og e tf a m i l i a rw i t ht h e s ep a r a m e t e r st y p e :i m ph e l p = y Y o uw i l lg e tas h o r td e s c r i p t i o no fu s a g ea n dd e f a u l ts e t t i n g so fp a r a m e t e r s . T os t a r tI M P O R Ts i m p l yt y p ei m p .Y o uw i l lb ep r o m p t e df o ry o u rO R A C L Eu s e r i d ,p a s s w o r d .T h en e x tp r o m p t sd e p e n do nw h a ty o ua n s w e r .I nm o s tc a s e s I m p o r tf i l e :e x p d a t . d m p> I fy o u rd a t aw a se x p o r t e dt of i l ee x p d a t . d m pp r e s sr e t u r n ,o t h e r w i s ee n t e rt h ef i l e n a m ew h e r et h ee x p o r t e dd a t ar e s i d e s . 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> T h i si saf l a gt oi n d i c a t eh o wo b j e c tc r e a t i o ne r r o r ss h o u l db eh a n d e l d .I fy o ui m p o r ti n t oa ne x i s t i n gt a b l ea n dy o us e tI G N O R E = Y ,r o w sc o u l db e 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 : I fy o u re x p o r t f i l ec o n s i s t so fm o r eo b j e c t st h a ny o uw a n tt oi m p o r t ,e n t e rn o .I nt h i sc a s ey o uw i l lb ep r o m p t e df o rt h eU s e r n a m e( t h i si sn o r m a l E n t e rt a b l en a m eo r.i fd o n e : A f t e re n t e r i n gt h eu s e r n a m ey o uw i l lb ep r o m p t e df o rt a b l en a m e su n t i ly o up r e s st h er e t u r nk e yw i t h o u te n t e r i n gat a b l en a m e .T h a nI M P O R Tw i l lb I n s t e a do ft h ed i a l o g u em e t h o dy o um a yu s ep a r a m e t e r s .T h i si sa n a l o g o u st ot h em e t h o d sd e s c r i b e df o rE X P O R T . E x a m p l e s : i m p< u s e r i d / p a s s w o r d >t a b l e s = ( t a b l e 1 , t a b l e 2 ) T a b l e st a b l e 1 ,t a b l e 2w i l lb ei m p o r t e df r o mt h ed e f a u l tf i l ee x p o r t . d m pi n t ot h ed a t a b a s e . i m p< u s e r i d / p a s s w o r d >p a r f i l e = < f i l e n a m e > I m p o r tw i l lb ec o n t r o l l e db yt h en a m e dp a r a m e t e r f i l e . A f t e ri m p o r t i n gy o us h o u l dg e tm e s s a g e sl i k e : 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 " 4r o w si m p o r t e d .i m p o r t i n gt a b l e" E M P " 1 4r o w si m p o r t e d 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 . -

Parameters for the Export utility Table below lists all parameters that can be used with the Export utility, along with their default values (if any). Parameter BUFFER Default Value Description OS-dependent The size of BUFFER (in bytes) determines the memory buffer through which rows are exported. This should be larger than the size of the largest record multiplied by the number of rows that you want to fit within the buffer. Y If COMPRESS=Y, the INITIAL storage parameter is set to the total size of all extents allocated for the object. The change takes effect only when the object is imported. N Setting CONSISTENT=Y exports all tables and references in a consistent state. This slows the export, as rollback space is used. If CONSISTENT=N and a record is modified during the export, the data will become inconsistent. N Specifies whether table constraints are exported. N If DIRECT=Y, Oracle bypasses the SQL commandprocessing layer, improving the speed of the export. Unfortunately, the new object types endemic to Oracle8, such as LOBs, dont get exported. 0 Oracle displays a period for each group of records inserted. FEEDBACK defines the size of the group. For example, if FEEDBACK=1000, a period will be displayed for every 1,000 records imported. This parameter is useful for tracking the progress of large imports. expdat.dmp By default, expdat.dmp (stands for EXPort DATa.DuMP) is the filename. For a more meaningful name, change the FILE parameter. N The entire database will be exported if FULL=Y, including tablespace definitions.
3/11

COMPRESS

CONSISTENT

CONSTRAINTS DIRECT

FEEDBACK

FILE

FULL

http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

GRANTS HELP INCTYPE

Y N

Specifies whether all grant definitions are exported for the objects being exported. No other parameters are needed if you specify HELP=Y. A basic help screen will appear. The valid options for this parameter are COMPLETE, CUMULATIVE, and INCREMENTAL. A COMPLETE export lays down a full export for which the other two options rely on for restores of the database. CUMULATIVE exports all tables and other objects that have changed since the last CUMULATIVE or COMPLETE export was taken; if one record in a table is altered, the entire table is exported. INCREMENTAL exports all tables and objects that have changed since the last INCREMENTAL, CUMULATIVE, or COMPLETE export.

How can you easily see the Export/Import parameters and syntax? If you dont have this book handy when necessary and havent memorized the dozens of parameters, the Export and Import utilities have a handy reference built in. Typing EXP HELP=Y or IMP HELP=Y at a command prompt brings up a nice one-page reference manual. Parameter INDEXES Default Value Y Description Specifies whether user-defined indexes are exported. System indexes created with constraints (primary key, unique key) and OID indexes are automatically exported, regardless of this parameters value. Specifies the name of the file to spool the feedback from the export session. Unless otherwise specified, Oracle appends a .LOG extension to the file. Rather than enter all parameters on the command line, some or all can be kept in a parameter file. This parameter specifies which file to use, if desired. This parameter is especially useful for non-interactive import sessions. Exports information for a point-in-time recovery for the tablespace listed with the TABLESPACES parameter. If you use the INCTYPE parameter with RECORD=Y, the SYS data dictionary tables INCEXP, INCFIL, and INCVID are populated with export data such as owner, type of export, and the time of export. The RECORDLENGTH parameter is used only when youll import on a machine with a different byte count of the file than on the machine where the export occurs. The default should be used in most import sessions. Used with POINT_IN_TIME_RECOVER;specifies which tablespaces can be recovered by using point-intime recovery. This is important because imports otherwise cant recover transactions past the time of export. Specifies whether table and object data will be exported. If ROWS=N, only object definitions are exported. Specifies whether table and index statistics are to be analyzed with COMPUTE or ESTIMATE when imported. Only those objects that already have statistics on them will be analyzed during import. Specify NONE if no objects should be analyzed. Specifies a comma-separated list of all tables to be exported. This parameter could be used with the OWNER parameter to specify which owner to associate the tables with. Tables can also be
4/11

LOG

PARFILE

POINT_IN_TIME_RECOVER N

RECORD

RECORDLENGTH

OSdependent

RECOVERY_TABLESPACES

ROWS

STATISTICS

ESTIMATE

TABLES

http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

specified with the owner.table_name format. In a non-UNIX environment such as Windows NT, you must enclose the table list within parentheses. TABLESPACES USERID List of tablespaces to be exported with the POINT_IN_TIME_RECOVER parameter. Specifies the username and password for the user conducting the import. The format for the command is username/password. You can also use Net8s @connect_string format if you want.

Parameters for the Import utility You can use 24 parameters during an import session. They may be specified in the command line or any specified parameter file. Table below lists all the import parameters. Parameter ANALYZE Default Value Description Y Imported tables have their statistics analyzed if ANALYZE is set to Y. Only those tables that already had statistics on them during the export are computed. The tables will be ESTIMATED by default, unless the export was performed with the STATISTICS=COMPUTE parameter configuration.

BUFFER

OS-dependent The BUFFER size (in bytes) determines the memory buffer through which rows are imported. This should be larger than the size of the largest record multiplied by the number of rows that you want to fit within the buffer. An obsolete Oracle6 parameter, indicating whether the export was done in ASCII or EBCDIC. This information is processed automatically in Oracle7 and Oracle8. N By default, a COMMIT occurs after each table, nested table, and partition. If youre importing a large table, the rollback segments may grow large. To improve performance while loading large tables, you should set COMMIT=Y. If you set DESTROY=Y and do a full import, Oracle will overwrite any data files that exist. If you use raw devices for your data files, they will be overwritten during a full import, as DESTROY=N wont prevent the overwriting of datafiles! Dont use this option unless you know what youre doing. Oracle displays a period for each group of records inserted. FEEDBACK defines the size of the group. For example, if FEEDBACK=1000, a period is displayed for every 1,000 records imported. This parameter is useful for tracking the progress of large imports.

CHARSET

COMMIT

DESTROY

FEEDBACK

Export/Import and non-Oracle databases The export file (expdat.dmp by default) is a binary file that only Oracle databases can read. Many databases and PC software can export data into delimited text files, but the Export utility cant. To transfer data from Oracle to a non-Oracle database, you must make a delimited file manually by spooling from within PL/SQL or SQL*Plus and running a custom-made script. Parameter FILE Default Value Description expdat.dmp By default, expdat.dmp (stands for EXPort DATa.DuMP) is the name of the file that Import will import from. If the file is something other than expdat.dmp, specify it with this parameter. Specifying this parameter imports only those objects owned by the FROMUSER user account. N The entire database will be imported if FULL=Y. Y Specifies whether all grants will be created for the exported objects. N No other parameters are needed if you specify HELP=Y. A basic help screen will appear. N If IGNORE=Y, object creation errors are ignored, and records are inserted into the table. Duplicate records can result, if no unique constraints exist for the table. Non-object creation errors are still reported, such as operating system problems.
5/11

FROMUSER FULL GRANTS HELP IGNORE

http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

INCTYPE

If youre importing an incremental export, tables are dropped and recreated. You must first restore from the last SYSTEM export (specify INCTYPE=SYSTEM). Then import every incremental export (specify INCTYPE=RESTORE) until the desired changes are applied to the database. Y Specifies whether user-defined indexes are imported. System indexes created with constraints (primary key, unique key) and OID indexes are automatically imported, regardless of this parameters value. Specifies the name of the file to generate CREATE INDEX statements. Unless otherwise specified, Oracle appends an .SQL extension to the file. (This parameter is explained in more detail later in this chapter.)

INDEXES

INDEXFILE

Using the LOG parameter You can specify a log file for the Export and Import sessions with the LOG parameter. The file, which mimics whats output to the screen, reports all successful and unsuccessful messages to be examined at a later point. Some Oracle experts use this file during an automated load process and then checks the file for errors. A database administrator is paged if any appear. Parameter LOG Default Value Description Specifies the name of the file to spool the feedback from the import session. Unless otherwise specified, Oracle appends an .LOG extension to the file. Rather than enter all parameters on the command line, some or all may be kept in a parameter file. The PARFILE parameter specifies which file to use, if desired. This parameter is especially useful for non-interactive import sessions. Performs a point-in-time recovery for the tablespace exported with the TABLESPACES parameter.

PARFILE

POINT_IN_TIME_RECOVER N

RECORDLENGTH

OS-dependent Used only when importing on a machine with a different byte count of the file than on the machine where the export occurred. The default should be used in most Import sessions. N Displays each SQL statement and doesnt apply them to the database. The SQL statements can be viewed and modified when used with the FILE parameter. (The SHOW parameter is explained in more detail later in this chapter.) Allows the postponement of index creation until the record data is imported. The indexes affected are only those set to an unusable state, and all other indexes are created if INDEXES=Y (the default value) is set. Specifies a comma-separated list of all tables to be imported. You should use this parameter with the FROMUSER parameter. In a non-UNIX environment, such as Windows NT, enclose the table list within parentheses. Specifies the user account into which tables should be imported, if you want it to be different from the original owner of the tables. This parameter needs to be used with the FROMUSER parameter. Specifies the username and password for the user conducting the import. The format for the command is username/password. You may also use Net8s @connect_string format if desired.

SHOW

SKIP_UNUSABLE_INDEXES N

TABLES

TOUSER

USERID

Using imp/exp across different Oracle version


If exp and imp are used to export data from an Oracle database with a different version than the database in which is imported, then the following rules apply: 1. exp must be of the lower version 2. imp must match the target version
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 6/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

Common Export/Import Errors ORA-00001: Unique constraint () violated You are importing duplicate rows. Use IGNORE=YES to skip tables that already exist (imp will give an error if the object is re-created) OR Perform the following actions: 1. Back up the target table. 2. Try deleting the target table. 3. Run the import for this table again in overwrite mode. ORA-01555: Snapshot too old Ask your users to STOP working while you are exporting or try using parameter CONSISTENT=NO ORA-01562: Failed to extend rollback segment Create bigger rollback segments or set parameter COMMIT=Y while importing IMP-00015: Statement failed object already exists Use the IGNORE=Y import parameter to ignore these errors, but be careful as you might end up with duplicate rows. To Improve performance Export Set the BUFFER parameter to a high value (e.g. 2Mb entered as an integer 2000000) Set the RECORDLENGTH parameter to a high value (e.g. 64Kb entered as an integer 64000) Use DIRECT=yes (direct mode export) Stop unnecessary applications to free-up resources for your job. If you run multiple export sessions, ensure they write to different physical disks. DO NOT export to an NFS mounted filesystem. It will take forever. Import Create an indexfile so that you can create indexes AFTER you have imported data. Do this by setting INDEXFILE to a filename and then import. No data will be imported but a file containing index definitions will be created. You must edit this file afterwards and supply the passwords for the schemas on all CONNECT statements. Place the file to be imported on a separate physical disk from the oracle data files Increase DB_CACHE_SIZE (DB_BLOCK_BUFFERS prior to 9i) considerably in the init$SID.ora file Set the LOG_BUFFER to a big value and restart oracle. Stop redo log archiving if it is running (ALTER DATABASE NOARCHIVELOG;) Create a BIG tablespace with a BIG rollback segment inside. Set all other rollback segments offline (except the SYSTEM rollback segment of course). The rollback segment must be as big as your biggest table (I think?) Use COMMIT=N in the import parameter file if you can afford it Use STATISTICS=NONE in the import parameter file to avoid time consuming to import the statistics Remember to run the indexfile previously created Good practices Always take care about CHARSETS when you do export and import. Using the wrong ones can convert your data in a lossy manner. The best situation is when your source and destination database have the same character sets, so you can avoid completely any character conversion. You control this behavior by setting NLS_LANG environment variable appropriately. When not set properly you may see Exporting questionable statistics messages. After doing an export, it is better to check your dump by doing an import with the parameter SHOW=Y. This checks the validity of your dump file. Other considerations You may need to patch your Oracle client (where you are running exp/imp) to the same level as the Oracle server to prevent errors When importing large amounts of data consider dropping indexes prior to the import to speed up the process and re-creating them once the import is completed The amount of archive logs that may be created on a large import may fill up your disk On INSERT triggers will fire, consider whether these need to be disabled Increasing the RECORDLENGTH (max 65535) parameter can improve the length of time to perform an import/export as well as DIRECT=y for export Tablespace fragmentation occurs when objects are created, dropped, enlarged, and shrunk. The more often this occurs, the more fragmented the tablespace becomes. This causes free space to be broken into many separated island-like chunks of space. In addition, if an object has multiple extents, they could be spread out over different parts of the tablespace; this causes performance and maintenance problems. With many small blocks of free space instead of fewer large free spaces, you may be unable to create some objects that you otherwise could have. By defragmenting the tablespace, the data is reorganized so that all free space is put into one contiguous area, and each objects extents are grouped next to each other. The Export and Import utilities can fix fragmentation in two ways: They can take a table with multiple extents and resize it into a table with one larger extent. This larger single extent will encompass the total size of all previous table extents. They can make all objects within the tablespace adjacent to each other with no island-like characteristics, while at the same time merging all the free space into one larger free space. The easiest and most dramatic method fixes both fragmentation problems for the entire database. The database is shut down during the process. This forces all sessions against the database to stop (which is why its the most dramatic method). Fixing a tables storage parameter is fairly easy compared to the entire tablespace, as only one table is affected. To fix an entire tablespace, youll have to drop and recreate it, along with all the tables within it. Fix both fragmentation problems quickly
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 7/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

Export the entire database, specifying F U L L = Yand C O M P R E S S = Y .F U L L = Yexports the entire database; C O M P R E S S = Ychanges the I N I T I A Lstorage parameter of each table in the database (if necessary) to fit within one extent each. For example, if a table has five 10M extents, the C O M P R E S S = Yspecification changes the table to one 50M extent when imported. Drop and recreate the entire database. Import the entire database with the F U L L = Yparameter. Defragment just one tablespace (a less dramatic method) Determine which tables exist in the tablespace and export just those tables. Drop all the tables in the tablespace. Issue the A L T E RT A B L E S P A C EC O A L E S C Ecommand (or drop and recreate the tablespace). This will coalesce all the free space within the tablespace into one contiguous area. Import the tables. Oracle will create the tables adjacent to each other within the tablespace, and all free space will still be contiguous in one chunk of space. Some more examples EXP To dump a single schema to disk (we use the scott example schema here) - Login to server which has an Oracle client exp <user>/<password> FILE=scott.dmp OWNER=scott To export specific tables to disk: Login to server which has an Oracle client exp SYSTEM/password FIlE=expdat.dmp TABLES=(scott.emp,hr.countries) The above command uses two users : scott and hr exp <user>/<password> FILE=scott.dmp TABLES=(emp,dept) the above is only for one user : scott IMP To import the full database exported in the example above. imp SYSTEM/password FULL=y FIlE=dba.dmp To import just the dept and emp tables from the scott schema imp SYSTEM/password FIlE=dba.dmp FROMUSER=scott TABLES=(dept,emp) To import tables and change the owner imp SYSTEM/password FROMUSER=blake TOUSER=scott FILE=blake.dmp TABLES=(unit,manager) To import just the scott schema exported in the example above: imp <user>/<password> FIlE=scott.dmp If you do not supply any parameters then you enter an interactive session as illustrated below. (Responses to prompts are shown in blue. from the prompt type imp and press enter $>imp Import: Release 9.2.0.6.0 Production on Thu Mar 29 15:07:43 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Username: SYSTEM Password: password Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.6.0 Production Import file: expdat.dmp > /mention/path/of/dumpFile/includingFileName.dmp Enter insert buffer size (minimum is 8192) 30720> (press enter to accept default) Export file created by EXPORT:V09.02.00 via conventional path import done in US7ASCII character set and AL16UTF16 NCHAR character set import server uses AL32UTF8 character set (possible charset conversion) List contents of import file only (yes/no): no > press enter Ignore create error due to object existence (yes/no): no > press enter Import grants (yes/no): yes > press enter Import table data (yes/no): yes > press enter Import entire export file (yes/no): no > press enter or type no Username: give the userName for which you want the data to be imported Enter table(T) or partition(T:P) names. Null list means all tables for user Enter table(T) or partition(T:P) name or . if done: press enter . importing TST_001_V2s objects into TST_001_V2 Leave a comment | Trackback Jun 23rd, 2009 | Posted by tushar | In Database Performance Tuning, Database programming, Oracle, Oracle Database, Oracle DBA, Oracle developers Installing RedHat Linux SQL*Plus Basic commands 1.
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 8/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

Ben Reply | Quote Sep 23rd, 2013 at 21:42 | #1 How do I imp to a remote server? I cant ftp to the server, only connection string for Oracle is provided. Thanks. 2. abc Reply | Quote Jul 2nd, 2013 at 23:54 | #2 I am suppose to import the export of full database every day to ensure data replication from one location to other. What is the command for that ?

tushar Reply | Quote Jul 3rd, 2013 at 06:09 | #3 You can FTP the dump through scheduled OS task and then import full DB using impdp full=y.. but make sure to specify TABLE_EXISTS_ACTION as REPLACE if you want to replace the complete contents of the tables, otherwise it will skip the existing tables. But please note that this will not affect existing procedures, functions, sequences etc. So best practice is to drop existing users and import full if that is possible for you. PS: Please do not use names like abc, xyz etc since this is serious Oracle forum and there is no need to hide identity. Regards, Tushar 3. Tomasa Reply | Quote Jan 1st, 2013 at 20:37 | #4 Whoa, this blog is magnificent i love reading your articles. Keep up the great work! You know, a lot of individuals are searching around for this information, you can aid them greatly. 4. Herlinda Reply | Quote Nov 20th, 2012 at 05:30 | #5 excellent issues altogether, you simply gained a emblem new reader. What could you recommend about your publish that you just made some days ago? Any certain? Show 2 trackbacks

Leave a comment
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Name * E-Mail * (will not be published) Website


Submit Comment

RSS for comments on this post


Search

Search this blog

Hot topics
Fusion Applications installation 11.1.7 Step by step guide Oracle 12c (12.1) RAC (Real Applications Cluster) installation on Linux Virtual Machines Step by step guide Fusion Applications installation 11.1.6 Step by step guide
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 9/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

Installing 11gR2 RAC on Linux x86-64 Virtual Machine Step by step installation guide Fusion Applications installation 11.1.5 Step by step guide Creating Oracle VirtualBox Virtual Machine with Oracle Linux Installing Oracle Applications (eBusiness Suite) Release 12 on Solaris Fix for IE crash on launching forms in Oracle Applications 11i (11.5.10) Fix for Internet explorer has closed this webpage to help protect your computer

Categories
Application server (21) Applications Performance Tuning (3) Browser issues (4) Cloning Oracle Applications (2) Concurrent manager (3) Database Performance Tuning (4) Database programming (4) eBusiness Suite R12 (1) Fusion Applications Provisioning (29) Fusion Middleware (19) HTTP Server (10) Identity Management (14) Installing Oracle Applications (24) Linux/Unix/Solaris (20) Oracle (63) Oracle Applications (41) Oracle Applications DBA (34) Oracle Applications issues (8) Oracle Database (19) Oracle Database cloning (2) Oracle DBA (27) Oracle developers (6) Oracle Fusion Applications (31) Oracle Fusion Applications installation (25) Oracle Internet Directory (11) Oracle PL/SQL (3) Oracle RAC (8) Oracle SQL (1) Repository Creation Utilitiy (7) Shell scripting (6) Uncategorized (56) Unix administration (9) VirtualBox (14) Virtualization (14) Webgate (10) Windows (5) Windows Clients (4) Windows issues (4)

Recent Posts
Coming soon: Step by step guide for Oracle Fusion Applications 11.1.8 installation Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server Oracle E-Business Suite R12.2 (12.2.3) plug and play downloadable Sandbox/Virtual Machine First Look at Oracle e-Business Suite 12.2.3 new user interface Recommended Browsers for Oracle E-Business Suite Release 12

Recent Comments
Anand Ranganathan on Provision an Applications Environment Anand Ranganathan on Provision an Applications Environment Anand Ranganathan on Provision an Applications Environment Anand Ranganathan on Provision an Applications Environment Anand Ranganathan on Provision an Applications Environment

Archives
March 2014 January 2014 December 2013 November 2013 October 2013 September 2013 August 2013
http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/ 10/11

3/23/2014

Oracle Export and Import utility tutorial | ORA Training Blog

July 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 September 2012 August 2012 April 2012 March 2012 February 2012 August 2010 May 2010 April 2010 December 2009 June 2009 April 2009 March 2009 Powered by WordPress | Theme by NeoEase | Valid XHTML 1.1 and CSS 3 Top

http://www.oratraining.com/blog/2009/06/oracle-export-import-utility-exp-imp-tutorial/

11/11

You might also like