Académique Documents
Professionnel Documents
Culture Documents
Contents
1 What is import/export and why does one need it? 2 How does one use the import/export utilities? 3 Can one export a subset of a table? 4 Can one monitor how fast a table is imported? 5 Can one import tables to a different tablespace? 6 Does one need to drop/ truncate objects before importing? 7 Can one import/export between different versions of Oracle? 8 Can one export to multiple files?/ Can one beat the Unix 2 Gig limit? 9 How can one improve Import/ Export performance? 10 What are the common Import/ Export problems?
Move data between Oracle databases on different platforms (for example from Solaris to Windows) Reorganization of data/ eliminate database fragmentation (export, drop and re-import tables) Upgrade databases from extremely old versions of Oracle (when in-place upgrades are not supported by the Database Upgrade Assistant any more) Detect database corruption. Ensure that all the data can be read Transporting tablespaces between databases Etc.
From Oracle 10g, users can choose between using the old imp/exp utilities, or the newly introduced Datapump utilities, called expdp and impdp. These new utilities introduce much needed performance improvements, network based exports and imports, etc.
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.
imp scott/tiger file=emp.dmp full=yes imp scott/tiger file=emp.dmp fromuser=scott touser=scott tables=dept
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).
select substr(sql_text,instr(sql_text,'INTO "'),30) table_name, rows_processed, round((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60,1) minutes, trunc(rows_processed/((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60)) rows_per from sys.v_$sqlarea where sql_text like 'INSERT %INTO "%' and command_type = 2 and open_versions > 0;
For this to work one needs to be on Oracle 7.3 or higher (7.2 might also be OK). If the import has more than one table, this statement will only show information about the current table being imported.
Method 2: Use the FEEDBACK=N import parameter. This parameter will tell IMP to display a dot for every N rows imported. For example, FEEDBACK=1000 will show a dot after every 1000 row.
Revoke the "UNLIMITED TABLESPACE" privilege from the user Revoke the user's quota from the tablespace from where the object was exported. This forces the import utility to create tables in the user's default tablespace. Make the tablespace to which you want to import the default tablespace for the user Import the table
Can one export to multiple files?/ Can one beat the Unix 2 Gig limit?
From Oracle8i, the export utility supports multiple output files. This feature enables large exports to be divided into files whose sizes will not exceed any operating system limits (FILESIZE= parameter). When importing from multi-file export you must provide the same filenames in the same sequence in the FILE= parameter. Look at this example:
exp SCOTT/TIGER FILE=D:F1.dmp,E:F2.dmp FILESIZE=10m LOG=scott.log
Use the following technique if you use an Oracle version prior to 8i: Create a compressed export on the fly. Depending on the type of data, you probably can export up to 10 gigabytes to a single file. This example uses gzip. It offers the best compression I know of, but you can also substitute it with zip, compress or whatever.
# create a named pipe mknod exp.pipe p # read the pipe - output to zip file in the background gzip < exp.pipe > scott.exp.gz & # feed the pipe exp userid=scott/tiger file=exp.pipe ...
In case of low-performance system, it is better to add RECORDLENGTH parameter with tiny value to ensure that gzip has enough time to extract data before imp reads it:
imp system/pwd@sid RECORDLENGTH=4096 file=imp_pipe log=imp_pipe.log ...
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). 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. Retrieved from "http://www.orafaq.com/wiki/Import_Export_FAQ" Category: Frequently Asked Questions This page was last modified on 5 May 2011, at 15:25. .:: Wiki Home :: Blogger Home :: Forum Home :: Contact :: Privacy ::.