행위

"Oracle 데이터펌프"의 두 판 사이의 차이

DB CAFE

(새 문서: Oracle Data Pump (expdp, impdp) in Oracle Database 10g, 11g, 12c, 18c Oracle Data Pump is a newer, faster and more flexible alternative to the "exp" and "imp" utilities used in previo...)
 
 
(사용자 3명의 중간 판 131개는 보이지 않습니다)
1번째 줄: 1번째 줄:
Oracle Data Pump (expdp, impdp) in Oracle Database 10g, 11g, 12c, 18c
+
{{틀:고지상자
Oracle Data Pump is a newer, faster and more flexible alternative to the "exp" and "imp" utilities used in previous Oracle versions. In addition to basic import and export functionality data pump provides a PL/SQL API and support for external tables.
+
|제목=* 데이터 펌프(DATAPUMP) 사용 절차
 +
|내용=1) '''사용자 생성'''
 +
<source  lang=sql>
 +
SQL> create user new_scott identified by tiger;
 +
</source>
  
This article was originally written against Oracle 10g, but the information is still relevant up to and including the latest versions of Oracle. New features are broken out into separate articles, but the help section at the bottom is up to date with the latest versions.
 
  
Getting Started
+
2) '''권한 추가'''
Table Exports/Imports
+
<source  lang=sql>
Schema Exports/Imports
+
SQL> grant connect, resource to new_scott;
Database Exports/Imports
+
</source>
INCLUDE and EXCLUDE
 
CONTENT and QUERY
 
Network Exports/Imports (NETWORK_LINK)
 
Flashback Exports
 
Miscellaneous Information
 
Data Pump API
 
External Tables (Unloading/Loading Data Using External Tables)
 
Secure External Password Store
 
Help
 
expdp
 
impdp
 
Related articles.
 
  
Data Pump Enhancements in Oracle Database 11g Release 1 (expdp and impdp)
 
Data Pump Enhancements in Oracle Database 12c Release 1 (expdp and impdp)
 
Data Pump Enhancements in Oracle Database 12c Release 2 (expdp and impdp)
 
SQL Developer 3.1 Data Pump Wizards (expdp, impdp)
 
Transportable Tablespaces
 
Oracle Cloud : Autonomous Data Warehouse (ADW) - Import Data from an Object Store (impdp)
 
Getting Started
 
For the examples to work we must first unlock the SCOTT account and create a directory object it can access. The directory object is only a pointer to a physical directory, creating it does not actually create the physical directory on the file system of the database server.
 
  
CONN / AS SYSDBA
+
3) '''디렉토리 권한 추가'''
ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;
+
<source  lang=sql>
 +
SQL> grant read, write on directory MY_DMP_DIR to new_scott;
 +
Grant succeeded.
 +
</source>
  
CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
 
GRANT READ, WRITE ON DIRECTORY test_dir TO scott;
 
Existing directories can be queried using the ALL_DIRECTORIES view.
 
  
  Data Pump is a server-based technology, so it typically deals with directory objects pointing to physical directories on the database server. It does not write to the local file system on your client PC.
+
4) '''디비링크 생성권한'''(DBLINK 이용시)
 +
<source lang=sql>
 +
SQL> grant create database link to new_scott;
 +
SQL> connect new_scott/tiger
 +
SQL> create database link OLD_DB connect to scott identified by tiger  using 'olddb.krenger.ch';
 +
</source>
  
Table Exports/Imports
+
5) '''디비링크 생성후 impdp  수행'''
The TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax.
+
* 스키마를 변경(scott-> new_scott) 하여 import
 +
<source  lang=sql>
 +
impdp new_scott/tiger directory=MY_DMP_DIR LOGFILE=dblink_transfer.log network_link=OLD_DB remap_schema=scott:new_scott
 +
</source>
 +
}}
  
expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log
 
  
impdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log
+
----
For example output files see expdpEMP_DEPT.log and impdpEMP_DEPT.log.
+
{{:IMPORT DP}}
 +
----
  
The TABLE_EXISTS_ACTION=APPEND parameter allows data to be imported into existing tables.
+
{{:EXPORT DP}}
  
Schema Exports/Imports
+
----
The OWNER parameter of exp has been replaced by the SCHEMAS parameter which is used to specify the schemas to be exported. The following is an example of the schema export and import syntax.
 
  
expdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
+
== 데이터펌프 작업 관리 및 모니터링 ==
 +
{{틀:고지상자
 +
|제목= : 주요사항
 +
|내용=현재 작업중인 datapump 작업들의 내용을 dba_datapump_jobs 딕셔너리를 통해 확인 가능
 +
}}
  
impdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=impdpSCOTT.log
 
For example output files see expdpSCOTT.log and impdpSCOTT.log.
 
  
Database Exports/Imports
+
<source lang=sql>
The FULL parameter indicates that a complete database export is required. The following is an example of the full database export and import syntax.
+
SELECT owner_name, job_name, operation, job_mode, state
 +
  FROM dba_datapump_jobs;
 +
</source>
 +
<source lang=sql>
 +
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_min
 +
from sys.v_$sqlarea
 +
where sql_text like 'INSERT %INTO "%'
 +
and command_type = 2
 +
and open_versions > 0;
 +
</source>
  
expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log
+
=== Datapump 작업 진행사항 ===
  
impdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=impdpDB10G.log
+
<source lang=sql>
For an example output file see expdpDB10G.log.
+
SELECT X.JOB_NAME
 +
    , B.STATE
 +
    , B.JOB_MODE
 +
    , B.DEGREE
 +
    , X.OWNER_NAME
 +
    , Z.SQL_TEXT
 +
    , P.MESSAGE
 +
    , P.TOTALWORK
 +
    , P.SOFAR
 +
    , ROUND ( (P.SOFAR / P.TOTALWORK) * 100, 2) DONE
 +
    , P.TIME_REMAINING
 +
  FROM DBA_DATAPUMP_JOBS B
 +
  LEFT JOIN DBA_DATAPUMP_SESSIONS X ON (X.JOB_NAME = B.JOB_NAME)
 +
  LEFT JOIN V$SESSION Y ON (Y.SADDR = X.SADDR)
 +
  LEFT JOIN V$SQL Z ON (Y.SQL_ID = Z.SQL_ID)
 +
  LEFT JOIN V$SESSION_LONGOPS P ON (P.SQL_ID = Y.SQL_ID)
 +
-- WHERE Y.MODULE = 'Data Pump Worker' AND P.TIME_REMAINING > 0
 +
;
 +
</source>
  
INCLUDE and EXCLUDE
+
== 데이터펌프(DATAPUMP) JOB 중지 ==
The INCLUDE and EXCLUDE parameters can be used to limit the export/import to specific objects. When the INCLUDE parameter is used, only those objects specified by it will be included in the export/import. When the EXCLUDE parameter is used, all objects except those specified by it will be included in the export/import. The two parameters are mutually exclusive, so use the parameter that requires the least entries to give you the result you require. The basic syntax for both parameters is the same.
+
<source lang=sql>
 +
SELECT * FROM DBA_DATAPUMP_JOBS;
 +
</source>
 +
=== IMPDP ATTACH=JOB 접속 후 ===
 +
<source lang=sql>
 +
$>IMPDP SCOTT/TIGER@DB ATTACH=JOB명
 +
KILL_JOB
 +
STOP_JOB #STOP_JOB = IMMEDIATE 즉시 종료
 +
</source>
  
INCLUDE=object_type[:name_clause] [, ...]
+
=== API 이용 정지 ===
EXCLUDE=object_type[:name_clause] [, ...]
+
* 주의) 즉시 정지 하지 않음
The following code shows how they can be used as command line parameters.
 
  
expdp scott/tiger@db10g schemas=SCOTT include=TABLE:"IN ('EMP', 'DEPT')" directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
+
<source lang=sql>
 
 
expdp scott/tiger@db10g schemas=SCOTT exclude=TABLE:"= 'BONUS'" directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
 
If the parameter is used from the command line, depending on your OS, the special characters in the clause may need to be escaped, as follows. Because of this, it is easier to use a parameter file.
 
 
 
include=TABLE:\"IN (\'EMP\', \'DEPT\')\"
 
A single import/export can include multiple references to the parameters, so to export tables, views and some packages we could use either of the following approaches.
 
 
 
INCLUDE=TABLE,VIEW,PACKAGE:"LIKE '%API'"
 
 
 
or
 
 
 
INCLUDE=TABLE
 
INCLUDE=VIEW
 
INCLUDE=PACKAGE:"LIKE '%API'"
 
Multiple objects can be targeted in once statement using the LIKE and IN operators.
 
 
 
EXCLUDE=SCHEMA:"LIKE 'SYS%'"
 
 
 
EXCLUDE=SCHEMA:"IN ('OUTLN','SYSTEM','SYSMAN','FLOWS_FILES','APEX_030200','APEX_PUBLIC_USER','ANONYMOUS')"
 
