Get a Free iPhone 4 from Xpango - click here

Tuesday, September 14, 2010

How to Install Oracle 10g on Mac OS X

Oracle 10g has been certified on Mac OS X Leopard. I will explain Installation of Oracle 10.2.4 on Mac OS X 10.5.8.

Initial Requirements:

Make sure your Mac is updated and has 5GB of disk space and 1GB of RAM.

Oracle Installation requires compilers(gcc) which is not present with default Mac installation.So we need to install Xcode tool  which contain all the required programs and compilers.This tool can be install from OS X Disk or you can download from Apple Developer Connection.


Create required groups/users :
1.Create Oracle inventory group :
# dscl . -create /groups/oinstall
# dscl . -append /groups/oinstall gid 100
# dscl . -append /groups/oinstall passwd "*"
2.Create Oracle software owner :
# dscl . -create /users/oracle
# dscl . -append /users/oracle uid uid_number
# dscl . -append /users/oracle gid oinstall_gid
# dscl . -append /users/oracle shell /bin/bash
# dscl . -append /users/oracle home /Users/oracle
# dscl . -append /users/oracle realname "Oracle software owner"
3.Create the home directory for Oracle user as:
# mkdir /Users/oracle
# chown oracle:oinstall /Users/oracle
4.Set the password for Oracle user:
# passwd oracle
 
Change Default Kernel Parameters
Edit /etc/sysctl.conf and add the following
vi /etc/sysctl.conf

kern.sysv.semmsl=87381
kern.sysv.semmns=87381
kern.sysv.semmni=87381
kern.sysv.semmnu=87381
kern.sysv.semume=10
kernel.shmall=2097152
kernel.sys.shmmax=2147483648
kernel.sys.shmmni=4096
kern.maxfiles=65536
kern.maxfilesperproc=65536
net.inet.ip.portrange.first=1024
net.inet.ip.portrange.last=65000
kern.corefile=core
kern.maxproc=2068
kern.maxprocperuid=2068

The values are recommended by Oracle.Reboot machine for parameters to take effect.

Configure Oracle user’s environment 

Create .bash_profile and add the following.

# Must match kern.maxprocperuid
ulimit -Hu 2068
ulimit -Su 2068
# Must match kern.maxfilesperproc
ulimit -Hn 65536
ulimit -Sn 65536
 
export DISPLAY=:0.0
export ORACLE_BASE=/Users/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=ret123
PATH=$PATH:/$ORACLE_HOME/bin
You can specify SID of your choice.

Download db.zip and unzip it and run the Installer.

~oracle$Cd db/Disk1
~oracle$./runInstaller

You can perform standard or advanced installation.
You need to run couple of scripts as root user.

Make sure to set DYLD_LIBRARY_PATH to avoid errors related to different tools.

If your Mac is using DHCP (most likely) then you may see the error shown below:
~ oracle$ lsnrctl start
 
LSNRCTL for MacOS X Server: Version 10.2.0.4.0 - Production on 14-SEP-2010 14:48:49
 Copyright (c) 1991, 2007, Oracle.  All rights reserved.
 Starting /Users/oracle/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
 TNSLSNR for MacOS X Server: Version 10.2.0.4.0 - Production
System parameter file is /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /Users/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dhcp-usca14-133-197.SFBay.Sun.COM)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
 TNS-12560: TNS:protocol adapter error
  TNS-00515: Connect failed because target host or object does not exist
   MacOS X Server Error: 49: Can't assign requested address
Listener failed to start. See the error message(s) above...

Edit $ORACLE_HOME/network/admin/listener.ora  to fix the error.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = ret123)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

We need to add new sid so that listener listen to new sid at port 1521. Changes are highlighted in bold.

Then also change ret123 alias definition in $ORACLE_HOME/network/admin/tnsnames.ora :
RET123 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ret123)
    )
  )
Save file and restart the listener.
Connect with sqlplus.
~oracle$ sqlplus /nolog
~oracle$conn /as sysdba
~oracle$ startup

1 comment:

  1. Great. I do know how to install it on windows but on MAC I have never tried and even don't know. Thanks a lot for sharing all the steps in detail. It will help all to install it very easily. I am going to try it and do the things by following your steps.
    document scanning

    ReplyDelete