def rman(self, finalscript):
self._setenv()
debug("RMAN execution starts")
BackupLogger.close()
starttime = datetime.now()
with TemporaryFile() as f:
p = Popen([os.path.join(self.oraclehome, 'bin', 'rman'), "log", BackupLogger.logfile, "append"], stdout=f, stderr=f, stdin=PIPE)
# Send the script to RMAN
p.communicate(input=finalscript)
endtime = datetime.now()
BackupLogger.init()
debug("RMAN execution time %s" % (endtime-starttime))
# If RMAN exists with any code except 0, then there was some error
if p.returncode != 0:
error("RMAN execution failed with code %d" % p.returncode)
raise Exception('rman', "RMAN exited with code %d" % p.returncode)
else:
debug("RMAN execution successful")
评论列表
文章目录