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. 11.2.0.4
- tnsnamesparser.py – Read through tnsnames.ora file and pull out information
Might be helpful to some people.
Bobby
Hi Bobby,
How can I connect to the multiple oracle databases using python ?
I am able to connect successfully for a single database with no issue !!!
import cx_Oracle
con = cx_Oracle.connect(‘pythonhol/welcome@localhost/orcl’)
cur = con.cursor()
cur.execute(‘select * from departments order by department_id’)
for result in cur:
print result
cur.close()
con.close()
Thanks,
Thank you for your comment. You can have two connection variables and two cursor variables, one for each database. Here is an example:
Bobby