Hi
No rush we are all busy.
I wrote up a detail for ease of understanding. Sorry if it is long. See below:
My operating system is:
OPERATING SYSTEM:
uname -a
SunOS snslcsunu04 5.10 Generic_150400-13 sun4u sparc SUNW,SPARC-Enterprise
DESCRIPTION OF PROBLEM:
We have 5 servers the each have over a hundred oracle databases. The issue isn’t with the databases it is with the servers. We are getting a lot of dropped connections on the server but don’t know which databases are refusing connections. I need to design a metric that can track those databases via numbers as to which one is getting worse or better.
We need to analyze the trace files every day on the “TNS-12535: TNS
peration timed out” for example for all the databases in the
/oracle/diag/rdbms/*/*/trace directory. Where the * is the name of the database twice for clarification.
Here is MY THINKING and what I got so far.
find /oracle/diag/rdbms/*/*/trace –type f -name '*d00*.trc' -mtime 0 -exec egrep -c 'TNS-12535: TNS
peration timed out' '{}' '+'
OUTPUT:
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d001_21751.trc:11
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d000_21750.trc:27
/oracle/diag/rdbms/ghijkl/ghijkl/trace/ghijkl_d001_22002.trc:61
/oracle/diag/rdbms/ghijkl/ghijkl/trace/ghijkl_d000_22001.trc:57
GOAL: My final OUTPUT will be the same as above but with lesser numbers and/or lesser lines.
Now I need to go through these 4 above looking for the data in this case ‘2015-01-26’. First though I need to remove the excess information on the string the colon and the number . I do that by using awk. Here is my syntax:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 -exec egrep -c 'TNS-12535: TNS
peration timed out' '{}' '+' | awk -F: '{print $1}'
OUTPUT: Notice there are no trailing : or numbers.
/oracle/diag/rdbms/musidp/musidp/trace/musidp_d001_21751.trc
/oracle/diag/rdbms/musidp/musidp/trace/musidp_d000_21750.trc
/oracle/diag/rdbms/musiop/musiop/trace/musiop_d001_22002.trc
/oracle/diag/rdbms/musiop/musiop/trace/musiop_d000_22001.trc
You would think that the following addition to the syntax would work
| egrep –c ‘{}’ ‘+’ would work returning some or all of the same output files as before but fewer numbers for example.
These numbers are what I am looking for. These represent all trace files for all databases for only today that had disconnects with different timestamps during that day.
Ex.
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d001_21751.trc:
6
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d000_21750.trc:
14
/oracle/diag/rdbms/ghijkl/ghijkl/trace/ghijkl_d001_22002.trc:
25
/oracle/diag/rdbms/ghijkl/ghijkl/trace/ghijkl_d000_22001.trc:
31
But it doesn’t. It produces the following:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 -exec egrep 'TNS-12535: TNS
peration timed out' '{}' '+' | awk -F:| egrep -c '2015-01-26'
OUTPUT:
awk: syntax error near line 1
awk: bailing out near line 1
0
Can someone please suggest what I is written wrong in the syntax above or maybe an entirely another way of accomplishing this project?
It would be much appreciated.
Thanks in advance.