The valid object type paths that can be included or excluded can be displayed using the DATABASE_EXPORT_OBJECTS, SCHEMA_EXPORT_OBJECTS, and TABLE_EXPORT_OBJECTS views.
 
 
 
CONTENT and QUERY
 
The CONTENT parameter allows you to alter the contents of the export. The following command uses the METADATA_ONLY parameter value to export the contents of the schema without the data.
 
 
 
expdp system/password@db10g schemas=SCOTT directory=TEST_DIR dumpfile=scott_meta.dmp logfile=expdp.log content=METADATA_ONLY
 
To capture the data without the metadata use the DATA_ONLY parameter value.
 
 
 
expdp system/password@db10g schemas=SCOTT directory=TEST_DIR dumpfile=scott_data.dmp logfile=expdp.log content=DATA_ONLY
 
The QUERY parameter allows you to alter the rows exported from one or more tables. The following example does a full database export, but doesn't include the data for the EMP and DEPT tables.
 
 
 
expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=full.dmp logfile=expdp_full.log query='SCOTT.EMP:"WHERE deptno=0",SCOTT.DEPT:"WHERE deptno=0"'
 
The way you handle quotes on the command line will vary depending on what you are trying to achieve. Here are some examples that work for single tables and multiple tables directly from the command line.
 
 
 
# Single Table. Multiple quoting methods possible.
 
expdp scott/tiger@pdb1 schemas=scott directory=TEST_DIR dumpfile=scott1.dmp logfile=scott1.log query=SCOTT.EMP:'"WHERE deptno=10"'
 
expdp scott/tiger@pdb1 schemas=scott directory=TEST_DIR dumpfile=scott2.dmp logfile=scott2.log query=SCOTT.EMP:\"WHERE deptno=10\"
 
expdp scott/tiger@pdb1 schemas=scott directory=TEST_DIR dumpfile=scott3.dmp logfile=scott3.log query='SCOTT.EMP:"WHERE deptno=10"'
 
 
 
# Multiple WHERE clause on each table.
 
expdp scott/tiger@pdb1 schemas=scott directory=TEST_DIR dumpfile=scott4.dmp logfile=scott4.log query='SCOTT.EMP:"WHERE deptno=10",SCOTT.DEPT:"WHERE deptno=20"'
 
Network Exports/Imports (NETWORK_LINK)
 
The NETWORK_LINK parameter identifies a database link to be used as the source for a network export/import. The following database link will be used to demonstrate its use.
 
 
 
CONN / AS SYSDBA
 
GRANT CREATE DATABASE LINK TO test;
 
 
 
CONN test/test
 
CREATE DATABASE LINK remote_scott CONNECT TO scott IDENTIFIED BY tiger USING 'DEV';
 
In the case of exports, the NETWORK_LINK parameter identifies the database link pointing to the source server. The objects are exported from the source server in the normal manner, but written to a directory object on the local server, rather than one on the source server. Both the local and remote users require the EXP_FULL_DATABASE role granted to them.
 
 
 
expdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR dumpfile=EMP.dmp logfile=expdpEMP.log
 
For imports, the NETWORK_LINK parameter also identifies the database link pointing to the source server. The difference here is the objects are imported directly from the source into the local server without being written to a dump file. Although there is no need for a DUMPFILE parameter, a directory object is still required for the logs associated with the operation. Both the local and remote users require the IMP_FULL_DATABASE role granted to them.
 
 
 
impdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR logfile=impdpSCOTT.log remap_schema=SCOTT:TEST
 
Flashback Exports
 
The exp utility used the CONSISTENT=Y parameter to indicate the export should be consistent to a point in time. By default the expdp utility exports are only consistent on a per table basis. If you want all tables in the export to be consistent to the same point in time, you need to use the FLASHBACK_SCN or FLASHBACK_TIME parameter.
 
 
 
The FLASHBACK_TIME parameter value is converted to the approximate SCN for the specified time.
 
 
 
expdp ..... flashback_time=systimestamp
 
 
 
# In parameter file.
 
flashback_time="to_timestamp('09-05-2011 09:00:00', 'DD-MM-YYYY HH24:MI:SS')"
 
 
 
# Escaped on command line.
 
expdp ..... flashback_time=\"to_timestamp\(\'09-05-2011 09:00:00\', \'DD-MM-YYYY HH24:MI:SS\'\)\"
 
Not surprisingly, you can make exports consistent to an earlier point in time by specifying an earlier time or SCN, provided you have enough UNDO space to keep a read consistent view of the data during the export operation.
 
 
 
If you prefer to use the SCN, you can retrieve the current SCN using one of the following queries.
 
 
 
SELECT current_scn FROM v$database;
 
SELECT DBMS_FLASHBACK.get_system_change_number FROM dual;
 
SELECT TIMESTAMP_TO_SCN(SYSTIMESTAMP) FROM dual;
 
That SCN is then used with the FLASHBACK_SCN parameter.
 
 
 
expdp ..... flashback_scn=5474280
 
The following queries may prove useful for converting between timestamps and SCNs.
 
 
 
SELECT TIMESTAMP_TO_SCN(SYSTIMESTAMP) FROM dual;
 
SELECT SCN_TO_TIMESTAMP(5474751) FROM dual;
 
In 11.2, the introduction of legacy mode means that you can use the CONSISTENT=Y parameter with the expdp utility if you wish.
 
 
 
Miscellaneous Information
 
Unlike the original exp and imp utilities all data pump ".dmp" and ".log" files are created on the Oracle server, not the client machine.
 
 
 
All data pump actions are performed by multiple jobs (server processes not DBMS_JOB jobs). These jobs are controlled by a master control process which uses Advanced Queuing. At runtime an advanced queue table, named after the job name, is created and used by the master control process. The table is dropped on completion of the data pump job. The job and the advanced queue can be named using the JOB_NAME parameter. Cancelling the client process does not stop the associated data pump job. Issuing "ctrl+c" on the client during a job stops the client output and presents a command prompt. Typing "status" at this prompt allows you to monitor the current job.
 
 
 
Export> status
 
 
 
Job: SYS_EXPORT_FULL_01
 
  Operation: EXPORT
 
  Mode: FULL
 
  State: EXECUTING
 
  Bytes Processed: 0
 
  Current Parallelism: 1
 
  Job Error Count: 0
 
  Dump File: D:\TEMP\DB10G.DMP
 
    bytes written: 4,096
 
 
 
Worker 1 Status:
 
  State: EXECUTING
 
  Object Schema: SYSMAN
 
  Object Name: MGMT_CONTAINER_CRED_ARRAY
 
  Object Type: DATABASE_EXPORT/SCHEMA/TYPE/TYPE_SPEC
 
  Completed Objects: 261
 
  Total Objects: 261
 
Data pump performance can be improved by using the PARALLEL parameter. This should be used in conjunction with the "%U" wildcard in the DUMPFILE parameter to allow multiple dumpfiles to be created or read. The same wildcard can be used during the import to allow you to reference multiple files.
 
 
 
expdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR parallel=4 dumpfile=SCOTT_%U.dmp logfile=expdpSCOTT.log
 
 
 
impdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR parallel=4 dumpfile=SCOTT_%U.dmp logfile=impdpSCOTT.log
 
The DBA_DATAPUMP_JOBS view can be used to monitor the current jobs.
 
 
 
system@db10g> select * from dba_datapump_jobs;
 
 
 
OWNER_NAME                    JOB_NAME                      OPERATION
 
------------------------------ ------------------------------ ------------------------------
 
JOB_MODE                      STATE                              DEGREE ATTACHED_SESSIONS
 
------------------------------ ------------------------------ ---------- -----------------
 
SYSTEM                        SYS_EXPORT_FULL_01            EXPORT
 
FULL                          EXECUTING                              1                1
 
Data Pump API
 
 
 
 
Along with the data pump utilities Oracle provide an PL/SQL API. The following is an example of how this API can be used to perform a schema export.
 
 
 
SET SERVEROUTPUT ON SIZE 1000000
 
 
DECLARE
 
DECLARE
  l_dp_handle      NUMBER;
+
h1 NUMBER;
  l_last_job_state  VARCHAR2(30) := 'UNDEFINED';
 
  l_job_state      VARCHAR2(30) := 'UNDEFINED';
 
  l_sts            KU$_STATUS;
 
 
BEGIN
 
