Jagjeet Singh mentioned that he has built a V2 of his cool SQL Dashboard sqlplus-based monitoring script, which now also shows a nice colored ASH graph output. Yes, right inside sqlplus!
This reminded me that I demoed color output in sqlplus when I delivered the Hotsos Symposium training day a few years ago, when introducing the MOATS tool the first time. I never got to colorize it as I had hoped to though… as MOATS was more of a fun project I worked on with Adrian Billington just to prove that it is possible to build a monitoring tool purely based on SQL and PL/SQL with a TOP-like self-refreshing screen output.
Anyway, Jagjeet has done this cool work now, but if you want to colorize some of your own scripts, then on XTerm-capable terminal emulators its simply done with just outputting some escape codes before the text you want to color. Most (or even all) widely used XTerm clients support 8 colors for text and 8 for background – but some terminal emulators (like putty, iTerm, Terminator) even support 256 colors!
Here’s a simple example script I demoed at the Hotsos training day too:
Just run it in sqlplus and see what happens! Note that you have to use the sqlplus in an XTerm terminal emulator (maybe ANSI terminals would work too) – this won’t work in Windows Command prompt!
Anyway, have fun and keep those cool & colorful sqlplus scripts coming! :-)




one of the coolest sqlplus things i’ve seen. ever!
Thanks, I like it as well :) I had a 256 color version somewhere too, but not sure where it’s gone …
Wow … Awesome, Thanks !
Probably, you should add
set lines 200 pages 100
before Select. Different linesize gives different output.
Nevertheless Very nice !
Thanks to Tanel!
I have linesize etc set up in my standard init scripts anyway … It’s up to the readers to figure this out themselves. I run a troubleshooting blog after all :)