zoukankan      html  css  js  c++  java
  • python 监控oracle 数据库

    import cx_Oracle
    import os
    
    db = cx_Oracle.connect('**********')
    print "Show Oracle Version: " + db.version
    
    cursor = db.cursor()
    sql = "select  d.deployment_id from dpl_deployment d join dpl_deployment_file f on d.deployment_id = f.deployment_id where d.org_scope like '*:*' and (relative_path like '%merch%' or relative_path like '%item%') order by deployment_id desc"
    
    cursor.execute(sql)
    data = cursor.fetchall()
    cursor.close()
    db.close()
    
    print "the current dir and file: " +os.getcwd()
    os.listdir('/root/code')
    
    hf = open("./sql.out", 'r')
    history_num = hf.read()
    hf.close()
    
    f = open("./sql.out", "w")
    for row in data:
        for num in row:
            f.write(str(num))
            f.write("
    ")
            print num
    f.close()
    
    cf = open("./sql.out", 'r')
    current_num = cf.read()
    cf.close()
    
    if history_num==current_num:
    
        print 'no bad file found'
    else:
        print 'bad file found'
  • 相关阅读:
    Templet
    linux command
    Codeforces Daily
    Programming Contest Challenge Book
    STL
    Struct
    Some of GDUFE
    [屯题] DP系列
    [颓废]ws_fqk省选前刷题记录
    [SDOI2009][BZOJ1876] SuperGCD|高精度|更相减损术
  • 原文地址:https://www.cnblogs.com/peter1994/p/7451755.html
Copyright © 2011-2022 走看看