cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804

问题: 使用cx_Oracle连接oracle时报错cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804

sample code:
import cx_Oracle
conn = cx_Oracle.connect(user,pwd, self.ois_tns)

解决: 排查服务器执行该代码的Linux用户下的 .bash_profile中,关于oracle的环境变量设置情况,如下:

export ORACLE_HOME=/test/home/oracle/product/11.2.0.4
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin

测试通过。

如果在airflow DAG任务连接oracle,可以将上述变量配置到 .airflow_profile里。

你可能感兴趣的:(Oracle,oracle,python)