BEGIN
  l_dp_handle := DBMS_DATAPUMP.open(
+
h1:=DBMS_DATAPUMP.ATTACH(JOB_NAME => '"MIG_CHANGED_TABLE"', JOB_OWNER => 'RTIS_MIG');
    operation  => 'EXPORT',
+
DBMS_DATAPUMP.STOP_JOB(h1,1,0);
    job_mode    => 'SCHEMA',
+
END;
    remote_link => NULL,
+
</source>
    job_name    => 'EMP_EXPORT',
 
    version    => 'LATEST');
 
  
  DBMS_DATAPUMP.add_file(
+
{{:Oracle 데이터펌프 API활용}}
    handle    => l_dp_handle,
 
    filename  => 'SCOTT.dmp',
 
    directory => 'TEST_DIR');
 
  
  DBMS_DATAPUMP.add_file(
+
== DB LINK를 이용한 파일 복사 ==
    handle    => l_dp_handle,
+
<source lang=sql>
    filename  => 'SCOTT.log',
+
BEGIN
    directory => 'TEST_DIR',
+
DBMS_FILE_TRANSFER.PUT_FILE(
    filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
+
source_directory_object      => 'DATA_PUMP_DIR',
 
+
source_file_name              => 'sample.dmp',
  DBMS_DATAPUMP.metadata_filter(
+
destination_directory_object => 'DATA_PUMP_DIR',
    handle => l_dp_handle,
+
destination_file_name        => 'sample_copied.dmp',  
    name  => 'SCHEMA_EXPR',
+
destination_database          => 'to_rds'  
    value  => '= ''SCOTT''');
+
);
 
 
  DBMS_DATAPUMP.start_job(l_dp_handle);
 
 
 
  DBMS_DATAPUMP.detach(l_dp_handle);
 
 
END;
 
END;
/
+
/  
Once the job has started the status can be checked using.
+
</source>
 
+
[[Category:oracle]]
system@db10g> select * from dba_datapump_jobs;
 
External Tables (Unloading/Loading Data Using External Tables)
 
Oracle have incorporated support for data pump technology into external tables. The ORACLE_DATAPUMP access driver can be used to unload data to data pump export files and subsequently reload it. The unload of data occurs when the external table is created using the "AS" clause.
 
 
 
CREATE TABLE emp_xt
 
  ORGANIZATION EXTERNAL
 
  (
 
    TYPE ORACLE_DATAPUMP
 
    DEFAULT DIRECTORY test_dir
 
    LOCATION ('emp_xt.dmp')
 
  )
 
  AS SELECT * FROM emp;
 
The data can then be queried using the following.
 
 
 
SELECT * FROM emp_xt;
 
The syntax to create the external table pointing to an existing file is similar, but without the "AS" clause. In this case we will do it the same schema, but this could be in a different schema in the same instance, or in an entirely different instance.
 
 
 
DROP TABLE emp_xt;
 
 
 
CREATE TABLE emp_xt (
 
  EMPNO    NUMBER(4),
 
  ENAME    VARCHAR2(10),
 
  JOB      VARCHAR2(9),
 
  MGR      NUMBER(4),
 
  HIREDATE  DATE,
 
  SAL      NUMBER(7,2),
 
  COMM      NUMBER(7,2),
 
  DEPTNO    NUMBER(2))
 
  ORGANIZATION EXTERNAL (
 
    TYPE ORACLE_DATAPUMP
 
    DEFAULT DIRECTORY test_dir
 
    LOCATION ('emp_xt.dmp')
 
  );
 
 
 
SELECT * FROM emp_xt;
 
Creating an external table using the ORACLE_DATAPUMP access driver is restricted to dump files created by the external table unload.
 
 
 
Secure External Password Store
 
You can also use the secure external password store to provide credentials for data pump.
 
 
 
$ expdp /@db10g_test tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log
 
Help
 
The HELP=Y option displays the available parameters.
 
 
 
expdp
 
expdp help=y
 
 
 
Export: Release 10.1.0.2.0 - Production on Tuesday, 23 March, 2004 8:33
 
 
 
Copyright (c) 2003, Oracle.  All rights reserved.
 
 
 
 
 
The Data Pump export utility provides a mechanism for transferring data objects
 
between Oracle databases. The utility is invoked with the following command:
 
 
 
  Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
 
 
 
You can control how Export runs by entering the 'expdp' command followed
 
by various parameters. To specify parameters, you use keywords:
 
 
 
  Format:  expdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
 
  Example: expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott
 
              or TABLES=(T1:P1,T1:P2), if T1 is partitioned table
 
 
 
USERID must be the first parameter on the command line.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
ATTACH                Attach to existing job, e.g. ATTACH [=job name].
 
CONTENT              Specifies data to unload where the valid keywords are:
 
                      (ALL), DATA_ONLY, and METADATA_ONLY.
 
DIRECTORY            Directory object to be used for dumpfiles and logfiles.
 
DUMPFILE              List of destination dump files (expdat.dmp),
 
                      e.g. DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.
 
ESTIMATE              Calculate job estimates where the valid keywords are:
 
                      (BLOCKS) and STATISTICS.
 
ESTIMATE_ONLY        Calculate job estimates without performing the export.
 
EXCLUDE              Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.
 
FILESIZE              Specify the size of each dumpfile in units of bytes.
 
FLASHBACK_SCN        SCN used to set session snapshot back to.
 
FLASHBACK_TIME        Time used to get the SCN closest to the specified time.
 
FULL                  Export entire database (N).
 
HELP                  Display Help messages (N).
 
INCLUDE              Include specific object types, e.g. INCLUDE=TABLE_DATA.
 
JOB_NAME              Name of export job to create.
 
LOGFILE              Log file name (export.log).
 
NETWORK_LINK          Name of remote database link to the source system.
 
NOLOGFILE            Do not write logfile (N).
 
PARALLEL              Change the number of active workers for current job.
 
PARFILE              Specify parameter file.
 
QUERY                Predicate clause used to export a subset of a table.
 
SCHEMAS              List of schemas to export (login schema).
 
STATUS                Frequency (secs) job status is to be monitored where
 
                      the default (0) will show new status when available.
 
TABLES                Identifies a list of tables to export - one schema only.
 
TABLESPACES          Identifies a list of tablespaces to export.
 
TRANSPORT_FULL_CHECK  Verify storage segments of all tables (N).
 
TRANSPORT_TABLESPACES List of tablespaces from which metadata will be unloaded.
 
VERSION              Version of objects to export where valid keywords are:
 
                      (COMPATIBLE), LATEST, or any valid database version.
 
 
 
The following commands are valid while in interactive mode.
 
Note: abbreviations are allowed
 
 
 
Command              Description
 
------------------------------------------------------------------------------
 
ADD_FILE              Add dumpfile to dumpfile set.
 
                      ADD_FILE=dumpfile-name
 
CONTINUE_CLIENT      Return to logging mode. Job will be re-started if idle.
 
EXIT_CLIENT          Quit client session and leave job running.
 
HELP                  Summarize interactive commands.
 
KILL_JOB              Detach and delete job.
 
PARALLEL              Change the number of active workers for current job.
 
                      PARALLEL=.
 
START_JOB            Start/resume current job.
 
STATUS                Frequency (secs) job status is to be monitored where
 
                      the default (0) will show new status when available.
 
                      STATUS=[interval]
 
STOP_JOB              Orderly shutdown of job execution and exits the client.
 
                      STOP_JOB=IMMEDIATE performs an immediate shutdown of the
 
                      Data Pump job.
 
Oracle 10g Release 2 (10.2) added the following parameters.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
COMPRESSION          Reduce size of dumpfile contents where valid
 
                      keyword values are: (METADATA_ONLY) and NONE.
 
ENCRYPTION_PASSWORD  Password key for creating encrypted column data.
 
SAMPLE                Percentage of data to be exported;
 
 
 
The following commands are valid while in interactive mode.
 
Note: abbreviations are allowed
 
 
 
Command              Description
 
------------------------------------------------------------------------------
 
FILESIZE              Default filesize (bytes) for subsequent ADD_FILE commands.
 
Oracle 11g Release 1 (11.1) added the following parameters.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
DATA_OPTIONS          Data layer flags where the only valid value is:
 
                      XML_CLOBS-write XML datatype in CLOB format
 
ENCRYPTION            Encrypt part or all of the dump file where valid keyword
 
                      values are: ALL, DATA_ONLY, METADATA_ONLY,
 
                      ENCRYPTED_COLUMNS_ONLY, or NONE.
 
ENCRYPTION_ALGORITHM  Specify how encryption should be done where valid
 
                      keyword values are: (AES128), AES192, and AES256.
 
ENCRYPTION_MODE      Method of generating encryption key where valid keyword
 
                      values are: DUAL, PASSWORD, and (TRANSPARENT).
 
REMAP_DATA            Specify a data conversion function,
 
                      e.g. REMAP_DATA=EMP.EMPNO:REMAPPKG.EMPNO.
 
REUSE_DUMPFILES      Overwrite destination dump file if it exists (N).
 
TRANSPORTABLE        Specify whether transportable method can be used where
 
                      valid keyword values are: ALWAYS, (NEVER).
 
 
 
The following commands are valid while in interactive mode.
 
Note: abbreviations are allowed
 
 
 
Command              Description
 
------------------------------------------------------------------------------
 
REUSE_DUMPFILES      Overwrite destination dump file if it exists (N).
 
Oracle 11g Release 2 (11.2) altered the format of the help output as well as adding the following parameters.
 
 
 
CLUSTER
 
Utilize cluster resources and distribute workers across the Oracle RAC.
 
Valid keyword values are: [Y] and N.
 
 
 
SERVICE_NAME
 
Name of an active Service and associated resource group to constrain Oracle RAC resources.
 
 
 
SOURCE_EDITION
 
Edition to be used for extracting metadata.
 
Oracle 12c Release 1 (12.1) added the following parameters.
 
 
 
ABORT_STEP
 
Stop the job after it is initialized or at the indicated object.
 
Valid values are -1 or N where N is zero or greater.
 
N corresponds to the object's process order number in the master table.
 
 
 
ACCESS_METHOD
 
Instructs Export to use a particular method to unload data.
 
Valid keyword values are: [AUTOMATIC], DIRECT_PATH and EXTERNAL_TABLE.
 
 
 
COMPRESSION_ALGORITHM
 
Specify the compression algorithm that should be used.
 
Valid keyword values are: [BASIC], LOW, MEDIUM and HIGH.
 
 
 
ENCRYPTION_PWD_PROMPT
 
Specifies whether to prompt for the encryption password.
 
Terminal echo will be suppressed while standard input is read.
 
 
 
KEEP_MASTER
 
Retain the master table after an export job that completes successfully [NO].
 
 
 
MASTER_ONLY
 
Import just the master table and then stop the job [NO].
 
 
 
METRICS
 
Report additional job information to the export log file [NO].
 
 
 
VIEWS_AS_TABLES
 
Identifies one or more views to be exported as tables.
 
For example, VIEWS_AS_TABLES=HR.EMP_DETAILS_VIEW.
 
Oracle 12c Release 2 (12.2) added the following parameters.
 
 
 
STOP_WORKER
 
Stops a hung or stuck worker.
 
 
 
TRACE
 
Set trace/debug flags for the current job.
 
impdp
 
impdp help=y
 
 
 
Import: Release 10.1.0.2.0 - Production on Saturday, 11 September, 2004 17:22
 
 
 
Copyright (c) 2003, Oracle.  All rights reserved.
 
 
 
 
 
The Data Pump Import utility provides a mechanism for transferring data objects
 
between Oracle databases. The utility is invoked with the following command:
 
 
 
    Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
 
 
 
You can control how Import runs by entering the 'impdp' command followed
 
by various parameters. To specify parameters, you use keywords:
 
 
 
    Format:  impdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
 
    Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
 
 
 
USERID must be the first parameter on the command line.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
ATTACH                Attach to existing job, e.g. ATTACH [=job name].
 
CONTENT              Specifies data to load where the valid keywords are:
 
                      (ALL), DATA_ONLY, and METADATA_ONLY.
 
DIRECTORY            Directory object to be used for dump, log, and sql files.
 
DUMPFILE              List of dumpfiles to import from (expdat.dmp),
 
                      e.g. DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.
 
ESTIMATE              Calculate job estimates where the valid keywords are:
 
                      (BLOCKS) and STATISTICS.
 
EXCLUDE              Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.
 
FLASHBACK_SCN        SCN used to set session snapshot back to.
 
FLASHBACK_TIME        Time used to get the SCN closest to the specified time.
 
FULL                  Import everything from source (Y).
 
HELP                  Display help messages (N).
 
INCLUDE              Include specific object types, e.g. INCLUDE=TABLE_DATA.
 
JOB_NAME              Name of import job to create.
 
LOGFILE              Log file name (import.log).
 
NETWORK_LINK          Name of remote database link to the source system.
 
NOLOGFILE            Do not write logfile.
 
PARALLEL              Change the number of active workers for current job.
 
PARFILE              Specify parameter file.
 
QUERY                Predicate clause used to import a subset of a table.
 
REMAP_DATAFILE        Redefine datafile references in all DDL statements.
 
REMAP_SCHEMA          Objects from one schema are loaded into another schema.
 
REMAP_TABLESPACE      Tablespace object are remapped to another tablespace.
 
REUSE_DATAFILES      Tablespace will be initialized if it already exists (N).
 
SCHEMAS              List of schemas to import.
 
SKIP_UNUSABLE_INDEXES Skip indexes that were set to the Index Unusable state.
 
SQLFILE              Write all the SQL DDL to a specified file.
 
STATUS                Frequency (secs) job status is to be monitored where
 
                      the default (0) will show new status when available.
 
STREAMS_CONFIGURATION Enable the loading of Streams metadata
 
TABLE_EXISTS_ACTION  Action to take if imported object already exists.
 
                      Valid keywords: (SKIP), APPEND, REPLACE and TRUNCATE.
 
TABLES                Identifies a list of tables to import.
 
TABLESPACES          Identifies a list of tablespaces to import.
 
TRANSFORM            Metadata transform to apply (Y/N) to specific objects.
 
                      Valid transform keywords: SEGMENT_ATTRIBUTES and STORAGE.
 
                      ex. TRANSFORM=SEGMENT_ATTRIBUTES:N:TABLE.
 
TRANSPORT_DATAFILES  List of datafiles to be imported by transportable mode.
 
TRANSPORT_FULL_CHECK  Verify storage segments of all tables (N).
 
TRANSPORT_TABLESPACES List of tablespaces from which metadata will be loaded.
 
                      Only valid in NETWORK_LINK mode import operations.
 
VERSION              Version of objects to export where valid keywords are:
 
                      (COMPATIBLE), LATEST, or any valid database version.
 
                      Only valid for NETWORK_LINK and SQLFILE.
 
 
 
The following commands are valid while in interactive mode.
 
Note: abbreviations are allowed
 
 
 
Command              Description (Default)11g
 
------------------------------------------------------------------------------
 
CONTINUE_CLIENT      Return to logging mode. Job will be re-started if idle.
 
EXIT_CLIENT          Quit client session and leave job running.
 
HELP                  Summarize interactive commands.
 
KILL_JOB              Detach and delete job.
 
PARALLEL              Change the number of active workers for current job.
 
                      PARALLEL=.
 
START_JOB            Start/resume current job.
 
                      START_JOB=SKIP_CURRENT will start the job after skipping
 
                      any action which was in progress when job was stopped.
 
STATUS                Frequency (secs) job status is to be monitored where
 
                      the default (0) will show new status when available.
 
                      STATUS=[interval]
 
STOP_JOB              Orderly shutdown of job execution and exits the client.
 
                      STOP_JOB=IMMEDIATE performs an immediate shutdown of the
 
                      Data Pump job.
 
Oracle 10g Release 2 (10.2) added the following parameter.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
ENCRYPTION_PASSWORD  Password key for accessing encrypted column data.
 
                      This parameter is not valid for network import jobs.
 
Oracle 11g Release 1 (11.1) added the following parameters.
 
 
 
Keyword              Description (Default)
 
------------------------------------------------------------------------------
 
DATA_OPTIONS          Data layer flags where the only valid value is:
 
                      SKIP_CONSTRAINT_ERRORS-constraint errors are not fatal.
 
PARTITION_OPTIONS    Specify how partitions should be transformed where the
 
                      valid keywords are: DEPARTITION, MERGE and (NONE)
 
REMAP_DATA            Specify a data conversion function,
 
                      e.g. REMAP_DATA=EMP.EMPNO:REMAPPKG.EMPNO
 
REMAP_TABLE          Table names are remapped to another table.
 
                      For example, REMAP_TABLE=HR.EMPLOYEES:EMPS.
 
Oracle 11g Release 2 (11.2) altered the format of the help output as well as adding the following parameters.
 
 
 
CLUSTER
 
Utilize cluster resources and distribute workers across the Oracle RAC.
 
Valid keyword values are: [Y] and N.
 
 
 
SERVICE_NAME
 
Name of an active Service and associated resource group to constrain Oracle RAC resources.
 
 
 
SOURCE_EDITION
 
Edition to be used for extracting metadata.
 
 
 
TARGET_EDITION
 
Edition to be used for loading metadata.
 
Oracle 12c Release 1 (12.1) added the following parameters.
 
 
 
ABORT_STEP
 
Stop the job after it is initialized or at the indicated object.
 
Valid values are -1 or N where N is zero or greater.
 
N corresponds to the object's process order number in the master table.
 
 
 
ACCESS_METHOD
 
Instructs Export to use a particular method to unload data.
 
Valid keyword values are: [AUTOMATIC], DIRECT_PATH and EXTERNAL_TABLE.
 
 
 
ENCRYPTION_PWD_PROMPT
 
Specifies whether to prompt for the encryption password.
 
Terminal echo will be suppressed while standard input is read.
 
 
 
KEEP_MASTER
 
Retain the master table after an export job that completes successfully [NO].
 
 
 
MASTER_ONLY
 
Import just the master table and then stop the job [NO].
 
 
 
METRICS
 
Report additional job information to the export log file [NO].
 
 
 
TRANSPORTABLE
 
Options for choosing transportable data movement.
 
Valid keywords are: ALWAYS and [NEVER].
 
Only valid in NETWORK_LINK mode import operations.
 
 
 
VIEWS_AS_TABLES
 
Identifies one or more views to be imported as tables.
 
For example, VIEWS_AS_TABLES=HR.EMP_DETAILS_VIEW.
 
Note that in network import mode, a table name may be appended
 
to the view name.
 
Oracle 12c Release 2 (12.2) added the following parameters.
 
 
 
REMAP_DIRECTORY
 
Remap directories when you move databases between platforms.
 
 
 
STOP_WORKER
 
Stops a hung or stuck worker.
 
 
 
TRACE
 
Set trace/debug flags for the current job.
 

2023년 10월 14일 (토) 03:02 기준 최신판

thumb_up 추천메뉴 바로가기



1) 사용자 생성

SQL> create user new_scott identified by tiger;


2) 권한 추가

SQL> grant connect, resource to new_scott;


3) 디렉토리 권한 추가

SQL> grant read, write on directory MY_DMP_DIR to new_scott;
Grant succeeded.


4) 디비링크 생성권한(DBLINK 이용시)

SQL> grant create database link to new_scott;
SQL> connect new_scott/tiger
SQL> create database link OLD_DB connect to scott identified by tiger  using 'olddb.krenger.ch';

5) 디비링크 생성후 impdp 수행

  • 스키마를 변경(scott-> new_scott) 하여 import
impdp new_scott/tiger directory=MY_DMP_DIR LOGFILE=dblink_transfer.log network_link=OLD_DB remap_schema=scott:new_scott




1 IMPORT DP[편집]

1.1 IMPORT 사용 예시[편집]

impdp help = y
impdp scott / tiger 
DIRECTORY = dmpdir 
DUMPFILE = scott.dmp

'impdp'명령 다음 에 다양한 매개 변수 를 입력하여 가져 오기 실행 방법을 제어 할 수 있습니다 . 매개 변수를 지정하려면 다음 형식의 키워드를 사용하십시오.

impdp KEYWORD = value 또는 KEYWORD = (value1, value2, ..., valueN)

1.2 DBLINK로 IMPORT PUMP 처리 방법[편집]

