설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


총 게시물 174건, 최근 0 건
   

PPAS 와 오라클 연동하기(디비링크 생성)

글쓴이 : PostgresDBA 날짜 : 2013-07-22 (월) 11:50 조회 : 20663
필자의 윈도 PC 에는 오라클 10g 데이터베이스와 PPAS 9.2 가 같이 깔려 있습니다.
PPAS  에서 오라클로의 데이터베이스 링크를 생성해보겠습니다.

필자의 PPAS 설치 디렉토리는 다음과 같습니다.
d:\PostgresPlus\9.2AS\

d:\PostgresPlus\9.2AS\oracle 디렉토리를 생성한후에 오라클 instant client (http://www.oracle.com/technetwork/database/features/instant-client/index.html)를 다운받아서 풀어넣습니다.

postgresql.conf 설정화일에 아래를 추가합니다.
...
oracle_home ='d:\PostgresPlus\9.2AS\oracle' # path to the Oracle home directory;
# only used by OCI Dblink; defaults
# to ORACLE_HOME environment variable.
...
그 다음엔 PPAS 의 edb 데이터베이스로 로그인한후에 아래와 같이 디비링크를 만들면 됩니다.

edb=# create database link local_oracle connect to oradba identified by 'xxxx' u
sing oci '//localhost:1521/ORA10G';
CREATE DATABASE LINK
edb=# select * from dba_db_links;
    owner     |   db_link    |  type   | username |          host
--------------+--------------+---------+----------+-------------------------
 ENTERPRISEDB | LOCAL_ORACLE | REDWOOD | ORADBA   | //LOCALHOST:1521/ORA10G
(1 row)


edb=# select * from v$version@local_oracle;
                              banner
------------------------------------------------------------------
 Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
 PL/SQL Release 10.2.0.3.0 - Production
 CORE    10.2.0.3.0      Production
 TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
 NLSRTL Version 10.2.0.3.0 - Production
(5 rows)


edb=#

오 잘되는 군요!

그리고, 첨언하자면 d:\PostgresPlus\9.2AS\oracle 에 존재하는 oci.dll 등의 dll 을 제대로 로딩 하지 못해서,
d:\PostgresPlus\9.2AS\bin 경로로 오라클 *.dll 을 복사하여서 테스트했습니다.

참고문서: d:\PostgresPlus\9.2AS\doc\contrib\README-dblink_ora_setup.txt

이상 윈도우에서 테스트했지만, 물론 리눅스서버에서도 잘 됩니다.
참고로 아래는 리눅스환경에서의 정보들입니다.

1.환경변수 세팅
[enterprisedb@dpcpdb01 oracle]$ env|grep oracle
LD_LIBRARY_PATH=/PostgresPlus/9.2AS/oracle
...
[enterprisedb@dpcpdb01 oracle]$

2. 설정화일 변경
postgresql.conf
oracle_home = '/PostgresPlus/9.2AS/oracle'      # path to the Oracle home directory;
                                        # only used by OCI Dblink; defaults
                                        # to ORACLE_HOME environment variable.

3. 오라클 인스턴트 라이브러리 설치
[enterprisedb@dpcpdb01 oracle]$ pwd
/PostgresPlus/9.2AS/oracle
[enterprisedb@dpcpdb01 oracle]$ ls -l
total 209916
-rwxrwxr-x 1 enterprisedb dba     29396 May 25 02:20 adrci
-rw-rw-r-- 1 enterprisedb dba       440 May 25 02:20 BASIC_README
-rwxrwxr-x 1 enterprisedb dba     43154 May 25 02:20 genezi
-rwxrwxr-x 1 enterprisedb dba   6750135 May 25 02:20 libclntshcore.so.12.1
lrwxrwxrwx 1 enterprisedb dba        17 Jul 22 10:29 libclntsh.so -> libclntsh.so.12.1
-rwxrwxr-x 1 enterprisedb dba  55453863 May 25 02:20 libclntsh.so.12.1
-r-xr-xr-x 1 enterprisedb dba   6277261 May 25 02:20 libnnz12.so
-rwxrwxr-x 1 enterprisedb dba   2523156 May 25 02:20 libocci.so.12.1
-rwxrwxr-x 1 enterprisedb dba 136162781 May 25 02:20 libociei.so
-r-xr-xr-x 1 enterprisedb dba    152544 May 25 02:20 libocijdbc12.so
-r-xr-xr-x 1 enterprisedb dba    330074 May 25 02:20 libons.so
-rwxrwxr-x 1 enterprisedb dba    114225 May 25 02:20 liboramysql12.so
-r--r--r-- 1 enterprisedb dba   3389454 May 25 02:20 ojdbc6.jar
-r--r--r-- 1 enterprisedb dba   3397734 May 25 02:20 ojdbc7.jar
-rwxrwxr-x 1 enterprisedb dba    219437 May 25 02:20 uidrvci
-rw-rw-r-- 1 enterprisedb dba     71231 May 25 02:20 xstreams.jar
[enterprisedb@dpcpdb01 oracle]$


방울이 2013-11-06 (수) 00:33
ppas가 아닌 오픈소스 postgresql에스는 오라클 db link가 안되나요?
댓글주소
cloudy 2014-07-07 (월) 10:41
postgreSQL은 conventional DB-LINK가 작동되지 않습니다
postgreSQL에서 DB-lINK를 사용하고 싶으시면 oracle-FDW 를 이용해서 사용하시면 됩니다
댓글주소
톰켓 2017-05-11 (목) 16:52
혹시 오라클이 아닌 tibero나 mysql등 다른 db와도 dblink 가 가능한지요?
댓글주소
주킹 2017-05-12 (금) 08:38
tibero는 모르겠고 mysql은 fdw로 가능한대요 아무래도 이기종간 dblink는 성능상 권고하지 않고요...
ETL이나 EAI솔루션을 사용하는것을 권고합니다.
댓글주소
   

postgresdba.com