Oracle 10g 및 이후 내 보 내기/가 져 오기(Datapump Export/Import)도구
혹시
http://www.orafaq.com/wiki/Datapump
Datapump 는 대 용량 데이터 이전 구 조 를 바탕 으로 오래된 import/export 도 구 를 대체 하 는 서비스 입 니 다.오래된 import/export 도 구 는 여전히 사용 할 수 있 지만 모든 Oracle 10g 과 11g 의 기능 은 지원 되 지 않 습 니 다.이 새 도구 의 이름 은 expdp 와 impdp 입 니 다.
본문 내용
본 고 는 Oracle 10g 및 그 후 버 전 내 보 내기/입 도구 의 절 차 를 소개 합 니 다.내용 은 다음 과 같 습 니 다.
datapump 내 보 내기 시작데이터베이스 디 렉 터 리 만 들 기
네트워크 도입
PL/SQL 에서 호출내 보 내기/입력 설명
더참고 자료
datapump 로 내 보 내기 시작
$ expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
Export: Release 10.2.0.1.0 - 64bit Production on Friday, 31 March, 2006 11:36:07
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name DMPDIR is invalid
설명:
내 보 내기 실패!디 렉 터 리 를 먼저 만들어 야 하기 때 문 입 니 다!
데이터베이스 디 렉 터 리 만 들 기
다음 명령 을 실행 하여 데이터베이스 내 보 내기 디 렉 터 리 를 만 듭 니 다.이 디 렉 터 리 는 같은 서버 의 유효한 디 렉 터 리 를 데이터베이스 로 가 리 켜 야 합 니 다.
SQL> CREATE DIRECTORY dmpdir AS '/opt/oracle';
Directory created.
SQL> GRANT read, write ON DIRECTORY dmpdir TO scott;
Grant succeeded.
설명:
디 렉 터 리 내 보 내기 권한 부여scott 사용자 가 이 디 렉 터 리 를 읽 고 쓸 수 있 도록 합 니 다.이렇게 해야만 scott 사용자 가 이 디 렉 터 리 에 정상적으로 접근 하여 데이터베이스 내용 과 내 보 낸 로그 파일 을 여기에 놓 을 수 있 습 니 다
비고:Oracle 은 Oracle 10g R2 부터'DATA'라 는 이름 을 도입 했다.PUMP_DIR"의 기본 디 렉 터 리 는 다음 과 같 습 니 다.
SQL> SELECT directory_path FROM dba_directories WHERE directory_name = 'DATA_PUMP_DIR';
DIRECTORY_PATH
--------------------------------------------------------------------------------
/app/oracle/product/10.2.0/rdbms/log/
다시 내 보 내기 시도
$ expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
Export: Release 10.2.0.1.0 - 64bit Production on Friday, 31 March, 2006 11:41:02
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** DIRECTORY=dmpdir DUMPFILE=scott.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 175.2 MB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/JOB
. . exported "SCOTT"."BIGEMP" 145.2 MB 3670016 rows
. . exported "SCOTT"."DEPT" 5.656 KB 4 rows
. . exported "SCOTT"."EMP" 7.820 KB 14 rows
. . exported "SCOTT"."ORD_CHARGE_TAB" 5.296 KB 2 rows
. . exported "SCOTT"."SALGRADE" 5.585 KB 5 rows
. . exported "SCOTT"."BONUS" 0 KB 0 rows
. . exported "SCOTT"."NEWOBJECT1_T" 0 KB 0 rows
. . exported "SCOTT"."T1" 0 KB 0 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
/app/oracle/scott.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 11:44:50
다른 데이터베이스 로 가 져 오기
$ impdp system/oracle DIRECTORY=dmpdir DUMPFILE=scott.dmp
Import: Release 10.2.0.1.0 - 64bit Production on Friday, 31 March, 2006 12:00:59
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Master table "SYSTEM"."SYS_IMPORT_FULL_02" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_02": system/******** DIRECTORY=dmpdir DUMPFILE=scott.dmp
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."BIGEMP" 145.2 MB 3670016 rows
. . imported "SCOTT"."DEPT" 5.656 KB 4 rows
. . imported "SCOTT"."EMP" 7.820 KB 14 rows
. . imported "SCOTT"."ORD_CHARGE_TAB" 5.296 KB 2 rows
. . imported "SCOTT"."SALGRADE" 5.585 KB 5 rows
. . imported "SCOTT"."BONUS" 0 KB 0 rows
. . imported "SCOTT"."NEWOBJECT1_T" 0 KB 0 rows
. . imported "SCOTT"."T1" 0 KB 0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/JOB
Job "SYSTEM"."SYS_IMPORT_FULL_02" successfully completed at 12:02:22
비고:
네트워크 가 져 오기
네트워크 모드 를 통 해 가 져 옵 니 다.중간 에 있 는 dump 파일 이 필요 없습니다.데 이 터 는 데이터베이스 링크(database link)를 통 해 내 보 내 고 대상 데이터 베 이 스 를 직접 가 져 옵 니 다.예 를 들 면:
SQL> create user new_scott identified by tiger;
User created.
SQL> grant connect, resource to new_scott;
Grant succeeded.
SQL> grant read, write on directory dmpdir to new_scott;
Grant succeeded.
SQL> grant create database link to new_scott;
Grant succeeded.
SQL> conn new_Scott/tiger
Connected.
SQL> create database link old_scott connect to scott identified by tiger using 'orcl.oracle.com';
Database link created.
$ impdp new_scott/tiger DIRECTORY=dmpdir NETWORK_LINK=old_scott remap_schema=scott:new_scott
모든 작업 은 목표 운영 체제 에서 이 루어 진다.원본 운영 체제 에 대한 유일한 인용 은 데이터베이스 링크(database link)를 통 해 이 루어 집 니 다.
PL/SQL 에서 호출
PL/SQL 에서 datapump 를 호출 할 수 있 습 니 다.이것 은 매일 또는 매주 DBMS 를 사용 할 계획 입 니 다.SCHEDULER 내 보 내기 가 편리 합 니 다.
DECLARE
hand NUMBER;
BEGIN
hand := Dbms_DataPump.Open(operation => 'EXPORT',
job_mode => 'FULL',
job_name => 'FULLEXPJOB',
version => 'COMPATIBLE');
Dbms_DataPump.Add_File(handle => hand,
filename => 'expdp_plsql.log',
directory => 'DMPDIR',
filetype => 3);
Dbms_DataPump.Add_File(handle => hand,
filename => 'expdp_plsql.dmp',
directory => 'DMPDIR',
filetype => 1);
-- Dbms_DataPump.Set_Parameter(handle => hand,
-- name => 'ESTIMATE',
-- value => 'STATISTICS');
Dbms_DataPump.Start_Job(hand);
END;
/
내 보 내기/입력 설명
일반적인 상황 에서 내 보 내기/입력 은 많은 문제 가 발생 하지 않 습 니 다.몇 가지 만 주의 하면 됩 니 다.
내 보 내기 에 사용 할 사용 자 는 내 보 내기 디 렉 터 리 에 읽 기와 쓰기 권한 이 있어 야 합 니 다.이것 은 명백히 알 수 있다
4.567917.가 져 올 때 해당 하 는 표 공간 과 사용 자 는 반드시 존재 해 야 합 니 다.이것 도 뻔 해.
이 세 가 지 를 주의 하 세 요.일반적으로 내 보 내기/들 어 오 는 데 성공 합 니 다.
훨씬
이상 의 예 는 처음 시작 한 너 에 게 이미 충분 하 다.더 많은 정 보 는 Oracle 도구 안내 서 를 참조 하 십시오.다음 명령 을 입력 하면 이 명령 의 모든 인 자 를 표시 할 수 있 습 니 다.
$ expdp help=yes
$ impdp help=yes
이상 은 Oracle FAQ 가 제시 한 가 져 오기/꺼 내기 도구 의 예제 입 니 다.
잠시 후,내 기계 에서 시범 을 보 여 준다.
참고 자료
Oracle 10g 이전 내 보 내기/입력 도구http://www.orafaq.com/wiki/Import_Export_FAQ
Oracle 도구http://www.orafaq.com/wiki/Category:Utilities
다음으로 이동:http://www.cnblogs.com/liuning8023/archive/2012/03/29/2424435.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
자바 작업 은 Clob 또는 NClob 데이터 형식의 저장 프로 세 스 인 스 턴 스 를 포함 합 니 다.텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.