Gladstone – An Oracle installation script

I only have twenty-nine 150GB-plus databases to manage these days, and most of those are running on servers with uptimes in excess of a year (it would have been longer, but I only got them to switch to Linux about 13 months ago). I don’t, therefore, tend to do a lot of Oracle installations these days -and my automated pre-installation configuration shell script which used to make the job fairly easy has therefore languished of late.

That automated script initially went by the name of ‘Doris‘ (for “Dizwell/Oracle Reliable Installation Script”), a name which appears to have stuck in some quarters.

About a year after Doris appeared, I re-wrote it (and updated it) to use Gnome GUI pop-ups and other interactive elements and accordingly re-named it ‘GOAL‘ (for “Graphical Oracle All-in-one Loader”).

Now, I’ve re-written the script one more time. Call it Doris 2 or GOAL 2, if you like. Me? I’m calling it Gladstone for no reason whatsoever except that half of Dizwell’s name comes from Disraeli, so it’s only fair to remember the other fella from time to time!

I thought it might be worth mentioning a couple of Gladstone’s key design features here:

Gladstone deals with modern distros and has been run successfully on:

Gladstone only prepares your distro for the installation of 10g Release 2 or 11g Release 2… code to do an 11g Release 1 installation, for example, has been dropped. The reasoning there is that those are the only two still-supported Oracle releases (though obviously support is not provided by Oracle at all if you’re doing home installations onto the likes of Debian anyway!). Putting it another way: you’d be certifiably insane (IMNHO) to consider installing any other Oracle version these days, so I’m not going to waste time coding for something that isn’t worth doing!

For similar reasons, Gladstone won’t support doing a 10g Release 2 installation on Ubuntu 12 or Fedora 17: they are recent distros and Oracle’s support for 10g finished at least a year ago. It therefore seems pointless (to me) to do a relatively ancient 10g install on a distro that modern, so I’ve not written code to do it.

For all tested distros, both Oracle releases eventually install successfully, though nearly all 10g installations run into the “Error in invoking target ‘collector’ of makefile ‘/srv/oracle/product/10.2/db_1/sysman/lib/ins_emdb.mk’” error during the Oracle installation linking phase. This is a non-fatal error that can be ignored without apparent harm to any substantial bit of Oracle RDBMS functionality.

Nearly all 11g installations are flawless on all tested distros. Three distros (Fedora, Ubuntu 12.04 and Linux Mint Debian Edition) require an additional workaround for which an extra shell script is created by Gladstone. Run that additional script when you get linking errors during the main Oracle installation and you’ll be able to click ‘Retry’ and continue to a successful conclusion.

Gladstone was written with the idea of allowing myself to become the oracle user, rather than merely creating a new user as is traditional. By default, you are still prompted to supply a new account name (and if you just press enter, you get a new one called ‘oracle’), but if you type your own username in (or that of any existing user, come to that), that account will be re-configured to make it suitable for Oracle installation ownership. This is definitely a ‘non-standard’ way of doing things, but suits me and my desktop (and laptop) PCs just fine. Your mileage might well vary, of course, and all the usual disclaimers apply!

Some people never liked Doris or GOAL… they thought it wasn’t very original and would break Oracle support if done on a production box. Well, Gladstone isn’t very original either, since what it does is only what’s documented as needing to be done prior to an Oracle installation (though because you’re not having to do all the typing, it’s likely to get it more correct than you might manage on your own -which is the whole point, of course!) And the issue of support is moot, anyway -because all bar one of the distros Gladstone runs on are never supported by Oracle anyway, no matter how the installation is done!

Anyway, take it or leave it. If you take it and find that you encounter errors or issues, let me know here and I’ll see what can be done, if anything, to fix it for others. I’ll have detailed notes for each supported distro in due course.

Peas ‘n’ Pods

How do you tell Linux distros apart?

I mean, yeah: one’s bright green, another’s radioactive blue, another is a devilish shade of red… but apart from the mere cosmetics, how do you know if you’re handing Fedora 13 or Fedora 14, versus Ubuntu 10.10 or OpenSuse 11.4 (which was freshly released yesterday, incidentally)?