1.2.1 1.DB 링크 생성[편집]

CREATE PUBLIC DATABASE LINK XXX_LINK 
CONNECT TO CYKIM identified by **** 
  USING '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=1.2.3.4)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)))';

1.2.2 2.IMPDP 파라미터 파일로 실행[편집]

 attach_file

주요사항
  • 주석은 '#'
  • INCLUDE 와 EXCLUDE 는 동시사용 불가

impdp parfile=파라미터파일


  • 여러개 파일로 분할 expdp + 특정 테이블 impdp 작업
  • parfile='파일.par'



USERID=SCOTT/TIGER

JOB_NAME=JOB_MIG2STG_20191002_01
LOGFILE =JOB_MIG2STG_20191002_01.LOG

NETWORK_LINK=XXX_DB_LINK
DIRECTORY=DATA_PUMP_DIR 

#DUMPFILE=[DATA_PUMP_DIR:]XXXDB_FULL.DMP #[디렉토리 지정시]

SCHEMAS=('SCOTT','ERP')
 
TABLE_EXISTS_ACTION=REPLACE 

#ALL/DATA_ONLY/METADATA_ONLY

CONTENT=METADATA_ONLY  

INCLUDE=TABLE:"IN ('EMP','DEPT') "
#INCLUDE=TABLE:"IN (SELECT 'EMP' FROM DUAL) "  -- SQL로 처리 

#EXCLUDE=STATISTICS,GRANT   -- 제외

1.2.3 IMPORT 파라미터 샘플[편집]

$ impdp parfile=expdp_pump.par
* impdp_pump.par
userid=scott/tiger
directory=datapump
job_name=datapump
dumpfile=expdp_%U.dmp
tables=TT700
table_exists_action=append

1.3 테이블만 IMPORT(테이블 존재시 TRUNCATE)[편집]

impdp scott/tiger
tables=SCOTT.EMP,SCOTT.DEPT
network_link=XXX_DB_LINK
content=data_only 
directory=PUMP_TEST  
table_exists_action=truncate 
logfile=XXX_DUMP.log

1.4 Package, Function, Procedure 만 import 하기[편집]

※ INCLUDE 에서 사용할 수 있는 OBJECT_TYPE은 아래 뷰를 이용하여 확인 가능

   DATABASE_EXPORT_OBJECTS, SCHEMA_EXPORT_OBJECTS, and TABLE_EXPORT_OBJECTS.
$impdp system/password directory=temp_dir schemas=scott dumpfile=scott%U.dmp  logfile=scott.log 
          include=PACKAGE,FUNCTION,PROCEDURE

1.5 IMPORT DP 파라미터[편집]

1.5.1 통계정보를 제외[편집]

impdp system 
directory=DATA_PUMP_DIR 
LOGFILE=MyImpdp.log 
schemas=MyRemoteDBSchema1,MyRemoteDBSchema2 
exclude=STATISTICS

1.5.2 스키마 선택[편집]

impdp system 
directory=DATA_PUMP_DIR 
LOGFILE=MyExpdp.log 
network_link=MyRemoteDBLink 
schemas=MyRemoteDBSchema1,MyR


  • directory 로그가 저장될 오라클디렉토리명
  • logfile 로그파일명
  • network_link DB 링크를 사용
  • remap_schema scott 유저를 new_scott 유저로
  • Import multiple schemas DBA권한필요


impdp simondba@kdb01 
directory=ADMIN_DUMP_DIR 
LOGFILE=dblink_transfer.log 
network_link=OLD_DB 
schemas=simon,scott,hr

1.5.3 IMPORT DP 상세 파라미터[편집]

USERID는 명령 행.

ATTACH 기존 작업에 부착합니다 (예 : ATTACH [= 작업 이름]). 
CONTENT 유효한 키워드가 (ALL), DATA_ONLY 및 METADATA_ONLY 인 로드 할 데이터를 지정합니다 . 
DIRECTORY 덤프, 로그 및 sql 파일에 사용될 디렉토리 객체입니다. 
DUMPFILE (expdat.dmp)에서 가져올 덤프 파일 목록입니다 ( 예 : DUMPFILE = scott1.dmp, scott2.dmp, dmpdir : scott3.dmp). 
예상 키워드 (BLOCKS) 및 STATISTICS 가 유효한 위치를 계산합니다 .
EXCLUDE 특정 오브젝트 유형을 제외하십시오 (예 : EXCLUDE = TABLE : EMP). 
FLASHBACK_SCN 세션 스냅 샷을 다시 설정하는 데 사용되는 SCN입니다. 
FLASHBACK_TIME 지정된 시간과 가장 가까운 SCN을 가져 오는 데 사용되는 시간입니다. 
FULL 원본 (Y)에서 모든 것을 가져옵니다. 
HELP 도움말 메시지 (N)를 표시합니다. 
INCLUDE 특정 오브젝트 유형을 포함하십시오 (예 : INCLUDE = TABLE_DATA). 
JOB_NAME 작성할 가져 오기 작업의 이름. 
LOGFILE 로그 파일 이름 (import.log). 
NETWORK_LINK 소스 시스템에 대한 리모트 데이터베이스 링크의 이름. 
NOLOGFILE 로그 파일을 쓰지 마십시오. 
PARALLEL 현재 작업의 활성 작업자 수를 변경합니다.
PARFILE 매개 변수 파일을 지정하십시오. 
QUERY 테이블의 서브 세트를 가져 오는 데 사용되는 술어 절. 
REMAP_DATAFILE 모든 DDL 문에서 데이터 파일 참조를 재정의합니다. 
REMAP_SCHEMA 한 스키마의 오브젝트가 다른 스키마로로드됩니다. 
REMAP_TABLESPACE 테이블 공간 오브젝트가 다른 테이블 공간으로 다시 맵핑됩니다. 
REUSE_DATAFILES 테이블 공간이 이미 존재하는 경우 초기화됩니다 (N). 
SCHEMAS 가져올 스키마 목록. 
SKIP_UNUSABLE_INDEXES 인덱스 사용 불가 상태로 설정된 인덱스를 건너 뜁니다. 
SQLFILE 모든 SQL DDL을 지정된 파일에 기록하십시오. 
TREAMS_CONFIGURATION Streams 메타 데이터의로드를 활성화합니다. 
TABLE_EXISTS_ACTION 가져온 객체가 이미있는 경우 수행 할 작업입니다. 유효한 키워드 : (건너 뛰기),APPEND, REPLACE 및 TRUNCATE 
                    SKIP leaves the table as is and moves on to the next object. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.
                    APPEND loads rows from the source and leaves existing rows unchanged.
                    TRUNCATE deletes existing rows and then loads rows from the source.
                    REPLACE drops the existing table and then creates and loads it from the source. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

