python自动杀死达梦锁死

该脚本自动查找达梦的锁死,并自动杀死。

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()

推荐python3运行该脚本。

本文为原创文章,转载请注明出处。

原文链接:https://850406.xyz/post/python自动杀死达梦锁死

评论(0)

还没有评论,来抢沙发吧~

验证码