Monday, January 4, 2010

Oracle 11g Running in a Parallels virtual machine

My goal was to create a virtual machine on my MacBook Pro running Snow Leopard (10.6.2) that could be used for testing and development. I wanted to keep the Oracle environment isolated from Mac OSX to avoid side effects and to have the option of easily pruning the whole environment should I wish to.

I already own Parallels (Build 5.0.9308) so virtualization software was an easy choice. I didn't want the Windows bloat so opted for Linux.

Here's how:

  • Choose a distribution that has been tested by Oracle AND one where there are no apparent problems with the Parallels Tools install. In my case I was led to Red Hat Enterprise Linux (RHEL) but because there are $$ involved for RHEL I chose its free cousin CentOS (32 bit, ver 5.4 Final)

  • Creating a virtual machine. CentOS is downloaded to your computer as a disk image (.iso). Make a note of where the download resides and use the Parallels virtual machine creation wizard to create a VM from the .iso file.

  • Install Parallels Tools. You'll want to install the Parallels tools to make using the OS easier. Without the tools you'll have to use control keys to switch the mouse & keyboard back to the OSX environment and the Linux desktop will be limited to a very small window. Choosing the install tools option from the Parallels menu just mounts the tools disk image. It doesn't kick off the process. And when you try to run the install from the command line it will fail because the image was not mounted with the 'exec' option. Look here, under the heading 'Parallels Tools under Linux', for instructions on how to remount the image with the correct option.

  • Install the database. I used this how-to.

    1. The first problem was in trying to mount the CentOS distribution .iso within the CentOS guest operating system in order to run the package manager rpm. It did not like that the image resided on the OSX file system so, to make it work, I copied the .iso onto the VM local file system.

    2. The Oracle Installer application uses X11 and I got the "Unable to open display" error. The resolution is to issue the command: xhost +. This takes all the Xserver security down.

    3. Even though all packages were updated in accordance with the how-to, the installer flagged several that were still missing. When I tried to install them individually I ended up with a storm of dependencies so I used the Gnome Software Updater to download the packages and resolve the dependencies.

    4. The same installer page that complained about the missing packages also flagged some of the kernel parameters as inadequate. There is a "fix and recheck" button on the Oracle Installer page that creates a script in /tmp that you then run as root. Running that script fixed up the kernel parameters and the database install ran through to the end without error.


  • Startup and shutdown. It's been noted through the years that Oracle does not provide scripts to start and stop the DB. Here's one that I cobbled together. It resides in /etc/init.d/oracle:


    #!/bin/sh
    # chkconfig: 345 99 10
    # description: Oracle auto start-stop script.

    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
    ORA_OWNER=oracle

    if [ ! -f $ORACLE_HOME/bin/dbstart ]
    then
    echo "Oracle startup: cannot start"
    exit
    fi

    case "$1" in
    'start')
    # Start the Oracle databases:
    # The following command assumes that the oracle login
    # will not prompt the user for any values
    su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
    ;;
    'stop')
    # Stop the Oracle databases:
    # The following command assumes that the oracle login
    # will not prompt the user for any values
    su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
    ;;
    *)
    echo $"Usage: $0 {start|stop}"
    exit 1

    esac


    After the file has been created in /etc/init.d/oracle you must run chkconfig to make it a part of the OS startup and shutdown process.

    chkconfig --add oracle --level 0356

  • Connect to the database from the host OS. At the time of this post Oracle had not released an 11g client for OSX but the Oracle 10 client works fine for my purposes. There are 2 approaches to installing the Oracle 10 client on OSX. The full client (includes all the GUI tools) and The Instant Client. I quickly found that the full client is not compatible with Snow Leopard. The attempt yields Can't connect to window server - not enough permissions. There is talk of a work around here. I haven't had the energy to tackle this so, for the time being, running sqlplus with the instant client is good enough.

    1. Download the 64 bit Instant Client here. Get both the Instant Client Package - Basic and Instant Client Package - SQL*Plus. I used this how-to as the install guide.

    2. I couldn't connect to the database server because of the CentOS firewall. To allow connections via port 1521 go to the CentOS Gnome desktop System->Administration->Security Level and Firewall. A "Security Level Configuration" window appears. Click on the "Firewall Options" tab. Click on the arrow next to "Other ports." Click the 'Add' button. Enter 1521 in the port(s) box. Click OK.


  • Memory allocation. I installed Oracle on a virtual machine that allocated 1536MB RAM to my Linx partition and Oracle grabbed about 520MB for itself. My MacBook only has 3GB installed so all apps slowed to a crawl. I cut the RAM allocation back to 768MB and performance of the desktop snapped back but Oracle refused to start. Oracle 11g's expectations about the memory it has can be lowered thusly:

    ALTER SYSTEM SET MEMORY_TARGET=250M SCOPE=SPFILE;
    ALTER SYSTEM SET MEMORY_MAX_TARGET=300M SCOPE=SPFILE;

    After issuing these commands stop the server, adjust the memory allocation in the Parallels config to 768MB, and restart. The database should start without error now.

Tuesday, December 15, 2009

XDM Permissions in Ubuntu 9.10 (karmic koala)

Installing Oracle 11g using this how-to. Was getting 'Error: Can't open display: :0.0' when trying to run the Oracle installer as the oracle user. The problem was that the user didn't have proper permissions to use XDM. This command sets the correct permissions:

