<msg time='2014-10-22T22:00:32.924+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366' version='1'>
<txt>Thread 1 cannot allocate new log, sequence 377
</txt>
</msg>
<msg time='2014-10-22T22:00:32.924+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt>Private strand flush not complete
</txt>
</msg>
<msg time='2014-10-22T22:00:32.924+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt> Current log# 1 seq# 376 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo01.log
</txt>
</msg>
<msg time='2014-10-22T22:00:36.055+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt>Thread 1 advanced to log sequence 377 (LGWR switch)
</txt>
</msg>
<msg time='2014-10-22T22:00:36.055+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt> Current log# 2 seq# 377 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo02.log
</txt>
</msg>
<msg time='2014-10-22T22:00:36.522+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31491'>
<txt>Archived Log entry 340 added for thread 1 sequence 376 ID 0x5273f832 dest 1:
</txt>
</msg>
<msg time='2014-10-22T22:01:40.474+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31507'>
<txt>LNS: Standby redo logfile selected for thread 1 sequence 377 for destination LOG_ARCHIVE_DEST_2
</txt>
</msg>能读到 time的值和标签对 <txt>中的内容就够了</txt>
存放到tb_alert(occur_time date,message varchar2(200))就可以了。或者有什么简单的办法可以把xml数据展示为多行数据,
一个<msg></msg>中的内容对为一行。
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366' version='1'>
<txt>Thread 1 cannot allocate new log, sequence 377
</txt>
</msg>
<msg time='2014-10-22T22:00:32.924+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt>Private strand flush not complete
</txt>
</msg>
<msg time='2014-10-22T22:00:32.924+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt> Current log# 1 seq# 376 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo01.log
</txt>
</msg>
<msg time='2014-10-22T22:00:36.055+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt>Thread 1 advanced to log sequence 377 (LGWR switch)
</txt>
</msg>
<msg time='2014-10-22T22:00:36.055+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31366'>
<txt> Current log# 2 seq# 377 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo02.log
</txt>
</msg>
<msg time='2014-10-22T22:00:36.522+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31491'>
<txt>Archived Log entry 340 added for thread 1 sequence 376 ID 0x5273f832 dest 1:
</txt>
</msg>
<msg time='2014-10-22T22:01:40.474+08:00' org_id='oracle' comp_id='rdbms'
client_id='' type='UNKNOWN' level='16'
host_id='dataserver12' host_addr='172.16.10.12' module=''
pid='31507'>
<txt>LNS: Standby redo logfile selected for thread 1 sequence 377 for destination LOG_ARCHIVE_DEST_2
</txt>
</msg>能读到 time的值和标签对 <txt>中的内容就够了</txt>
存放到tb_alert(occur_time date,message varchar2(200))就可以了。或者有什么简单的办法可以把xml数据展示为多行数据,
一个<msg></msg>中的内容对为一行。
i:Integer;
clist:TStringList;
begin
clist:=TStringList.Create;
clist.LoadFromFile('1.xml');
XMLDocument1.XML.Clear;
XMLDocument1.XML.Text:='<?xml version="1.0" encoding="gb2312"?><ROOT>'+clist.Text+'</ROOT>';
XMLDocument1.Active:=true;
for i:=0 to XMLDocument1.DocumentElement.ChildNodes.Count-1 do
begin
Memo1.Lines.Add(
XMLDocument1.DocumentElement.ChildNodes[i].Attributes['time']+' '
+XMLDocument1.DocumentElement.ChildNodes[i].ChildNodes[0].Text
);
end;
clist.Free;
end;
<msg time='(.*?)' [\s\S]*?<txt>(.*)\r\n </txt>\r\n</msg>