Skip to Content
PostgreSQL 10 Administration Cookbook - Fourth Edition
book

PostgreSQL 10 Administration Cookbook - Fourth Edition

by Simon Riggs, Gianni Ciolli
May 2018
Intermediate to advanced content levelIntermediate to advanced
576 pages
30h 25m
English
Packt Publishing
Content preview from PostgreSQL 10 Administration Cookbook - Fourth Edition

How to do it…

Here, we provide stepwise instructions on how to connect to an Oracle server using oracle_fdw:

  1. First, we ensure that the extension is loaded:
        CREATE EXTENSION IF NOT EXISTS oracle_fdw;
  1. Then, we configure the server and the user mapping:
        CREATE SERVER myserv        FOREIGN DATA WRAPPER oracle_fdw        OPTIONS (dbserver '//myhost/MYDB');        CREATE USER MAPPING FOR myuser        SERVER myserv;
  1. Then, we create a PostgreSQL foreign table with the same column names as the source table in Oracle, and with compatible column types:
        CREATE FOREIGN TABLE mytab(id bigint, descr text)        SERVER myserv        OPTIONS (user 'scott', password 'tiger');
  1. Now, we can try to write to the table:
        INSERT INTO mytab VALUES (-1, 'Minus One');
  1. Finally, we are able to read ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PostgreSQL 13 Cookbook

PostgreSQL 13 Cookbook

Vallarapu Naga Avinash Kumar
PostgreSQL 9 Administration Cookbook - Second Edition

PostgreSQL 9 Administration Cookbook - Second Edition

Simon Riggs, GIANNI CIOLLI, Hannu Krosing, Gabriele Bartolini

Publisher Resources

ISBN: 9781788474924Supplemental Content