You get a bronze medal if you thought to yourself, ‘doesn’t /etc/redhat-release tell you this information?’, because you are indeed correct that such a file -if it exists at all- will give you distro-specific (and release-specific) information.

Centos 5.5, for example has this for its redhat-release file:

CentOS release 5.5 (Final)

Whereas Scientific Linux 5.5, which is compiled from exactly the same source code as Centos 5.5, has this:

Scientific Linux SL release 5.5 (Boron)

…which, I think we can agree, is a much sexier designation all round! (And, incidentally, means I predict that Scientific Linux 6 will have the code name Carbon, whilst version 59 will presumably be called Praseodymium. Those science boys certainly know how to have a good time!)

Ye olde genuine Red Hat Enterprise Linux 5.5 is likewise identifiable because its copy of redhat-release reads:

Red Hat Enterprise Linux Server release 5.5 (Tikanga)

And even Fedora 14 can be easily spotted using the same technique :

Fedora release 14 (Laughlin)

This looks like it’s a winning technique… but you have to bear in mind that not every distro is Red Hat, or a Red Hat clone or even vaguely related to Red Hat in the way Fedora is.

If you try looking for an /etc/redhat-release in Ubuntu 10.10, for example, you’ll be sadly disappointed: no such file or directory exists. And that’s true of Debian, too (on which Ubuntu is based, of course), and for all other Debian-based (or Ubuntu-derived) distros. So, how do you tell which one of those non-Red Hat type distros you’re running on?

Well, the file /etc/lsb-release should come to your aid at this point. It’s obviously ‘related’ to redhat-release in that it’s located in the same directory and serves much the same OS/distro-identification purposes. But you’ll find its contents more structured than the one-liners you get in the Red Hat equivalent.

For the latest version of Linux Mint, for example, you’ll get something like this:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=10
DISTRIB_CODENAME=julia
DISTRIB_DESCRIPTION="Linux Mint 10 Julia"

Whereas for Ubuntu 10.10, you get:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

This is actually a lot more useful information than you get in the one-line Red Hat-style files, because you get code names, version numbers and ‘distro family’ identifiers in discrete pieces of information. You can read this stuff with a simple grep, instead of having to resort to string manipulation/parsing utilities like sed or awk.

Incidentally, the “lsb” in “lsb-release” stands for “Linux Standard Base” -which should tell you that it’s actually the more “correct” (i.e., more standards-compliant) way of doing OS identification… but the Red Hat family, generally, has decided not to use it. At least, there is no file called /etc/lsb-release in the Red Hat-style distros, so your grepping of such a beast won’t get you very far there!

So, the silver medal answer you might cook up at this point is that you should test for the existence of /etc/redhat-release, and if it’s there, read it; and if it’s not there, test for the existence of /etc/lsb-release, and if it’s there read it. It will certainly work, and it’s not going to be the end of the world if you decide to do it this way. But it’s not the gold medal answer, either.

Because (and this is where it gets interesting!), Red Hat, Centos, Scientific Linux and the rest do have a directory called /etc/lsb-release.d …and the “.d” bit of the name tells you that there must be a program (daemon) which uses the information it contains in some way. And the gold-medal answer is that, indeed, just such a program exists.

It’s called lsb_release (note the underscore in the program name, versus the hyphen in the file name) and you can simply invoke it at a shell prompt with various switches to display different parts of the OS description details. For example, on Centos, you can type (as yourself… no need to be root):

lsb_release -d

…and get the response:

Description:    CentOS release  5.5 (Final)

…which happens simply to be the contents of the /etc/redhat-release file with a leading ‘Description…’ designator. Instead of that -d switch, you could try -r (which displays the release version number, which in this case would be Release: 5.5); or -c (which gives you the release code name: Codename: Final); or -i (to get the distributor’s name, in this case: Distributor ID: CentOS)

