02.Oracle/DataBase2009. 11. 5. 18:07
반응형

EyeQ MC - Developer Site

오라클 10g 이상에서 expdp와 impdp를 사용한 tablespace 복사 방법

- 복사할 원본 tablespace 이름은 “SRC”, 사용자는 “SRC_USER”라 한다. - 복사 대상 tablespace 이름은 “COPY”, 사용자는 “COPY_USER”라 한다. - system 권한이 있어야 한다.(password는 “manager”)

< 순서 >

1. 복사본 tablespace 및 사용자 생성

2. Dump 디렉토리 설정

3. 원본 export

4. 원본 import


1. 복사본 tablespace 및 사용자 생성(SQL-Plus 로긴 필요)

ⅰ)	tablespace 생성
	CREATE TABLESPACE copy
		DATAFILE 'C:\ORACLExe\ORADATA\XE\copy00.dbf' SIZE 100M
		DEFAULT STORAGE 
		(	INITIAL    500K
 			NEXT      10K
 			MINEXTENTS 2
 			MAXEXTENTS 50
			PCTINCREASE 50);
		
ⅱ)	사용자 생성 및 권한 부여(패스워드는 동일)
	create user copy_user
		identified by copy_user
		default tablespace copy;
	
	grant connect,resource to copy_user;
	grant create table, create sequence, create view TO copy_user;
	
ⅲ)	데이타 파일 추가(사이즈에 맞게 설정)
	ALTER TABLESPACE copy
	ADD DATAFILE 'C:\ORACLExe\ORADATA\XE\copy01.dbf' SIZE 100M
	AUTOEXTEND ON NEXT 10M
	MAXSIZE 1G;	
	

2. Dump 디렉토리 설정(SQL-Plus 로긴 필요)

ⅰ) dump 받을 디렉토리 설정
	CREATE OR REPLACE DIRECTORY expdpDIR AS 'C:\temp';
ⅱ) 설정된 디렉토리 확인
	select * from dba_directories;
	
ⅲ)	디렉토리에 대한 권한 부여
	grant read, write on directory expdpDIR to system,src_user,copy_user;

3. 원본 export

ⅰ)	오라클(10g) 설치 디렉토리의 bin 디렉토리로 이동
ⅱ) export 실행
	expdp system/manager SCHEMAS=SRC directory=expdpdir dumpfile=expdpSRC.dmp job_name=SRC_JOB logfile=SRC_exp.log
	

4. 원본 import

ⅰ) 오라클(10g) 설치 디렉토리의 bin 디렉토리로 이동
ⅱ) import 실행
	impdp system/manager REMAP_SCHEMA=SRC:COPY REMAP_TABLESPACE=SRC:COPY directory=expdpDIR dumpfile=expdpSRC.dmp job_name=COPY_JOB logfile=COPY_imp.log

ⅲ) 메시지 확인
	"작업이 16:46:13에서 성공적으로 완료됨"
 
oracle_tablespace_copy.txt · 마지막 수정: 2008/12/05 11:41 작성자 jsmoon
 
Posted by 1010