프린트 하기

OS환경 : Oracle Linux 7.6 (64bit)


DB 환경 : PostgreSQL 10, PostGIS 2.5.3


방법 : PostgreSQL 10, oracle fdw extension 생성방법

먼저 github에서 oracle_fdw 2.1.0 다운로드

https://github.com/laurenz/oracle_fdw/releases/tag/ORACLE_FDW_2_1_0



오라클 클라이언트 및 sdk 다운로드

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html



오라클 클라이언트 및 sdk압축해제

1
2
3
# su - root
# unzip instantclient-basic-linux.x64-11.2.0.4.0.zip 
# unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip 



.bash_profile 수정

1
2
3
4
# su - postgres
$ vi .bash_profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/pgsql-10/lib:/usr/local/lib:/root/instantclient_11_2
export oracle_home=/root/instantclient_11_2

LD_LIBRARY_PATH 에 /root/instantclient_11_2 추가

export oracle_home = /root/instantclient_11_2 생성



oracle fdw 압축해제

1
# unzip oracle_fdw-ORACLE_FDW_2_1_0.tar.gz



oracle fdw 폴더로 이동 후 make 실행

1
2
3
4
5
6
7
8
# cd oracle_fdw-ORACLE_FDW_2_1_0/
# make
.
.
.2.0.3/client64/lib 
/usr/bin/ld: cannot find -lclntsh
collect2: error: ld returned 1 exit status
make: *** [oracle_fdw.so] Error 1
 

에러 발생



lclntsh 파일이 있는지 확인

1
2
# find instantclient_11_2/ -name "*lntsh*"
instantclient_11_2/libclntsh.so.11.1



instantclient_11_2 폴더에 있는것을 확인함

cp 명령으로 libclntsh.so 생성

1
2
# cd instantclient_11_2/
# cp libclntsh.so.11.1 libclntsh.so



make 재실행

1
2
# cd oracle_fdw-ORACLE_FDW_2_1_0/
# make

성공함



make install 실행

성공함



psql 접속 후 oracle_fdw Extension 생성

1
2
3
4
5
6
7
8
# su - postgres
Last login: Tue Oct 29 07:10:39 KST 2019 on pts/0
$ psql
psql (10.10)
Type "help" for help.
 
postgres=# CREATE EXTENSION oracle_fdw;
CREATE EXTENSION

정상적으로 생성됨



pg_catalog.pg_available_extensions에서 확인

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
postgres=# select * from pg_catalog.pg_available_extensions;
          name          | default_version | installed_version |                               comment                        
        
------------------------+-----------------+-------------------+--------------------------------------------------------------
--------
 hstore_plpython2u      | 1.0             |                   | transform between hstore and plpython2u
 dblink                 | 1.2             |                   | connect to other PostgreSQL databases from within a database
 plpgsql                | 1.0             | 1.0               | PL/pgSQL procedural language
 hstore_plpythonu       | 1.0             |                   | transform between hstore and plpythonu
 adminpack              | 1.1             |                   | administrative functions for PostgreSQL
 insert_username        | 1.0             |                   | functions for tracking who changed a table
 amcheck                | 1.0             |                   | functions for verifying relation integrity
 dict_int               | 1.0             |                   | text search dictionary template for integers
 seg                    | 1.1             |                   | data type for representing line segments or floating-point in
tervals
 autoinc                | 1.0             |                   | functions for autoincrementing fields
 intagg                 | 1.1             |                   | integer aggregator and enumerator (obsolete)
 bloom                  | 1.0             |                   | bloom access method - signature file based index
 dict_xsyn              | 1.0             |                   | text search dictionary template for extended synonym processi
ng
 btree_gin              | 1.2             |                   | support for indexing common datatypes in GIN
 fuzzystrmatch          | 1.1             |                   | determine similarities and distance between strings
 intarray               | 1.2             |                   | functions, operators, and index support for 1-D arrays of int
egers
 btree_gist             | 1.5             |                   | support for indexing common datatypes in GiST
 chkpass                | 1.0             |                   | data type for auto-encrypted passwords
 hstore                 | 1.4             |                   | data type for storing sets of (key, value) pairs
 citext                 | 1.4             |                   | data type for case-insensitive character strings
 lo                     | 1.1             |                   | Large Object maintenance
 cube                   | 1.2             |                   | data type for multidimensional cubes
 hstore_plperl          | 1.0             |                   | transform between hstore and plperl
 hstore_plperlu         | 1.0             |                   | transform between hstore and plperlu
 earthdistance          | 1.1             |                   | calculate great-circle distances on the surface of the Earth
 ltree                  | 1.1             |                   | data type for hierarchical tree-like structures
 file_fdw               | 1.0             |                   | foreign-data wrapper for flat file access
 isn                    | 1.1             |                   | data types for international product numbering standards
 tcn                    | 1.0             |                   | Triggered change notifications
 ltree_plpython2u       | 1.0             |                   | transform between ltree and plpython2u
 ltree_plpythonu        | 1.0             |                   | transform between ltree and plpythonu
 tablefunc              | 1.0             |                   | functions that manipulate whole tables, including crosstab
 moddatetime            | 1.0             |                   | functions for tracking last modification time
 pgstattuple            | 1.5             |                   | show tuple-level statistics
 postgres_fdw           | 1.0             |                   | foreign-data wrapper for remote PostgreSQL servers
 pageinspect            | 1.6             |                   | inspect the contents of database pages at a low level
 pg_visibility          | 1.2             |                   | examine the visibility map (VM) and page-level visibility inf
o
 refint                 | 1.0             |                   | functions for implementing referential integrity (obsolete)
 pg_buffercache         | 1.3             |                   | examine the shared buffer cache
 xml2                   | 1.1             |                   | XPath querying and XSLT
 pg_freespacemap        | 1.2             |                   | examine the free space map (FSM)
 timetravel             | 1.0             |                   | functions for implementing time travel
 pg_prewarm             | 1.1             |                   | prewarm relation data
 pgcrypto               | 1.3             |                   | cryptographic functions
 pgrowlocks             | 1.2             |                   | show row-level locking information
 pg_stat_statements     | 1.6             |                   | track execution statistics of all SQL statements executed
 sslinfo                | 1.2             |                   | information about SSL certificates
 tsm_system_rows        | 1.0             |                   | TABLESAMPLE method which accepts number of rows as a limit
 pg_trgm                | 1.3             |                   | text similarity measurement and index searching based on trig
rams
 tsm_system_time        | 1.0             |                   | TABLESAMPLE method which accepts time in milliseconds as a li
mit
 unaccent               | 1.1             |                   | text search dictionary that removes accents
 uuid-ossp              | 1.1             |                   | generate universally unique identifiers (UUIDs)
 postgis                | 2.5.3           | 2.5.3             | PostGIS geometry, geography, and raster spatial types and fun
ctions
 postgis_tiger_geocoder | 2.5.3           |                   | PostGIS tiger geocoder and reverse geocoder
 postgis_topology       | 2.5.3           |                   | PostGIS topology spatial types and functions
 oracle_fdw             | 1.1             | 1.1               | foreign data wrapper for Oracle access
(56 rows)


참조 : http://www.gurubee.net/lecture/2962