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

created at 08-20-2021 views: 91

problem description

When using the python package cx_Oracle, an error is always reported when setting up a scheduled task on the server. The error content is like the title, but it is no problem to run it alone.


Add a few lines of code before the script, which is a perfect solution. The environment variable path is configured according to your own path.

import os

os.environ["ORACLE_HOME"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1'
os.environ["ORACLE_BASE"] = '/home/oracle/app/oracle'
os.environ["ORACLE_SID"] = 'orcl'
os.environ["LD_LIBRARY_PATH"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib:/lib:/usr/lib'
created at:08-20-2021
edited at: 08-20-2021: