DROP EXTENSION oracle_fdw cleanly removes the Oracle Foreign Data Wrapper and all its dependent objects from the current PostgreSQL database.
Remove the extension when Oracle connectivity is no longer required, you are migrating all data to PostgreSQL, or you need to reclaim superuser privileges that were granted for oracle_fdw.
Run DROP EXTENSION oracle_fdw;
in the target database. Add IF EXISTS
to avoid errors if the extension is already gone, and use CASCADE
to drop views, foreign tables, or objects that depend on oracle_fdw.
You need superuser or the CURRENT_USER
that owns the extension. Without the proper role, PostgreSQL raises an “must be owner of extension” error.
No. DROP EXTENSION only affects the current database. Repeat the command in every database that holds oracle_fdw objects.
Query pg_depend
or use \dx+ oracle_fdw
in psql to list dependencies. Refactor or archive foreign tables before executing CASCADE
.
The ecommerce team created foreign tables in oracle_inventory
. After migrating data to the local Products
table, they run:
-- drop Oracle foreign tables first
DROP FOREIGN TABLE IF EXISTS oracle_inventory.product_stock;
-- remove the extension safely
DROP EXTENSION IF EXISTS oracle_fdw CASCADE;
This cleans the schema while preserving native tables like Products
, Orders
, and Customers
.
Run \dx
in psql or query pg_extension
. oracle_fdw should no longer appear.
Yes. Use CREATE EXTENSION oracle_fdw;
after the shared library is available. Foreign tables must be recreated.
No. DROP EXTENSION only removes objects that belong to oracle_fdw or depend on it. Regular tables like Products or Orders remain intact.
No restart is needed. The change applies immediately after the transaction commits.