I need the following output :
File caused while executing ?/rdbms/admin/prvtlock.plb
Corresponding Error found in apply log at time 2018-10-17 12:28:12
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
create or replace package body dbms_lock wrapped
*
ERROR at line 1:
ORA-04021: timeout occurred while waiting to lock object SYS.DBMS_LOCK
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Here's what I tried but it didn't work:
import re
import os
import datetime
from datetime import timedelta
f3 = open (r"file1", 'r' )
st=f3.read()
if re.search('ORA-04021(.*)lock(.*)',st):
#y = re.findall ( "(\w{3})\s+([0-9]{2})\s+(\d+):(\d+):(\d+)\s+(\d+)", st )
y=re.findall("[A-Z][a-z][a-z] [ 123][0-9] [012][0-9]:[0-5][0-9]:[0-5][0-9] [0-9][0-9][0-9][0-9]",st)
y1 = datetime.datetime.strptime(y[0], '%b %d %H:%M:%S %Y')
y2 = datetime.datetime.strptime(y[1], '%b %d %H:%M:%S %Y')
print "Start time: ",y1
print "End time: ",y2
f4 = open (r"file2", 'r')
string1=f4.readlines()
#print(string1)
for i in range(len(string1)):
if re.search ( r'\d\d\.\d\d\.\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9]', string1[i] ):
a = re.findall (r'\d\d\.\d\d\.\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9]', string1[i] )
#print a,i,type(a)
newtime = datetime.datetime.strptime ( a[0], '%d.%m.%y %H:%M:%S' )
print newtime
if newtime > y1 and newtime < y2:
if re.search ( r'ORA-04021', string1[i] ):
position=i
lastposition =position - 3
b = position
while True:
if re.search('INSTALL_FILE',string1[b]):
print "\n Error caused while executing ",string1[b + 2]
break
#elif lastposition==len(string1)-1:
# break
else: