필자의 윈도 PC 에는 오라클 10g 데이터베이스와 PPAS 9.2 가 같이 깔려 있습니다.
PPAS 에서 오라클로의 데이터베이스 링크를 생성해보겠습니다.
필자의 PPAS 설치 디렉토리는 다음과 같습니다.
d:\PostgresPlus\9.2AS\
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';
edb=# select * from dba_db_links;
owner | db_link | type | username | host
--------------+--------------+---------+----------+-------------------------
ENTERPRISEDB | LOCAL_ORACLE | REDWOOD | ORADBA | //LOCALHOST:1521/ORA10G
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]$