TABLES 가져올 테이블 목록을 식별합니다. 
TABLESPACES 반입 할 테이블 공간의 목록을 식별합니다. 
TRANSFORM 특정 객체에 적용 (Y / N)하는 메타 데이터 변환입니다. 유효한 변환 키워드 : SEGMENT_ATTRIBUTES 및 STORAGE. 전의. TRANSFORM = SEGMENT_ATTRIBUTES : N : TABLE. 
TRANSPORT_DATAFILES 전송 가능 모드로 반입 할 데이터 파일 목록.
TRANSPORT_FULL_CHECK 모든 테이블의 저장 영역 세그먼트를 확인하십시오 (N). 
TRANSPORT_TABLESPACES 메타 데이터가로드 될 테이블 공간 목록. NETWORK_LINK 모드 가져 오기 작업에서만 유효합니다. 
VERSION 유효한 키워드가 (COMPATIBLE), LATEST 또는 유효한 데이터베이스 버전 인 경우 익스포트 할 오브젝트 버전. 
                      NETWORK_LINK 및 SQLFILE에만 유효합니다.

다음 명령은 대화식 모드에서 유효합니다. 참고 : 약어 허용.

CONTINUE_CLIENT 로깅 모드로 돌아갑니다. 유휴 상태이면 작업이 다시 시작됩니다. 
EXIT_CLIENT 클라이언트 세션을 종료하고 작업을 계속 실행합니다. 
HELP 대화식 명령을 요약하십시오. 
KILL_JOB 작업 분리 및 삭제. 
PARALLEL 현재 작업의 활성 작업자 수를 변경합니다. 
                      PARALLEL =. 
START_JOB 현재 작업 시작 / 다시 시작. 
                      START_JOB = SKIP_CURRENT는 작업이 중단되었을 때 진행 중이던 작업을 건너 뛰고 작업을 시작합니다 . 

STATUS 빈도 (초) 작업 상태가 모니터 될 
                                           STATUS = [interval] 
STOP_JOB 작업 실행을 정상적으로 종료하고 클라이언트를 종료합니다. 
                      STOP_JOB = IMMEDIATE는 Data Pump 작업을 즉시 종료합니다 .

Oracle 10g Release 2 (10.2)는 다음 매개 변수를 추가했습니다.

ENCRYPTION_PASSWORD 암호화 된 열 데이터에 액세스하기위한 암호 키입니다. 이 매개 변수는 네트워크 가져 오기 작업에는 유효하지 않습니다.

Oracle 11g Release 1 (11.1)은 다음 매개 변수를 추가했습니다.

DATA_OPTIONS 유일한 유효한 값인 데이터 계층 플래그 : SKIP_CONSTRAINT_ERRORS - 제약 조건 오류가 없습니다. 치명적인. 
 PARTITION_OPTIONS   유효한 키워드가 있는 파티션을 변환하는 f}을 지정하십시오 . 
DEPARTITION, MERGE W (NONE) REMAP_DATA 데이터 변환 기능을 지정하십시오 ( 
                      예 : REMAP_DATA = EMP.EMPNO : REMAPPKG.EMPNO 
 REMAP_TABLE). 테이블 이름이 다른 테이블로 다시 맵핑됩니다. 
                      예 : REMAP_TABLE = HR.EMPLOYEES : EMPS.

Oracle 11g Release 2 (11.2)는 도움말 출력의 형식을 변경하고 다음 매개 변수를 추가합니다.

CLUSTER 클러스터 리소스를 활용하여 오라클 RAC를 통해 Worker를 배포합니다. 유효한 키워드 값은 다음과 같습니다. [Y] 및 N. 
SERVICE_NAME Oracle RAC 리소스를 제한하는 활성 서비스 및 관련 리소스 그룹의 이름입니다. 
SOURCE_EDITION 메타 데이타의 추출에 사용하는 에디션 
TARGET_EDITION 메타 데이타의로드에 사용하는 에디션

Oracle 12c Release 1 (12.1)은 다음 매개 변수를 추가했습니다.

ABORT_STEP 작업이 초기화 된 후 또는 지정된 객체에서 중지하십시오. 유효한 값은 -1 또는 N이며 여기서 N은 0 이상입니다. 
N은 마스터 테이블에있는 오브젝트의 프로세스 순서 번호에 해당합니다. 

ACCESS_METHOD 특정 메소드를 사용하여 데이터를 언로드하도록 내보내기하도록 지시합니다. 유효한 키워드 값은 [AUTOMATIC], DIRECT_PATH 및 EXTERNAL_TABLE입니다. 

ENCRYPTION_PWD_PROMPT 암호화 암호를 묻는 프롬프트를 표시할지 여부를 지정합니다. 표준 입력을 읽는 동안 터미널 에코는 표시되지 않습니다. 

KEEP_MASTER 완료된 내보내기 작업 후에 마스터 테이블을 보유하십시오. [NO]. 

MASTER_ONLY 마스터 테이블 만 가져온 다음 작업을 중지하십시오 [NO]. 

METRICS     추가 작업 정보를 내보내기 로그 파일 [NO]에보고하십시오. 

TRANSPORTABLE   이동 가능한 데이터 이동 선택 옵션. 
                유효한 키워드는 항상 및 [절대]입니다. 
                NETWORK_LINK 모드 가져 오기 작업에서만 유효합니다. 

VIEWS_AS_TABLES 테이블로 가져올 뷰를 하나 이상 식별합니다. 
                예 : VIEWS_AS_TABLES = HR.EMP_DETAILS_VIEW. 네트워크 가져 오기 모드에서는 테이블 이름 
을 뷰 이름에 추가 할 수 있습니다 .

Oracle 12c Release 2 (12.2)는 다음 매개 변수를 추가했습니다.

REMAP_DIRECTORY 플랫폼간에 데이터베이스를 이동할 때 디렉토리를 다시 매핑하십시오. 
STOP_WORKER     걸려 있거나 걸린 작업자를 중지합니다. 
TRACE          현재 작업의 추적 / 디버그 플래그를 설정합니다.

1.6 IMPORT API[편집]

1.6.1 IMPORT 스키마/테이블 API[편집]

DECLARE
 dph NUMBER;
 v_job_name VARCHAR(100) := 'IMP_JOB_TEST';
 
BEGIN
-- DB_LINK 이용 작업시 
  dph := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA'  ,job_name => v_job_name, remote_link => 'db링크명');

-- 덤프파일 이용 작업시  
--  dbms_datapump.add_file(handle => dph,
--                         filename => 'EXPIMP%U.DMP',
--                         directory => 'EXPIMP', filetype=>1);
-- 로그 

  dbms_datapump.add_file(handle => dph,
                         filename => v_job_name||'.log',
                         directory => 'DATA_PUMP_DIR', filetype=>3);

-- 스키마 정보
 DBMS_DATAPUMP.METADATA_FILTER(handle => dph , 
                               name   => 'SCHEMA_EXPR', 
                               value  => ' IN (''MIG_BACKUP'')');
 
 -- 테이블 존재시 TRUNCATE/REPLACE/APPEND  
  dbms_datapump.set_parameter(handle => dph,
                              name => 'TABLE_EXISTS_ACTION',
                              value =>'REPLACE');

-- 테이블 정보
DBMS_DATAPUMP.METADATA_FILTER(handle => dph
                             ,name   => 'NAME_EXPR'
                             ,value  => ' IN (''TB_TEST'')'
                             ,object_type => 'TABLE'
                             );
                             
  dbms_datapump.start_job(dph);

  dbms_datapump.detach(dph);
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line('Error:' || sqlerrm || ' on Job-ID:' || dph);
END;
/

1.6.2 IMPORT 개별 TABLE (복구시)[편집]

DECLARE
 dph NUMBER;
 v_job_name VARCHAR(100) := 'IMP_JOB_TABLE_RECOVERY';
 
BEGIN
-- DB_LINK 이용 
  dph := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA'  ,job_name => v_job_name); -- , remote_link => 'db링크명'

-- 덤프파일 작업시  
  dbms_datapump.add_file(handle => dph,
                         filename => 'EXP_EMP_20200102_01.EXP',
                         directory => 'DATA_PUMP_DIR', filetype=>1);
-- 로그 

  dbms_datapump.add_file(handle => dph,
                         filename => v_job_name||'.log',
                         directory => 'DATA_PUMP_DIR', filetype=>3);

-- 스키마 정보
 DBMS_DATAPUMP.METADATA_FILTER(handle => dph , 
                               name   => 'SCHEMA_EXPR', 
                               value  => ' IN (''EMP'')');
 
 -- 테이블 존재시 TRUNCATE/REPLACE/APPEND  
  dbms_datapump.set_parameter(handle => dph,
                              name => 'TABLE_EXISTS_ACTION',
                              value =>'TRUNCATE');

-- 테이블 정보
DBMS_DATAPUMP.METADATA_FILTER(handle => dph
                             ,name   => 'NAME_EXPR'
                             ,value  => ' IN (''TB_TEST'')'
                             ,object_type => 'TABLE'
                             );
                             
  dbms_datapump.start_job(dph);

  dbms_datapump.detach(dph);
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line('Error:' || sqlerrm || ' on Job-ID:' || dph);
END;
/

2 EXPORT DP[편집]

2.1 EXPORT 파라미터 작성[편집]

expdp 예시)
$ expdp parfile=expdp_pump.par
  • expdp_pump.par
