- 목적 : postgresql에서 oracle 또는 mysql 데이터를 조회한다.
- 방안 : oracle_fdw, mysql_fdw 활용
주요 기능
- 데이터 조회 및 수정
- SQL 쿼리의 통합 실행
- 데이터 통합
설치방법
- oracle_fdw
git clone https://github.com/laurenz/oracle_fdw.git
cd oracle_fdw
make
sudo make install
CREATE EXTENSION oracle_fdw;
CREATE SERVER oracle_server
FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver '//oracle_host:1521/service_name');
CREATE USER MAPPING FOR postgres
SERVER oracle_server
OPTIONS (user 'oracle_user', password 'oracle_password');
CREATE FOREIGN TABLE oracle_table (
column1 INTEGER,
column2 VARCHAR
)
SERVER oracle_server
OPTIONS (schema 'oracle_schema', table 'oracle_table');
- mysql_fdw
git clone https://github.com/EnterpriseDB/mysql_fdw.git
cd mysql_fdw
make
sudo make install
CREATE EXTENSION mysql_fdw;
CREATE SERVER mysql_server
FOREIGN DATA WRAPPER mysql_fdw
OPTIONS (host 'mysql_host', port '3306', dbname 'mysql_db');
CREATE USER MAPPING FOR postgres
SERVER mysql_server
OPTIONS (user 'mysql_user', password 'mysql_password');
CREATE FOREIGN TABLE mysql_table (
column1 INTEGER,
column2 VARCHAR
)
SERVER mysql_server
OPTIONS (table 'mysql_table');