In fact, using the lsb_release program on Red Hat-type distros, you can get every piece of information you’d be able to see as separate text elements in the /etc/lsb-release file on Debian- and Ubuntu-style distros.

And just to round the picture off, you can use the lsb-release program even on the Debian- and Ubuntu-style distros, too …so there’s not even a need to start grepping the /etc/lsb-release file there, either.

So, to answer the question that appears at the start of this piece: you can tell what distro you’re running on, consistently and conveniently, by running lsb_release -d (and use other switches to obtain other bits of version information if you need it)… and this advice is as true on Red Hat as it is on Linux Mint, Fedora, Ubuntu or pretty much anything else.

Of course, if your distro doesn’t adhere to LSB principles, all bets are off… but we don’t talk about distros like that around here!

Update: Naturally, I spoke too soon. Fedora 14 does NOT come with lsb-release installed by default, though it’s trivial enough to do a yum install redhat-lsb to get it there. What a pain!!

Google be Praised!

I don’t think I’d be spilling any trade secrets if I said that whenever I go searching for Oracle tips/workarounds, I am always bound to find links to utterly useless results at Experts Exchange and any of the bazillion domains hosted by Don Burleson.

There have been browser extensions you could install to block things from the Google results pages by domain, but they’ve always been something you had to remember to install -and if you changed browsers, you were potentially back at step 1.

Today, Google have announced a game-changer: an option to block an entire domain from their search results, merely by clicking a link! Brilliant!

For example, if you’re doing an Oracle installation and come across the all_no_orcl linking error, you’ll do a search and end up with results like these:

The first two results there are from different domains owned and run by Don Burleson. If you think, as I do, that it would be useful to remove those two domains from any future search for reliable technical information about Oracle, you can now just click the Block dba-oracle.com and Block dbaforums.org links now helpfully included in the search results above. You’ll get a little ‘cloud puff’ animation as that particular domain disappears into thin air!

If you ever do the same search again, this time those blocked sites won’t appear in the results:

Now, the Oracle forums are the first results listed.

This feature works in all the major browsers (IE8, Chrome, Firefox), though I’m not sure it’s working reliably in Australia yet. It also, unfortunately, requires you to first visit a site on the domain you want to block and then to back-click to the original search results page. Only then does the ‘block’ link appear.

Currently, Google promises that the new feature won’t actually alter the Page Rank for any domain that gets blocked, but that might happen in the future.

At the bottom of any future search results page, you’ll see a count of how many links to blocked sites have been suppressed, along with an option to display them anyway. There’s also a management link, so you can unblock domains should you decide to:

All this means that you can make search results less full of stuff you know from bitter experience is likely to be a waste of time or, worse, downright misleading -and that’s a great thing to be able to do.

Incidentally, if you want to stick to managing your own blocks using extensions, the Personal Block List plugin for Chrome is still available. There was once also the more-or-less equivalent OptimizeGoogle extension for Firefox, but that seems no longer to be in development. Shame!

Linux Desktops (part 163)

My principal desktop, as regular readers will know, is forever changing. One minute it’s Windows XP, another Windows 7… and the next it’s one flavour of Linux or another. If it stays the same thing for three months on end, it’s (a) unusual and (b) signifies that there’s something unusually satisfying about that particular OS or distro.

So maybe it’s worth mentioning (or maybe not, but here goes anyway) that I’ve been using Linux Mint for three months to the day, and I’m impressed enough by it to have coughed up some cash for it (by way of a donation) -which makes it only the second distro I’ve ever paid money for, Suse 7.3 being the first.

It is, of course, Ubuntu with some (green) knobs on -multimedia codecs already installed, for example. But I like it more than Ubuntu simply because it’s not playing silly buggers with things like the default choice of desktop (Ubuntu 11.04, due any week now, is ditching the standard Gnome desktop in favour of “Unity”) and the placement of window management icons (maxmise, minimise and close buttons are all, by default, on the right in Mint, left in Ubuntu 10+). Yup, you can change Ubuntu back to standard Gnome, and you can alter the placement of the windows management icons, but I prefer not having to.

For all that, Mint inherits the general simplicity and functionality of Ubuntu, making it a piece of cake to use. It seems snappy enough, too, and the software is usefully up-to-date.

Not everything in the garden is rosy, I suppose. Having said I disliked Ubuntu’s choice of windows decoration placement and it’s forthcoming choice of Gnome shell and X layer, I have to confess that Mint’s choice of one panel at the bottom of the screen annoys me too -and I changed it 2 minutes after installation into the more-standard one-on-top/one-on-bottom arrangement. I also ditched the special ‘Mint’ menu and reverted to the standard Gnome Applications/Places/System one -though that’s one decision I might change. In any case, these seem small cosmetic issues -whereas Ubuntu’s innovations are right at the core of what a desktop does.

Of course, this might all end in tears: the Mint team seem already to be flirting with fiddling for no good reason (with things like logos). Who knows what will happen if Mint ever stops being fun and starts being an exercise in corporate branding and recognition?!

I also note that the Mint developers seem to be toying with the idea of leaving their Ubuntu roots behind them and building themselves on top of Debian. (I know Ubuntu is itself based on Debian, but I think the Mint guys want to stop being something that’s built on something that’s built on Debian and just go back to the pure ‘source’ for themselves). That actually sounds like a good idea to me, since I happily used Debian itself as my desktop for several months… but there’s no denying (I think) that Debian is generally a little less easy, a little less friendly to use than Ubuntu -so one would expect Mint’s own scores in those areas to regress a little.

Actually, there is already a Linux Mint Debian Edition (LMDE), and they’ve done a great job in making Debian look and feel, for the most part, just like its Ubuntu-based cousin. But it’s not quite as polished as ‘the original’ and I haven’t adopted it as my own desktop just yet. Maybe soon though, since the really good thing about LMDE is that it’s a ‘rolling distro’, meaning you don’t have ‘big bang’ releases every April and October. You just install once and keep on upgrading for ever, confident that as you do so, you’ll always be on the (b)leading edge. That sounds like something I’d want my desktop to do, for sure.

(Oh, and if you’re that way inclined, there’s also a Linux Mint with KDE version and a Linux Mint with LXDE version (I use that last one on my netbook, since LXDE is a much ‘lighter’ desktop environment than either Gnome or KDE). There’s a whole ecosystem of Mints out there, in other words, and they all try hard to be themselves whilst exhibiting general family characteristics.

I dare say I shan’t be on Mint for ever. But I like being on it for now, so it gets a hearty thumbs-up from me.

First Saturday of the Month

Trivial, really, but I needed to run a database procedure if it was the first and third Saturdays of the month. Oracle’s date functions are not something I’ve ever really enjoyed using much, so this is to save me from having to work it all out again from scratch in the future!

Here’s how you get the first Saturday of any given month:

select next_day(trunc(to_date('13/10/2011','DD/MM/YYYY'),'MM')-1,'sat') from dual;

And to get the third Saturday? Easy: just add 14 to the above:

select next_day(trunc(to_date('13/10/2011','DD/MM/YYYY'),'MM')-1,'sat')+14 from dual;

Instead of all that “to_date(’13/10/2011′,’DD/MM/YYYY’)” gumph in there, of course, I will get my procedure to simply refer to the current server date:

select next_day(trunc(sysdate,'MM')-1,'sat')+14 from dual;

It works because:

  • trunc(sysdate,’MM’) always returns the first day of the current month. So…
  • trunc(sysdate,’MM’)-1 returns the last day of the month before this one. And…
  • next_day(last-day-of-previous-month,’name-of-day’) will therefore give you the date of the first named day after the last day of the previous month. Which, in English, as the same thing as ‘first X of the current month’.
  • ‘name-of-day’ can be any of the day-name standard abbreviations (so, in English, ‘mon’, ‘tue’, ‘wed’, ‘thu’, ‘fri’, ‘sat’, ‘sun’), although full names will also work (so ‘monday’ works as well as ‘mon’, for example).

Straightforward enough if you’re blessed with a good memory, I suppose. If only I were!!