数据库
首页 > 数据库> > lightdb oracle_fdw报ERROR: error connecting to Oracle: OCIEnvCreate failed to create environment han

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

作者:互联网

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,问题解决。

标签:handle,lightdb,create,haha,oracle,scott,oradb,OCIEnvCreate
来源: https://www.cnblogs.com/zhjh256/p/16434968.html