#15
[Oracle] Import/Export as dump
As sys/sysdba :
CREATE OR REPLACE DIRECTORY tmp AS '/tmp'; GRANT READ, WRITE ON DIRECTORY tmp TO <user>; GRANT IMP_FULL_DATABASE to <user>;
Export :
expdp <user>/<password> directory=tmp dumpfile=export.dmp LOGFILE=export.log
Import :
impdp <user>/<password> directory=tmp dumpfile=export.dmp LOGFILE=import.log TABLE_EXISTS_ACTION=REPLACE
Export Options :
To change the export version :
VERSION={COMPATIBLE | LATEST | version_string}
version_string example : 10.2
Import Options :
To change destination tablespace add :
REMAP_TABLESPACE=<old_tablespace_name>:<new_tablespace_name>
(in this case, the following grant should be performed : grant imp_full_database to YOURUSER;)
In case of multi schema :
REMAP_TABLESPACE=(src1:dst1,src2:dst1,src3:dst1,src4:dst1)
To change destination schema add :
REMAP_SCHEMA=<source_schema>:<target_schema>
If tables already exist in the destination schema :
TABLE_EXISTS_ACTION={SKIP | APPEND | TRUNCATE | REPLACE}
Content could be excluded :
EXCLUDE=TABLE:\"like 'IMG_%%'\" EXCLUDE=TABLE:\"IN \(\'EMP\',\'DEPT\'\)\"
Add filter :
QUERY=CSIMESSAGE:\"where MODIFIEDON \< sysdate-90\"
To import only structure (no data)
CONTENT=METADATA_ONLY
Old fashion import :
imp <user>/<password> file=data.dmp log=imp.log full=yes BUFFER=100000 COMMIT=Y FEEDBACK=50000
Selenium Hub/Grid shell scripts [Find] How-to
To generate SQL file based on dump file :
Impdb as sysdba :
to speed up impdp, we can do parallelism :
Oracle recommends setting “parallel” equal to cpu_count*2 and to tune the parallelism from there.
for large import, increase the “next extent” to avoid lot of IO operations
Usefull SQL to see impdp status :
See current wait :
See current operation :
ORA-31626: job does not exist
ORA-31633: unable to create master table “XXX.SYS_EXPORT_FULL_05”
ORA-06512: at “SYS.DBMS_SYS_ERROR”, line 95
ORA-06512: at “SYS.KUPV$FT”, line 863
ORA-01031: insufficient privileges