DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Monday, August 31, 2015

Data Pump Parameter-REMAP_DATA



Data Pump Parameter-REMAP_DATA


EXPDP REMAP_DATA parameter is used to transform the column data to some other value using the database packages. Using this parameter you can translate or transform the critical informations like address, credit card number to some other values taking the export itself. This parameter can be used with import (IMPDP) utility also.

Using REMAP_DATA option data can be manipulated during the export and import job.

This feature can be used for protecting sensitive information during the export and import job.



SQL> select * from emp;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80             800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81        2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81      1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81      2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87         3000                    20
      7839 KING       PRESIDENT            17-NOV-81             5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81      1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87         1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81             950                    30
      7902 FORD       ANALYST         7566 03-DEC-81         3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82           1300                    10

14 rows selected.

SQL> create or replace package sal_pkg as  function sal_fun (sal  number)  return number;  end;
/

Package created.

SQL> create or replace package body sal_pkg as function sal_fun(sal in number) return number
as
sals number;
begin
sals :=sal+10;
return(sals);
end;
end;
/

Package body created.


[oracle@oracle11g ~]$ expdp test/tiger directory=test_dir dumpfile=test%U.dmp tables=emp remap_data=test.emp.sal:test.sal_pkg.sal_fun

Export: Release 11.2.0.3.0 - Production on Mon Aug 31 17:18:27 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "TEST"."SYS_EXPORT_TABLE_01":  test/******** directory=test_dir dumpfile=test%U.dmp tables=emp remap_data=test.emp.sal:test.sal_pkg.sal_fun
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "TEST"."EMP"                                8.578 KB      14 rows
Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for TEST.SYS_EXPORT_TABLE_01 is:
  /u01/dump/test01.dmp
Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 17:18:41


SQL> delete from emp;

14 rows deleted.

SQL> commit;



[oracle@oracle11g ~]$ impdp test/tiger tables=emp directory=test_dir dumpfile=test%U.dmp content=data_only

Import: Release 11.2.0.3.0 - Production on Mon Aug 31 19:10:40 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "TEST"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "TEST"."SYS_IMPORT_TABLE_01":  test/******** tables=emp directory=test_dir dumpfile=test%U.dmp content=data_only
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "TEST"."EMP"                                8.578 KB      14 rows
Job "TEST"."SYS_IMPORT_TABLE_01" successfully completed at 19:11:02



SQL> select sal from emp;

       SAL
----------
       810
      1610
      1260
      2985
      1260
      2860
      2460
      3010
      5010
      1510
      1110
       960
      3010
      1310