userid=system/oracle
directory=datapump
job_name=datapump
full=y
dumpfile= expdp_%U.dmp
filesize=100M


2.2 Package, Function, Procedure 만 EXPORT 하기[편집]

$expdp system/password directory=temp_dir filesize=10G schemas=scott dumpfile=scott%U.dmp logfile=scott.log 
          include=INDEX,PACKAGE,FUNCTION,PROCEDURE

2.3 EXPORT DP 파라미터[편집]

다양한 매개 변수 를 입력하여 내보내기 실행 방법을 제어 할 수 있습니다.

매개 변수를 지정하려면 다음

expdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)

예시:
expdp scott/tiger 
DUMPFILE=scott.dmp 
DIRECTORY=dmpdir 
SCHEMAS=scott
-- TABLES=(T1:P1,T1:P2)

USERID는 명령 행의 첫 번째 매개 변수 여야 함.

ATTACH 기존 작업에 부착합니다 (예 : ATTACH [= 작업 이름]). 
CONTENT 유효한 키워드가 (ALL), DATA_ONLY 및 METADATA_ONLY 인 위치를 언로드 할 데이터를 지정합니다 . 
DIRECTORY 덤프 파일 및 로그 파일에 사용될 디렉토리 객체입니다. 
DUMPFILE 대상 덤프 파일 (expdat.dmp)의 목록입니다 ( 
예 : DUMPFILE = scott1.dmp, scott2.dmp, dmpdir : scott3.dmp). 
예상 키워드는 다음과 같습니다. (블록) 및 통계. 
ESTIMATE_ONLY 내보내기를 수행하지 않고 작업 추정을 계산하십시오. 
EXCLUDE 특정 오브젝트 유형을 제외하십시오 (예 : EXCLUDE = TABLE : EMP). 
FILESIZE 각 덤프 파일의 크기를 바이트 단위로 지정하십시오. 
FLASHBACK_SCN 세션 스냅 샷을 다시 설정하는 데 사용되는 SCN입니다. 
FLASHBACK_TIME 지정된 시간과 가장 가까운 SCN을 가져 오는 데 사용되는 시간입니다. 
전체 데이터베이스 전체 내보내기 (N). 
도움말 도움말 메시지 (N)를 표시합니다. 
INCLUDE 특정 오브젝트 유형을 포함하십시오 (예 : INCLUDE = TABLE_DATA). 
JOB_NAME 작성할 내보내기 작업의 이름. 
LOGFILE 로그 파일 이름 (export.log).
NETWORK_LINK 소스 시스템에 대한 리모트 데이터베이스 링크의 이름. 
NOLOGFILE 로그 파일 (N)을 쓰지 마십시오. 
PARALLEL 현재 작업의 활성 작업자 수를 변경합니다. 
PARFILE 매개 변수 파일을 지정하십시오. 
QUERY 테이블의 서브 세트를 익스포트하는 데 사용되는 술어 절. 
SCHEMAS 내보낼 스키마 목록 (로그인 스키마). 
STATUS 빈도 (초) 작업 상태가 모니터 될 
                      ABLES 내보낼 테이블 목록을 식별합니다 (하나의 스키마 만). 
TABLESPACES 반출 할 테이블 공간 목록을 식별합니다.
TRANSPORT_FULL_CHECK 모든 테이블의 저장 영역 세그먼트를 확인하십시오 (N). 
TRANSPORT_TABLESPACES 메타 데이터를 언로드 할 테이블 공간 목록. 
VERSION 유효한 키워드가 (COMPATIBLE), LATEST 또는 유효한 데이터베이스 버전 인 경우 익스포트 할 오브젝트 버전.

다음 명령은 대화식 모드에서 유효합니다. 참고 : 약어는 허용됩니다.

명령 설명 

ADD_FILE 덤프 파일을 덤프 파일 세트에 추가하십시오. 
                      ADD_FILE =dumpfile-name 
CONTINUE_CLIENT 로깅 모드로 돌아갑니다. 유휴 상태이면 작업이 다시 시작됩니다. 
EXIT_CLIENT 클라이언트 세션을 종료하고 작업을 계속 실행합니다. 
HELP 대화식 명령을 요약하십시오. 
KILL_JOB 작업 분리 및 삭제. 
PARALLEL 현재 작업의 활성 작업자 수를 변경합니다. 
                      평행선 =. 
START_JOB 현재 작업 시작 / 다시 시작. 
STATUS 빈도 (초) 작업 상태가 모니터 될 
                                           STATUS = [interval] 
STOP_JOB 작업 실행을 정상적으로 종료하고 클라이언트를 종료합니다. 
                      STOP_JOB = IMMEDIATE는 
                      Data Pump 작업을 즉시 종료합니다 .

The following commands are valid while in interactive mode.
Note: abbreviations are allowed

Oracle 10g Release 2 (10.2)는 다음 매개 변수를 추가했습니다.

DATA_OPTIONS 유일한 유효한 값인 데이터 계층 플래그는 다음과 같습니다. 
                      XML_CLOBS-write XML 데이터 유형 CLOB 형식 
ENCRYPTION 유효한 키워드 
                      값이 ALL, DATA_ONLY, METADATA_ONLY, 
                      ENCRYPTED_COLUMNS_ONLY 또는 NONE 인 덤프 파일의 일부 또는 전부를 암호화합니다 . 
ENCRYPTION_ALGORITHM 유효한 
                      키워드 값이 (AES128), AES192 및 AES256 인 경우 암호화를 수행하는 방법을 지정하십시오 . 
ENCRYPTION_MODE 유효한 키워드가있는 곳에 암호화 키를 생성하는 방법
                      값은 DUAL, PASSWORD 및 (TRANSPARENT)입니다. 
REMAP_DATA 데이터 변환 기능을 지정하십시오 ( 
                      예 : REMAP_DATA = EMP.EMPNO : REMAPPKG.EMPNO). 
REUSE_DUMPFILES 대상 덤프 파일이 존재할 경우이를 겹쳐 씁니다 (N). 
TRANSPORTABLE 
                      유효한 키워드 값이 : ALWAYS, (NEVER) 인 경우 전송 가능 메소드를 사용할 수 있는지 지정하십시오 . 

다음 명령은 대화식 모드에서 유효합니다. 
참고 : 약어는 허용됩니다. 

명령 설명 

REUSE_DUMPFILES 대상 덤프 파일이 존재할 경우이를 덮어 씁니다 (N).

Oracle 11g Release 2 (11.2)는 도움말 출력의 형식을 변경하고 다음 매개 변수를 추가합니다.

CLUSTER
Utilize cluster resources and distribute workers across the Oracle RAC.
Valid keyword values are: [Y] and N.

 SERVICE_NAME
Oracle RAC 리소스를 제한하는 활성 서비스 및 관련 리소스 그룹의 이름입니다

 SOURCE_EDITION
메타 데이타의 추출에 사용하는 에디션

Oracle 12c Release 1 (12.1) added the following parameters.

ABORT_STEP
작업이 초기화 된 후 또는 지정된 객체에서 중지하십시오. 
유효한 값은 -1 또는 N이며 여기서 N은 0 이상입니다. 
N은 마스터 테이블에있는 오브젝트의 프로세스 순서 번호에 해당합니다. 

 ACCESS_METHOD
특정 메소드를 사용하여 데이터를 언로드하도록 내보내기하도록 지시합니다. 
유효한 키워드 값은 [AUTOMATIC], DIRECT_PATH 및 EXTERNAL_TABLE입니다. 

 COMPRESSION_ALGORITHM
사용할 압축 알고리즘을 지정하십시오. 
유효한 키워드 값은 [BASIC], LOW, MEDIUM 및 HIGH입니다. 

 ENCRYPTION_PWD_PROMPT
암호화 암호를 묻는 프롬프트를 표시할지 여부를 지정합니다. 
표준 입력을 읽는 동안 터미널 에코는 표시되지 않습니다. 

 KEEP_MASTER
성공적으로 완료된 내보내기 작업 후에는 마스터 테이블을 보유하십시오 [NO]. 

 MASTER_ONLY
마스터 테이블 만 가져온 다음 작업을 중지하십시오 [NO]. 

 METRICS
추가 작업 정보를 내보내기 로그 파일 [NO] 에보고 합니다. 

 VIEWS_AS_TABLES
테이블로 익스포트 할 하나 이상의 뷰를 식별합니다. 
예 : VIEWS_AS_TABLES = HR.EMP_DETAILS_VIEW.

Oracle 12c Release 2 (12.2)는 다음 매개 변수를 추가했습니다.

STOP_WORKER 
걸려 있거나 걸린 작업자를 중지합니다. 

TRACE 
현재 작업의 추적 / 디버그 플래그를 설정합니다.

3 데이터펌프 작업 관리 및 모니터링[편집]

현재 작업중인 datapump 작업들의 내용을 dba_datapump_jobs 딕셔너리를 통해 확인 가능



