Simple today. I just wanted to ensure I had this in case I need to cut and paste it later 🙂
#!/home/oracle/local/bin/python
import cx_Oracle, string
connection = cx_Oracle.connect(mode = cx_Oracle.SYSDBA)
cursor = connection.cursor()
cnt=cursor.execute("select * from v$database")
colcount=len(cnt.description)
for row in cursor.fetchall():
print "-----------------------------------------------"
for col in range(colcount):
print string.ljust(cursor.description[col][0],40) + str(row[col])
print "-----------------------------------------------"
cursor.close()
connection.close()