Skip to content

Instantly share code, notes, and snippets.

@stelf
Last active July 19, 2021 09:37
Show Gist options
  • Select an option

  • Save stelf/2affdf39e418ae1fbd87d19d2c268e5c to your computer and use it in GitHub Desktop.

Select an option

Save stelf/2affdf39e418ae1fbd87d19d2c268e5c to your computer and use it in GitHub Desktop.
Oracle 19 foreign data wrapper in PostgreSQL setup
--- this GIST is available under the conditions of
--- https://creativecommons.org/licenses/by/4.0/
CREATE EXTENSION oracle_fdw;
drop server orcl19;
CREATE SERVER orcl19 FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver '//localhost:1521/ORCL19');
GRANT USAGE ON FOREIGN SERVER orcl19 TO postgres;
drop user mapping for postgres server orcl19;
CREATE USER MAPPING FOR postgres SERVER orcl19
OPTIONS (user 'username', password 'password');
drop foreign table oradb;
drop foreign table oratab;
--- demo from BGOUG19 showcase
create foreign table vintage (
id integer options (key 'true') not null,
name character varying(32),
dbname character varying(32)
) server orcl19 options (schema 'C##BGOUG', table 'VINTAGE');
select * from vintage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment