I pushed out three new Python scripts that might be helpful to Oracle DBAs. They are in my miscpython repository.
- remotescript.py – run Unix/Linux commands on a remote server
- dbversion.py – Get the version from a database – i.e. 184.108.40.206
- tnsnamesparser.py – Read through tnsnames.ora file and pull out information
Might be helpful to some people.
How can I connect to the multiple oracle databases using python ?
I am able to connect successfully for a single database with no issue !!!
con = cx_Oracle.connect(‘pythonhol/welcome@localhost/orcl’)
cur = con.cursor()
cur.execute(‘select * from departments order by department_id’)
for result in cur:
Thank you for your comment. You can have two connection variables and two cursor variables, one for each database. Here is an example: