I encountered the error when I used below the script on Postgres 13.9 (oracle_fdw 2.4) on Windows 10 64-bit.
CREATE SERVER yf FOREIGN DATA WRAPPER oracle_fdw OPTIONS (dbserver 'yf');
CREATE USER MAPPING FOR postgres SERVER yf OPTIONS (user 'yonker', password 'his');
GRANT USAGE ON FOREIGN SERVER yf TO postgres;
SELECT oracle_diag('yf');
[HV00N]: ERROR: error connecting to Oracle: OCIAttrSet failed to set driver name in session handle
detail:ORA-24315: illegal attribute type
I can connect to oracle server with tnsname 'yf' using sqlplus.
The documentation states the requirements:
Oracle client version 11.2 or better is required.
The error is thrown when oracle_fdw tries to set OCI_ATTR_DRIVER_NAME
on the session handle, which was not available before Oracle 11. It is no problem to use an older Oracle server version, as long as you are using a less outdated client version.