Fun and Games with Oracle on Solaris

My most recent employment has seen me learning a whole lot more about Solaris admin tasks, and also a lot about how Oracle interacts with the OS. The latter, unfortunately, appears to be an accreted mass of stuff that was made to work in the distant past and has simply been carried along from one version to the next ever since then. Some of this causes rather bizarre problems that can take an amount of time and investigation to figure out, and Oracle's MetaLink site is frequently no help at all.

For example, I had a problem, at some point, with Oracle Reports being upset with TMPDIR, but our setup requiring use of same, so I ended up patching the C library using LD_PRELOAD to get around the bug. Now that is grungy.

Today, I discovered the One True Way of setting up networked HP LaserJets on Solaris 8. And it's neat, and tidy, and doesn't require you to hack at anything.

It is: lpadmin -p printername -s 'hostname!Auto' -onobanner

Apparently this magically feeds the stuff to a queue on the printer which can do the text->PostScript conversion by itself, and can also decide if you need to insert CRLF or whatever. As opposed to previous attempts, which involve severe abuse of the lpadmin command and occasional hacking on the interface files.

This in itself proved difficult to find, and many Google searches were required before I turned it up.

So anyway, I set up a printer.

And I said to Oracle Reports, "There's your printer. go use it."

And it said to me, "You have chosen an invalid printer. Please try another."

So I end up using truss to trace what the damn thing is doing, and lo, it's running lpstat on the printer and isn't happy with the output somehow. So I look at the output, and, well, the bit that it's unhappy with is that printers added the One True Way return "printer foo unknown state." when you do lpstat on them, where as Oracle would like them to say something nice about being in good health or what have you. Unknown state means invalid printer in Oracle land, and there's no way around that.

So, I made a new lpstat from a shell script that calls the old lpstat and feeds the output to sed to replace "unknown state" at the appropriate point with "is idle". And lo, Oracle Reports accepts this. Hurrah for Sysadmin!

It took me most of the day to find this. I'm putting this here so you don't get caught the same way.


Waider "It's easy. You just kretch the glims and aos the zotz." - TNHD