커맨드창
C:\Users\yongseung>set oracle_sid
oracle_sid=TestDB
C:\Users\yongseung>expdp scott/tiger@TestDB tables=EMP,DEPT DIRECTORY=dpdir DUMP
FILE=EMP_DEPT1.dmp LOGFILE=EXPD.log
Export: Release 11.2.0.1.0 - Production on 월 6월 2 11:08:45 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
UDE-12154: 작업이 ORACLE 오류 12154을(를) 생성함
ORA-12154: TNS:지정된 접속 식별자를 분석할 수 없음
커맨드창에서 expdp를 하면 위와 같은 에러가 발생합니다.
혹시 몰라 tnsnames.ora도 올릴게요
TESTDB_LOCAL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = TestDB)
)
)
C:\Users\yongseung>expdp scott/tiger@TESTDB_LOCAL tables=EMP,DEPT DIRECTORY=dpdir DUMP
FILE=EMP_DEPT1.dmp LOGFILE=EXPD.log
이렇게 놓고 expdp를 실행해보세요
몇자 적어 봅니다.
expd, impd 를 사용하는 방법은....
1. 권한을 부여 한다.
grant EXP_FULL_DATABASE, IMP_FULL_DATABASE to scott;
2. 사용 중인 디렉토리 오브젝트의 조회
SELECT * FROM dba_directories;
3. 디렉토리 오브젝트 추가
CREATE DIRECTORY datapump_dir as '/ORACLE/bhlee_work/spool_data/dmp';
CREATE DIRECTORY datapump_dir as '/home/oracle11g/bhlee/dmp';
CREATE DIRECTORY datapump_dir as '/ORACLE/oradata/bhlee_work/dmp';
CREATE DIRECTORY datapump_dir as '/ORACLE/oradata/dmp';
4. 디렉토리 오브젝트에 대한 권한 설정
GRANT READ,WRITE ON DIRECTORY datapump_dir to scott;
Table 단위 export dump
expdp scott/tiger DIRECTORY=datapump_dir Tables=TBL_DP_PROD dumpfile=TBL_DP_PROD.dmp LOGFILE=TBL_DP_PROD.log
Table Parttion 단위 export dump
expdp scott/tiger DIRECTORY=datapump_dir Tables=TBL_SCRE_HIT_HIST:SCRE_HIT_201303 dumpfile=TBL_SCRE_HIT_HISTORY_03.dmp LOGFILE=TBL_SCRE_HIT_HISTORY_03.log PARALLEL=4
Import dump
impdp scott/tiger DIRECTORY=datapump_dir dumpfile=TBL_SCRE_HIT_HISTORY_03.dmp logfile=TBL_SCRE_HIT_HISTORY_03_impdp.log table_exists_action=append parallel=5
Process 확인은....
SELECT SID, SERIAL#, T.USERNAME
, T.START_TIME
, T.LAST_UPDATE_TIME
, T.TIME_REMAINING
, T.ELAPSED_SECONDS
, T.OPNAME
, T.TARGET_DESC
, T.SOFAR
, T.TOTALWORK
, T.MESSAGE
FROM V$SESSION_LONGOPS T
WHERE/* T.USERNAME = 'USER_NAME' AND*/ T.TARGET_DESC IN ('EXPORT', 'IMPORT')
이걸로 확인한다.