xhost local:

Friday, October 30, 2009

Banks vs. Consumers

The press has been hard on banks as they pre-emptively raise credit card rates in the face of coming legislation that will regulate the practice. And though they're under pressure to do payment workouts to mitigate foreclosures they rarely do. Sometimes it's too easy to write this off as other people's problems but yesterday I had an unusual conversation with my mortgage servicer Wells Fargo.

I received a tax bill from the town for about $4,000 so I contacted my closing attorney who said that the mortgage company had known about this at closing and had collected up front monies for it. He explained that it was the difference between the taxes for the unimproved property and the increase that would be demanded after the certificate of occupancy was issued. I explained this to the CSR at Wells Fargo and her response was, "Nope this must be paid out of your funds, not the escrow account."

So, again, back to my attorney who contacted the town and received what had been paid and what was due. After comparing that to the Escrow Account Disclosure I was given chapter and verse the exact accounting and exactly how to justify my claim that this should be paid out of escrow. The WF response was that It would leave the escrow short when they made the first payment in the new year. I suggested that they pay the $4K, do a new escrow analysis, and bill me for the shortage. They agreed.

So, I was left with these facts.
  • The only reason there was any kind of shortage was because the bank's estimate at closing was wrong.
  • Escrow was short only by half the amount that was due so they could have easily volunteered to pay half out of escrow.
  • Throughout the conversation their only response was flat refusal and, if I had not had the experience of dealing with other mortgages, they would not have settled the matter through this standard procedure.

The ultimate question is, Why antagonize the customer for such a trivial amount of money? If they had held onto my money until the next escrow cycle it could have earned them what, $40?

IT Career Choices

I was talking to a friend yesterday who is a web administrator. He told me that the job has always been demanding but now, due to the recession, things had really gotten crazy. Apparently hiring more U.S. based support is strictly prohibited and there's a history of hiring junior off shore help that stay only for a short period before they gain enough experience to move on. So, why draw down your own resources to train someone who's just going to walk in 6 months?

Having spent time as a LAN administrator, and later, a Database administrator in the 90's this is a familiar refrain. Even in good economic times there's still a need to do maintenance during off hours and, of course, you have to be there during the work day to fix it when it breaks.

In IT today there are more administration jobs available just because they're harder to off shore. Sys Admins are the people that you turn to in times of crisis and many companies want to reach out and touch them.

But beware, as a network engineer, or desktop support tech, or any other job where you take responsibility for a critical moving, changing piece of the business you will not get to go home at 5 and your weekends are not your own.

If you want to be an IT professional with more regular hours consider systems analysis, data modeling, or even application development.

Monday, September 28, 2009

Boat Fixed

Back in July OnSite Marine tore down the starboard engine and said that the cylinder head would go to the machine shop for resurfacing. Had no communication from them until we got to the marina the weekend of Aug 29 and I made it a point to get an update. I was told then that they had the head back from the machine shop.

Got a call on 9/8 saying that the work was complete. I take responsibility for some of the delay because I didn't show any impatience until late in the game. Though I had fleeting thoughts about calling for an update we weren't at the marina for several weekends. Out of sight, out of mind. I know that the cylinder head rode around in their truck for a while before they got around to putting it back on. Then, once it was on, there were problems with the way the engine idled leading to a carburetor rebuild ($238).

The starboard head on the starboard engine was not fitting flat against the exhaust manifold and was sent to the machine shop to be resurfaced ($180). OnSite's labor to remove and re-install was $2,430 including their attempt to use their own tools to resurface the parts. Gaskets and coolant ran $293.

Monday, September 14, 2009

Federer's Shot


Recorded 60 Minutes yesterday and when I watched later saw that the first 20 mins were preempted by the US Open.  Of course I got sucked into the tennis match only to catch the INCREDIBLE between the legs return.  When i saw it the 1st time I thought he lost the point and then when they did the replay and made it clear that he returned it AND that it was in I just lost it.  Have never seen anything like it in my life.

Woke up this morning expecting them to show it over and over on the news but it got secondary treatment to Venus' explosion which doesn't strike me as half as interesting.

Thursday, September 3, 2009

Has The Cash for Clunkers Deal Really Expired?

The "Service Engine Soon" light on my 2001 Suburban has come on several times in the last few months but became more persistent as we headed home from Boston on Saturday so... I took it to the dealer for service yesterday. Good news is that the remedy will only cost $320. The full story was
  • "Service Engine Soon" light referred to misfires on several cylinders. Doesn't think it's electrical, like spark plug, so recommends cleaning the fuel injectors $320
  • Driver's window motor, regulator, and the rubber channel that the window fits through is dry rotted $530
  • Mechanic reports loud noise/rumbling coming from front and diagnosed worn hub bearings that should be replaced. Replacement includes ABS and wheel speed sensor $1167
  • Lubricant in front differential "like molasses." Rebuild $830 + parts
  • Transfer case is also bad. Doesn't know if he can get a used one but new one is $1900
Will do the window motor, injector/engine cleaning, and replace the front hub bearings. Never use the 4 wheel drive so will avoid the front differential and transfer case for now.

We're in it for the long haul so I have no complaints about doing this work on an 8 year old car that has almost 150,000 miles on it. A lot cheaper than buying a new car.