Code Snippet

Just another Code Snippet site

Random Post :




Generate Test Data

Generate User profile (Web or API) :
http://randomuser.me/

Generate full data file :
http://www.generatedata.com/

[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

, , ,

Previous Posts Next posts