compareinitora
import readinitora, cx_oracle
def readliveparams(instance):
liveparams = {}
orcl = cx_oracle.connect( scott/tiger@ instance)
curs = orcl.cursor()
curs.execute( 0select name, value from v$parameter )
row = curs.fetchone()
while row:
(param, val) = (row[0], row[1])
liveparams[param.upper()] = val
row = curs.fetchone()
return liveparams
filename = init_orcl.ora
def html(initorafile, instance):
result = ""
fileparams = readinitora.read(initorafile)
liveparams = readliveparams(instance)
for (param, val) in fileparams.items():
liveval = liveparams.get(param)
if liveval == val:
result = "%s \n" % (val)
else
result = "%s (file) %s (live) \n" % (val, liveval)
return result
import cherrypy
class webapp:
def index(self, initorafile= init.ora , instance= orcl ):
return html(initorafile, instance)
index.exposed = true
cherrypy.root = webapp()
cherrypy.server.start() |