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… $ jstack 3000 | awk '{if ($1 == "\"Thread-9\"") {i = 1;print $0} else if (i == 1 && $0 != "") {print $0}... »
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 site for other articles as it relates to this. The awk script below will... »
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 variables used for that execution and how many I/O’s and seconds it required. This... »
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 what is below. $ awk --version GNU Awk 3.1.5 Copyright (C) 1989, 1991-2005... »
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)} END {print "\n"}' 01101001 01100110 00100000 01111001 01101111 01110101 00100000 01100011 01100001 01101110 00100000 0111001... »
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, if you were asked to use any tool imaginable, how would you format the... »