Archive for December, 2011

Extracting SCN range from an online redo log or archived redo log

Saturday, December 31st, 2011

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... »

Posted in Database, Oracle, Shell scripting | No Comments »

ASM device structure

Thursday, December 22nd, 2011

Today, we had an issue where the asmlib disk label was removed from a disk at some point in the past. When we added new storage and issued oracleasm scan disks , the disk was “cleaned”, rendering it unavailable on the server from which the scan command was run. The data itself was OK,... »

Posted in Database, Oracle | No Comments »

Converting ASCII to binary

Wednesday, December 14th, 2011

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... »

Posted in Linux, Shell scripting | No Comments »

Creative ways to do simple things

Tuesday, December 13th, 2011

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... »

Posted in Linux, Shell scripting | No Comments »

Additional cursor trace information in 11.2.0

Sunday, December 11th, 2011

Oracle has added a lot of additional trace output in the 10046 optimizer trace files. As I have posted previously, I find the output in these files to be useful not only for troubleshooting performance issues, but also understanding the business flow of the application in cases where I don’t have access to the... »

Posted in Database, Oracle, Python | No Comments »

Posting GV$SESSION_LONGOPS from a user procedure

Tuesday, December 6th, 2011

The GV$SESSION_LONGOPS view can save you if you are nervous about how much time a long running operation has remaining, and are asked for an update from someone in a higher “zip code”. Oracle posts an entry to this memory structure whenever an operation is expected to last more than six seconds. Note the... »

Posted in Database, Oracle, PL/SQL | No Comments »

Which transaction is being rolled back?

Thursday, December 1st, 2011

This morning, we had an issue in a development database where we couldn’t drop an UNDO tablespace as a transaction was currently using it. We saw nothing in the GV$TRANSACTION view, so we knew it must be rolling back a **failed** transaction. Sure enough, a quick run through GV$FAST_START_TRANSACTIONS showed that a large transaction... »

Posted in Database, Oracle | No Comments »