-bash-4.1$ cat blocked_threads.awk #!/bin/awk -f { if ($0 ~ “- locked” || $0 ~ “- waiting to lock”) { s[i++]=$0 } } END { for (i in s) { if (s[i] ~ “waiting to lock”) { split(s[i],t) for (j in…
Category: Linux
Print thread dump for a single thread
We had an issue where a single thread was using all the CPU. We wanted to check it at the command line while troubleshooting. We used what is below… [atg@CMHLDECOMAP01 ~]$ jstack 3000 | awk ‘{if ($1 == “\”Thread-9\””) {i…
Open ports by interface
I often use what is below to get a listing of currently open ports by interface. If you find you can’t “see” a port from another computer, and… it is open on the IP to which you are trying to…
Reverse engineering a SQL replay script from a 10046 trace file
This will be the coup de grâce (but in a good way:)) if I can ever finish it. I have wanted to do this for years, and keep getting closer. Search for awk 10046 in the search bar on this…
Printing execution times with associated bind variables
In a previous post, we showed how you can extract the count of executions of a given SQL statement for a given bind variable. We recently found a need to print each execution a given SQL statement with the bind…
Comparing RPM’s between servers
Periodically, I will want to compare the RPM installations between two or more servers. Sometimes, I may not care about the specific versions of each RPM, but only that *some* version exists. To do this, I can use awk and…
Extracting SCN range from an online redo log or archived redo log
I can’t imagine that this would be useful in a well managed system, but if you find yourself with a “raw” log file that is not in the dictionary, you can at least extract the SCN range it encompasses using…
Converting ASCII to binary
This is pretty useless, but I know some people like this kind of thing 🙂 10:11:42 oracle@emgrid01 ~ >echo “if you can read this you are a geek” | xxd -b | awk ‘{printf(“%s %s %s %s %s %s “,$2,$3,$4,$5,$6,$7)}…
Creative ways to do simple things
I always like exercises such as this, especially for interview questions. In an interview, I am never looking for the correct answer as often as I am how the question is answered, and how creative the person is. For example,…
Using awk to extract bind variable values from a trace file
While troubleshooting a high CPU utilization problem recently, I found that half the sessions using a given database service were using a high amount of CPU, while the other were using a normal amount. Since I knew they were each…