Friday, April 12, 2019

Check database status using python

Check database status using python


save this file as dbstatus.py




import cx_Oracle


db=cx_Oracle.connect("hr","hr","192.168.43.68/ind")

cursor=db.cursor()
cursor.execute(""" select name,open_mode from v$database """)

for count in cursor:
    print(count)










Output:

"C:\Program Files\Python37\python.exe" C:/Users/ANURAG/PycharmProjects/phython_master/conn.py
('IND', 'READ WRITE')

Process finished with exit code 0

1 comment:

  1. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man learn Oracle SOA Online Training

    ReplyDelete