Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: October 20, 2016 - 10:42 am UTC

Last updated: October 22, 2016 - 6:02 am UTC

Version: 11.2.0.3

Viewed 1000+ times

You Asked

Hi ,

I need your help to find alert log text data between a range of dates eg: 10 june 2016 to 11 june 2016 in linux RHEL 6 ,as my alert log file is very big i can't do that manually. Your help will be appreciated ,thanks in advance.

regards.

and Connor said...

awk can do that easily.

<code>
[oracle@host122 trace]$ awk '/^2016-10-05/, /^2016-10-08/' alert_db122.log
2016-10-05T05:04:31.435862+01:00
Starting ORACLE instance (normal) (OS id: 7921)
2016-10-05T05:04:31.477859+01:00
CLI notifier numLatches:3 maxDescs:519
2016-10-05T05:04:31.554379+01:00
...
<code>

Your date formats might differ, but you get the idea. In my case, I was looking for Oct 5th to Oct 7th. (I end the search with the *first* entry on Oct 8th)

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

adrci

Mikhail Velikikh, October 21, 2016 - 6:20 am UTC

Hello,
A short adrci script can do that
[oracle@comp2364 ~]$ cat script1.adr
set home diag/rdbms/cdb2/cdb2 ; 
show alert -p "originating_timestamp > '2016-10-20 08:04:24' and originating_timestamp < '2016-10-20 08:04:50'" -term
[oracle@comp2364 ~]$ adrci script=script1.adr

ADRCI: Release 12.1.0.2.0 - Production on Fri Oct 21 13:20:04 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01/app/oracle"

ADR Home = /u01/app/oracle/diag/rdbms/cdb2/cdb2:
*************************************************************************
2016-10-20 08:04:24.935000 +07:00
Opening pdb PDB_TC (6) with no Resource Manager plan active
Pluggable database PDB_TC opened read write
Completed: alter pluggable database pdb_tc open
create tablespace users datafile size 10M autoextend on next 100M maxsize 1G
2016-10-20 08:04:26.629000 +07:00
Completed: create tablespace users datafile size 10M autoextend on next 100M maxsize 1G
alter database default tablespace users
Completed: alter database default tablespace users
2016-10-20 08:04:28.309000 +07:00
Resize operation completed for file# 196, old size 10240K, new size 112640K
2016-10-20 08:04:32.860000 +07:00
Resize operation completed for file# 196, old size 112640K, new size 215040K
2016-10-20 08:04:37.094000 +07:00
Resize operation completed for file# 196, old size 215040K, new size 317440K
2016-10-20 08:04:41.944000 +07:00
Resize operation completed for file# 196, old size 317440K, new size 419840K
2016-10-20 08:04:47.361000 +07:00
Resize operation completed for file# 196, old size 419840K, new size 522240K

You may specify many other columns in your condition that are documented here: https://docs.oracle.com/database/121/SUTIL/GUID-8D62D6A0-99F4-465C-B088-5CCF259B7D80.htm#GUID-8D62D6A0-99F4-465C-B088-5CCF259B7D80__BGBBICGI
Connor McDonald
October 22, 2016 - 6:02 am UTC

Nice input.

Thanks

A reader, October 21, 2016 - 10:09 am UTC

thanks Mr. Donald for this help.