lightdb oracle_fdw报ERROR: error connecting to Oracle: OCIEnvCreate failed to create environment handle

create server oradb foreign data wrapper oracle_fdw options (dbserver '//10.20.30.199:1521/test');
create user mapping for USER server oradb options (user 'scott', password 'scott');
GRANT USAGE ON FOREIGN DATA WRAPPER oracle_fdw TO CURRENT_USER;
GRANT USAGE ON FOREIGN SERVER oradb TO CURRENT_USER;

create foreign table haha
( id int)
SERVER oradb OPTIONS (schema 'scott', table 'haha


[lightdb@hs-10-20-30-199 ~]$ ltsql -p 5435 -U scott -d scott
ltsql (13.3-22.2)
Type "help" for help.

scott@scott=# select * from haha;
ERROR: error connecting to Oracle: OCIEnvCreate failed to create environment handle
DETAIL:
scott@scott=#
scott@scott=#
scott@scott=#
scott@scott=#
scott@scott=#
scott@scott=#
scott@scott=# select * from haha;
ERROR: error connecting to Oracle: OCIEnvCreate failed to create environment handle
DETAIL:
 
解决方法:
安装oracle轻量客户端。oracle客户端可从https://www.oracle.com/database/technologies/instant-client/downloads.html下载。
export ORACLE_HOME=/home/lightdb/instantclient_21_6
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
 
重启lightdb,问题解决。
posted @ 2022-07-01 15:58  zhjh256  阅读(210)  评论(0编辑  收藏  举报