
Oracle 10g server was recently ported1 to run on OS X Leopard. Besides the ginormous installation guide by Oracle, there are a handful of helpful quick install guides already out there. Following them, though, I found that I still had issues installing it, and had additional needs that required sifting through comments, googling, etc.
So, here are my notes, borrowed heavily from the resources below. Perhaps they will alleviate some of the pain I experienced, for other souls unfortunate enough to have to install and use this overly-complicated database.
/Applications/Utilities/Terminal.appcmurphy:~ oracle$ dscl . -list /groups gid | grep 4200
cmurphy:~ oracle$ dscl . -list /users uid | grep 4200
cmurphy@cmurphy$ sudo dscl . -create /groups/dba
sudo dscl . -append /groups/dba gid 4200
sudo dscl . -append /groups/dba passwd "*"
sudo dscl . -create /users/oracle
sudo dscl . -append /users/oracle uid 4200
sudo dscl . -append /users/oracle gid 4200
sudo dscl . -append /users/oracle shell /bin/bash
sudo dscl . -append /users/oracle home /Users/oracle
sudo dscl . -append /users/oracle realname \
"Oracle software owner"
sudo dscl . -append /Groups/dba GroupMembership oracle
sudo mkdir /Users/oracle
sudo chown oracle:dba /Users/oracle
sudo defaults write /Library/Preferences/com.apple.loginwindow \
HiddenUsersList -array-add oracle
sudo passwd oracle # use a good password
kern.sysv.shmall=2097152
kern.sysv.shmmni=4096
kern.maxproc=1024
kern.maxprocperuid=512
/Users/oracle for Oracle’s installation directory (oracle base):cmurphy@cmurphy$ cd /Users/oracle/
cmurphy@cmurphy$ sudo mkdir oracle
cmurphy@cmurphy$ sudo chmod 775 oracle
cmurphy@cmurphy$ su - oracle
cmurphy@cmurphy$ vi .bash_profile
# Must match kern.maxprocperuid
ulimit -Hu 512
ulimit -Su 512
# Must match kern.maxfilesperproc
ulimit -Hn 10240
ulimit -Sn 10240
export ORACLE_BASE=/Users/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=dev
PATH=$PATH:/$ORACLE_HOME/bin
Applications -> Utilities -> X11[cmurphy@cmurphy]$su - oracle
cmurphy:~ oracle$ export DISPLAY=localhost:0
cmurphy:~ oracle$ export ORACLE_HOSTNAME=localhost
cmurphy:~ oracle$ /Users/oracle/db/Disk1/runInstaller
Advanced installation option on the first screen./Users/oracle/oracle/oraInventorydbadev for the Global Database Name and SID.[cmurphy@cmurphy]$su - oracle
cmurphy:~ oracle$ lsnrctl start
dev tnsname:cmurphy:~ oracle$ sqlplus system@dev
SQL> show parameter listener
NAME TYPE VALUE
---------------- ----------- -----------------
local_listener string LISTENER_DEV
remote_listener string
SQL> alter system set local_listener='DEV';
System altered.
SQL> alter system register;
System altered.
tnsnames.ora4 file contains the following:DEV =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dev)
)
)
You’ll likely want to administer your database using your normal account, not the oracle account (if not, you’re done). To do so, we need to relax some permissions. There is a script that does just this at $ORACLE_HOME/install/changePerm.sh. However, the changePerm.sh is not adapted to OS X and uses the wrong default utility locations (like awk, grep, etc.).
See this if you’d like more detail.
[cmurphy@cmurphy]$su - oracle
cmurphy:~ oracle$ vi $ORACLE_HOME/install/changePerm.sh
# Macros
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
AWK="/usr/bin/awk"
GREP="/usr/bin/grep"
LS="/bin/ls"
CUT="/usr/bin/cut"
ECHO="/bin/echo"
RM="/bin/rm"
CAT="/bin/cat"
CP="/bin/cp"
SORT="/usr/bin/sort"
TOUCH="/usr/bin/touch"
ID="/usr/bin/id"
FIND="/usr/bin/find"
CWD="/bin/pwd"
TR="/usr/bin/tr"
TEST="/bin/test"
COMM="/usr/bin/comm"
cmurphy:~ oracle$ ./changePerm.sh
/etc/oratab with sudo and change the N to Y at the end of line for ORCL database – this will be used by the dbstart utility to find which databases should be started automatically..bashrc (or .bash_profile, .bash_local, whatever):# Must match kern.maxprocperuid
ulimit -Hu 512
ulimit -Su 512
# Must match kern.maxfilesperproc
ulimit -Hn 10240
ulimit -Sn 10240
export ORACLE_BASE=/Users/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=dev
PATH=$PATH:$ORACLE_HOME/bin
alias ostart="sudo -u oracle /bin/bash -l -c
'$ORACLE_HOME/bin/dbstart $ORACLE_HOME'"
alias oshut="sudo -u oracle /bin/bash -l -c
'$ORACLE_HOME/bin/dbshut $ORACLE_HOME'"
ostart and oshut, and connect using sqlplus, sqlldr, etc.:[cmurphy@cmurphy]$ oshut
Password:
Processing Database instance "dev": log file
/Users/oracle/oracle/product/10.2.0/db_1/shutdown.log
[cmurphy@cmurphy]$ ostart
Processing Database instance "dev": log file
/Users/oracle/oracle/product/10.2.0/db_1/startup.log
[cmurphy@cmurphy]$ sqlplus system@dev
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jun 16...
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0...
With the Partitioning, OLAP, Data Mining and Real Application...
SQL> select * from dual;
D
-
X
SQL>
1 And released April 11th, 2009.
2 The Oracle install guide claims OS X Server is required. Ignore that: desktop OS X Leopard works just fine, especially for development.
3 DHCP will change your IP address as well as the hostname dynamically; so setting the ORACLE_HOSTNAME environment variable will work around this.
4 oracle/product/10.2.0/db_1/network/admin/tnsnames.ora