I'm want use Postgresql 9.3 in CentOS 7 and add extention oracle_fdw. but when use this extenstion i get error OCIEnvCreate failed to create environment handle after installing oracle_fdw. please help me!!!
my roadmap: install postgresql 9.3 from postgres rpm. install oracle instante client 11.2g with rpm files from oracle site. install oracle-instantclient11.2-basic & oracle-instantclient11.2-sqlplus & oracle-instantclient11.2-devel.
I use this question : OCIEnvCreate failed to create environment handle after installing oracle_fdw
my variables : /etc/profile : export PG_HOME=/usr/pgsql-9.3 export ORACLE_HOME=/usr/lib/oracle/11.2/client64 export TNS_ADMIN=$ORACLE_HOME/network/admin export PATH=$ORACLE_HOME/bin:$PG_HOME/bin/:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME:$PG_HOME/lib:$LD_LIBRARY_PATH
tnsnames.ora : I create /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora and edit it
BEH = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.102.107)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL) ) )
when I use sqlplus in command line i can connect to sqlplus user/pass@BEH and can select from tables.
so i go in psql in my database and execute this commands : 1- CREATE EXTENSION oracle_fdw; resutlt : Query returned successfully.
2- CREATE SERVER beh FOREIGN DATA WRAPPER oracle_fdw OPTIONS (dbserver 'AMI_BEH'); OR CREATE SERVER beh FOREIGN DATA WRAPPER oracle_fdw OPTIONS (dbserver '//172.18.102.107:1521/ORCL');
result : Query returned successfully.
3- CREATE USER MAPPING FOR postgres SERVER beh OPTIONS (user 'ORACLE_USER',password 'ORACLE_PASS'); result : Query returned successfully.
4- CREATE FOREIGN TABLE bl ("OLD_DYDJ" character varying(20) , "DYDJ" character varying(20) , "MC" character varying(128) ) SERVER beh OPTIONS (table 'DYDJ_DY'); result : Query returned successfully.
5- SELECT * FROM bl; result : error connecting to Oracle: OCIEnvCreate failed to create environment handle.
I chec sqlplus in postgres user (su - postgres) and I can connect to oracle with top sqlplus command.
then i search in internet and found http://ift.tt/1B1nOWj .
i check : 1- SELECT pg_backend_pid(); result : 3854 2- ps -p3854 -oppid= result : 1902 3- cat /proc/1902/environ | xargs -0 -n1 result : PG_GRANDPARENT_PID=1 USER=postgres PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin PWD=/ PGLOCALEDIR=/usr/pgsql-9.3/share/locale LANG=en_US.UTF-8 PGSYSCONFDIR=/etc/sysconfig/pgsql SHLVL=1 HOME=/var/lib/pgsql LOGNAME=postgres PGDATA=/var/lib/pgsql/9.3/data _=/usr/pgsql-9.3/bin/postgres
please help me. thanks
Aucun commentaire:
Enregistrer un commentaire