SELECT owner_name, job_name, operation, job_mode, state 
  FROM dba_datapump_jobs;
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_min
from sys.v_$sqlarea
where sql_text like 'INSERT %INTO "%'
and command_type = 2
and open_versions > 0;

3.1 Datapump 작업 진행사항[편집]

SELECT X.JOB_NAME
     , B.STATE
     , B.JOB_MODE
     , B.DEGREE
     , X.OWNER_NAME
     , Z.SQL_TEXT
     , P.MESSAGE
     , P.TOTALWORK
     , P.SOFAR
     , ROUND ( (P.SOFAR / P.TOTALWORK) * 100, 2) DONE
     , P.TIME_REMAINING
  FROM DBA_DATAPUMP_JOBS B
  LEFT JOIN DBA_DATAPUMP_SESSIONS X ON (X.JOB_NAME = B.JOB_NAME)
  LEFT JOIN V$SESSION Y ON (Y.SADDR = X.SADDR)
  LEFT JOIN V$SQL Z ON (Y.SQL_ID = Z.SQL_ID)
  LEFT JOIN V$SESSION_LONGOPS P ON (P.SQL_ID = Y.SQL_ID)
-- WHERE Y.MODULE = 'Data Pump Worker' AND P.TIME_REMAINING > 0
;

4 데이터펌프(DATAPUMP) JOB 중지[편집]

SELECT * FROM DBA_DATAPUMP_JOBS;

4.1 IMPDP ATTACH=JOB 접속 후[편집]

$>IMPDP SCOTT/TIGER@DB ATTACH=JOB명 
KILL_JOB
STOP_JOB #STOP_JOB = IMMEDIATE 즉시 종료

4.2 API 이용 정지[편집]

  • 주의) 즉시 정지 하지 않음
DECLARE
h1 NUMBER;
BEGIN
h1:=DBMS_DATAPUMP.ATTACH(JOB_NAME => '"MIG_CHANGED_TABLE"', JOB_OWNER => 'RTIS_MIG');
DBMS_DATAPUMP.STOP_JOB(h1,1,0);
END;

5 EXPORT API[편집]

5.1 스키마 EXPORT[편집]

DECLARE
    hndl NUMBER;
    TAG_NAME  VARCHAR2(30) := 'EXP_MIG_TEST01';
BEGIN
    hndl := DBMS_DATAPUMP.OPEN( operation => 'EXPORT'
                              , job_mode => 'SCHEMA' -- FULL, SCHEMA, TABLE, TABLESPACE, TRANSPORTABLE
                              , job_name=>'JOB_'||TAG_NAME
                              --, remote_link => 'DBLINK_NAME', version => 'LATEST'
                              );
    DBMS_DATAPUMP.ADD_FILE( handle => hndl, filename => TAG_NAME||'.dmp', directory => 'DATA_PUMP_DIR', filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE, reusefile=>1);
    DBMS_DATAPUMP.ADD_FILE( handle => hndl, filename => TAG_NAME||'.log', directory => 'DATA_PUMP_DIR', filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
    
    -- DBMS_DATAPUMP.SET_PARAMETER(handle=> hndl, name=> 'INCLUDE_METADATA', value=> 1); -- META 포함여부
    DBMS_DATAPUMP.DATA_FILTER(handle=> hndl, name=> 'INCLUDE_ROWS', value=> 0);  -- DATA 포함 여부 0, 
    DBMS_DATAPUMP.METADATA_FILTER(handle=> hndl, name=> 'SCHEMA_EXPR', value=>'IN (''FED40'',''TTT'')');
    -- DBMS_DATAPUMP.METADATA_FILTER(handle=> hndl, name=> 'NAME_EXPR', value=>'IN (''FED40'', ''TEST'')');
    -- DBMS_DATAPUMP.METADATA_FILTER(handle=> hndl, name=> 'NAME_LIST', value=>'''EMP'',''DEPT''');

    
    DBMS_DATAPUMP.START_JOB(hndl);
END;

5.2 테이블 EXPORT API[편집]

-- 1.테이블 DUMP EXPORT 스크립트

DECLARE
hdnl NUMBER;

BEGIN
hdnl := DBMS_DATAPUMP.OPEN( operation => 'EXPORT', job_mode => 'SCHEMA', job_name=>'JOB_EXP_TB_RC_JEJU_14');

DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'INIT_BK_TB_RC_JEJU_14_20190910.EXP', directory => 'DATAPUMP2', filetype => dbms_datapump.ku$_file_type_dump_file ,reusefile=>1);
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'INIT_BK_TB_RC_JEJU_14_20190910.LOG', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file  ,reusefile=>1);

-- 스키마 정보 
 DBMS_DATAPUMP.METADATA_FILTER(handle => hdnl,
                               name   => 'SCHEMA_EXPR',
                               value  => ' IN (''유저명'')'
                               );
-- 테이블 정보  
DBMS_DATAPUMP.METADATA_FILTER(handle => hdnl
                             ,name   => 'NAME_EXPR'
                             ,value  => ' IN (''테이블명'')'
                             ,object_type => 'TABLE'
                             );

DBMS_DATAPUMP.START_JOB(hdnl);
END;

6 데이터펌프 로그파일 읽기 API[편집]

DECLARE 
V1 VARCHAR2(200); --32767
F1 UTL_FILE.FILE_TYPE; 

BEGIN 
    F1 := UTL_FILE.FOPEN('DATA_PUMP_DIR','INIT_BK_TB_RC_JEJU_12_20190910.LOG','R');	
Loop
	BEGIN
		UTL_FILE.GET_LINE(F1,V1); 
		dbms_output.put_line(V1);
		EXCEPTION WHEN No_Data_Found THEN EXIT; 
	END;
end loop;

IF UTL_FILE.IS_OPEN(F1) THEN
	dbms_output.put_line('File is Open');
end if;

UTL_FILE.FCLOSE(F1);	
END;

7 파일 복사(ASM등)[편집]

 attach_file OS상의 파일복사 명령를 DB에서 직접 수행이 가능.

  • DBMS_FILE_TRANSFER.COPY_FILE 패키지/함수
  • 소스 디렉토리에서 파일을 읽고 대상 디렉토리에 복사
  • ASM 과 로컬 디스크간 복사
  • 소스 및 대상 디렉토리는 로컬 파일 시스템에 있거나 ASM (Automatic Storage Management) 디스크 그룹에 있거나

로컬 파일 시스템과 ASM간에 어느 방향 으로든 복사 할 수 있음.

BEGIN
DBMS_FILE_TRANSFER.COPY_FILE(
  source_directory_object      =>  'SOURCEDIR' -- 소스 디렉토리 
, source_file_name             => 't_xdbtmp.f' -- 소스 파일
, destination_directory_object => 'DGROUP'     -- 타켓 디렉토리
, destination_file_name        =>'t_xdbtmp.f'  -- 타겟 파일
);
END;
/

7.1 DB LINK를 이용한 파일 복사(밀어 넣기)[편집]

 attach_file DBMS_FILE_TRANSFER.PUT_FILE 패키지/함수

  • 소스 에서 프로시져 실행 해야 함.
  • 소스 => 타겟으로 복사
  • 로컬 파일 또는 ASM을 읽고 원격 데이터베이스에 접속하여 원격 파일 시스템에 파일 사본을 작성합니다.
  • DB링크 간의 DUMP파일 복사가 가능(.log파일은 복사 안됨,12c)

BEGIN
DBMS_FILE_TRANSFER.PUT_FILE(
source_directory_object       => 'DATA_PUMP_DIR',    -- 패키지 실행하는 DB
source_file_name              => 'sample.dmp',       -- 패키지 실행하는 DIRECTORY의 덤프파일명
destination_directory_object  => 'DATA_PUMP_DIR2',   -- DB링크 원격지 디렉토리
destination_file_name         => 'sample_copied.dmp',-- DB링크 원격지에 저장될 파일명
destination_database          => '디비링크명' 
);
END;
/

7.2 파일 복사(가져오기)[편집]

 attach_file DBMS_FILE_TRANSFER.GET_FILE

  • 원격 데이터베이스에 접속하여 원격 파일을 로컬 파일 시스템 또는 ASM에 파일 복사.
  • 절차가 성공적으로 완료 될 때까지 대상 파일이 닫히지 않음.

BEGIN
DBMS_FILE_TRANSFER.GET_FILE(
source_directory_object       => 'DATA_PUMP_DIR',
source_file_name              => 'sample.dmp',
source_database               => '디비링크명',
destination_directory_object  => 'DATA_PUMP_DIR2', 
destination_file_name         => 'sample_copied.dmp' 
);
END;
/

9 DB LINK를 이용한 파일 복사[편집]

BEGIN
DBMS_FILE_TRANSFER.PUT_FILE(
source_directory_object       => 'DATA_PUMP_DIR',
source_file_name              => 'sample.dmp',
destination_directory_object  => 'DATA_PUMP_DIR',
destination_file_name         => 'sample_copied.dmp', 
destination_database          => 'to_rds' 
);
END;
/