'named pipe'에 해당되는 글 1건

  1. 2022.03.02 namedd pipe export,import
ORACLE/Migration2022. 3. 2. 00:09
반응형

<< System 환경 – Remote export 가 지원되는 경우 >>

   - Source DB :: Linux, Oracle 9i R2 
   - Target DB :: Solaris, Oracle 9i R2 
 ** Named Pipe 사용예제

   1. TNS_Alias 생성
      % vi  $TNS_ADMIN/tnsnames.ora
          REMOTE =
               (DESCRIPTION =
                (ADDRESS_LIST =
                 (ADDRESS = (PROTOCOL = TCP)(HOST = Source_DB_IP)(PORT = 1521))
               )
               (CONNECT_DATA =
                (SERVER = DEDICATED)
                 (SERVICE_NAME = ORCL)
               )
              )

   2. Named Pipe 생성                            Target DB !!
       % mknod /tmp/exp_pipe p

   3. Export / Import                           Target DB !!
      % exp ID/PWD@REMOTE file=/tmp/exp_p log=exp_log buffer=10240000 directy=y &
      % imp ID/PWD file=/tmp/exp_p  log=imp_log commit=y feedback=100 indexes=n …


** Source DB 에 export 받은 공간이 없는 경우에도 사용함 !!

=====================================================================
DBA_TAB_COLUMNS

[[ Named Pipe를 이용한 exp/imp ]]



- 프로세스간 데이터 전송에 사용되며, 클라이언트/서버간에 유용하게 사용된다
- 일반적으로로 string을 주고 받는다
- 두 프로세스간의 통로 이다, Named Pipe는 명시적인 Pipe로 네트워크간 통신에 사용하기 편리 하다
- export + dmp파일 전송 + import 의 세가지 작업을 동시에 수행힐수 있는 방법이 Named Pipe를

   사용하는것이다
- 이론상으로는 source 에서 Named Pipe를 향해 export를 수행하고, 그와 동시에 target에서는

    Named Piped로부터
    import 작업을 수행 하기 때문에 거의 export 시간에 import 작업이 끝난다고 볼수 있다.



* 네트워크를 통해 데이터가 전송되기 때문에 데이터에 대한 정합성 문제가 발생할수 있어서
  작업시간이 문제가 되지 않는 경우를 제외하고는 그다지 사용을 권하지 않는다


(예제_1) source 및 target 동일 유저로 exp/imp



- source = devdb    / test 유저
- target = devmigdb / test 유저

-  작업 순서
      1) 파이프 생성
      2) target 에서 source에 network울 통한 접속으로 export 작업수행 --> Named Pipe에 write
      3) targer 에서 Named Pipe를 통해서 읽기 및 해당 테이블에 insert
  
<<kk.sh>>

rm /tmp/exp_pipe_1
mknod /tmp/exp_pipe_1 p
exp test/test1234@devdb file=/tmp/exp_pipe_1 direct=y constraints=n log=exp_TEST_`date +"%Y%m%d"`.log parfile=p_Test.par &
imp test/test1234 file=/tmp/exp_pipe_1 log=imp_TEST_`date +"%Y%m%d"`.log ignore=y commit=y indexes=n constraints=n grants=n buffer=102400000 parfile=p_Test.par &



<p_Test.par>
feedback=10000
tables=IG_EMP



(예제_2) source 및 target ekfms 유저로 exp/imp



- source = devdb    / scott 유저
- target = devmigdb / test 유저

-  작업 순서
      1) 파이프 생성
      2) target 에서 source에 network울 통한 접속으로 export 작업수행 --> Named Pipe에 write
      3) targer 에서 Named Pipe를 통해서 읽기 및 해당 테이블에 insert



<<zz.sh>>

rm /tmp/exp_pipe_1
mknod /tmp/exp_pipe_1 p
exp scott/tiger333@devdb file=/tmp/exp_pipe_1 direct=y constraints=n log=exp_SCOTT_`date +"%Y%m%d"`.log parfile=p_Scott.par &
imp test/test1234 file=/tmp/exp_pipe_1 log=imp_TEST_`date +"%Y%m%d"`.log ignore=y commit=y indexes=n constraints=n grants=n buffer=102400000 parfile=p_Scott.par &



<p_Scott.par>
feedback=10000
tables=LARGE_EMP



(결과)



step_1) source data 건수



           DEVDB_SCOTT> select count(*) from large_emp ;

                             COUNT(*)
                             ----------
                             1091410



step_2) target에서 작업수행
       
 oracle@migdevdb_MIGDB:/oradata/work/> sh zz.sh



 Import: Release 11.2.0.4.0 - Production on 목 9월 3 15:02:35 2015
 Export: Release 11.2.0.4.0 - Production on 목 9월 3 15:02:35 2015

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


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


 다음에 접속됨: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options

 다음에 접속됨: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options
 KO16MSWIN949 문자 설정과 AL16UTF16 NCHAR 문자 설정에서 익스포트가 종료되었습니다
 경고: 테이블 제약 조건이 익스포트되지 않습니다

 지정된 테이블을 익스포트하려고 합니다 via 디렉토리 경로 ...
 . .                       LARGE_EMP 테이블 익스포트 중
 익스포트 파일은 직접 경로를 거쳐 EXPORT:V11.02.00 에 의해 생성되었습니다

 경고: 객체는 다른 사용자 SCOTT(이)가 엑스포트한 것입니다.

 KO16MSWIN949 문자집합과 AL16UTF16 NCHAR 문자 집합에 임포트가 완성되었습니다
 . SCOTT 객체를 TEST(으)로 임포트하는 중입니다
 . SCOTT 객체를 TEST(으)로 임포트하는 중입니다
 . . 테이블                    "LARGE_EMP"(를)을 임포트 중
 ...
 ...................................................................................................................................................
 ...
 ................................................................
                                                       1091410개의 행이 엑스포트되었습니다
 익스포트가 경고 없이 정상적으로 종료되었습니다.
 .
                                                       1091410 행이 임포트되었습니다
 임포트가 경고 없이 정상적으로 종료되었습니다.


step_3)  target 에서 결과 확인 --> step_2) 작업중에 건수가 증가하는것을 볼수 있다


   COUNT(*)
 ----------
     458738

 MIGDB_TEST> /

   COUNT(*)
 ----------
     491505

 MIGDB_TEST> /

   COUNT(*)
 ----------
     524272

 MIGDB_TEST> /

   COUNT(*)
 ----------
     557039

 MIGDB_TEST> /

   COUNT(*)
 ----------
     589806


(참고)



일반적으로 다른 스키마로의 import 작업시에는 system 유저로 작업을 수행 하며,

fromuser , touser 의 옵션을 사용하여야 하나

Named Pipe를 이용할경우에는 fromuser, touser 옵션을 사용하지 않고 직접 해당 유저에서 작업이 이루어 진다.

반응형
Posted by [PineTree]