1 2 3 4 5 6 7 8 9 10 11 12 13
| import dmPython conn=dmPython.connect(user='SYSDBA',password='SYSDBA',server='localhost', port=5236) cursor=conn.cursor() result=cursor.execute("select concat('sp_close_session(',s.sess_id,');') from v$sessions s, v$trxwait t where s.trx_id = t.wait_for_id and s.state='IDLE' and s.sql_text like 'select count(docresourc0_.id) as col_0_0_ from doc_resources docresourc0_%' order by s.sess_id"); result=cursor.fetchall() if result == []: print ('ok') else: print (result[0][0]) print ('error') cursor.execute(result[0][0]).fetchall() cursor.close() conn.close()
|