【说明】在使用cx_Oracle插件编写python脚本时,把脚本加入crontab中,出现以下错误。

【错误】

Traceback (most recent call last):
  File "/home/oracle/check_ssl.py", line 97, in <module>
    get_domain()
  File "/home/oracle/check_ssl.py", line 49, in get_domain
    cx_Oracle.init_oracle_client(lib_dir=r'/u02/oracle/11.2.0/lib',config_dir=r'/u02/oracle/11.2.0/lib')
cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804

【解决】
注意:所有操作均在oracle用户下操作。
通过把python命令写到shell脚本

#!/bin/bash
#把oracle的所有环境变量在脚本中生效
. ~/.bash_profile
python check_ssl.py

标签: python, oracle, cx_oracle

评论已关闭