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