Installing Oracle on Solaris


Setting up the Machine

RAM and Swap Space

Minimum RAM required is 256K, try atleast 512K. Set swap space to twice RAM if RAM is less than 1GB otherwise equal to the amount of RAM. Run top to determine current RAM and swap space. The results of top are shown below. Various other utilities will achieve the same result.

last pid:  9455;  load averages:  0.06,  0.06,  0.06 21:47:53
41 processes:  40 sleeping, 1 on cpu
CPU states: 90.5% idle,  2.3% user,  5.4% kernel,  1.8% iowait,  0.0% swap
Memory: 1024M real, 641M swap in use, 1151M swap free

  PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
26284 root       1  58    0 5656K 5264K sleep  45:28  1.40% perl
26285 root       1  58    0 5504K 5128K sleep  42:29  0.81% perl
 9449 oracle     1  52    0 2520K 1568K cpu     0:00  0.14% top
  160 root      11  54    0 3792K 2024K sleep  85:22  0.06% syslogd
  292 root       1  58    0 4920K 3736K sleep  51:09  0.04% named
15265 oracle     5  58    0   12M 6456K sleep   0:29  0.04% dbsnmp
15293 oracle    11  58    0  592M  567M sleep   0:25  0.04% oracle
25760 root       1  58    0 3160K 2520K sleep   1:47  0.02% gated
 9416 root       1  58    0 3056K 1744K sleep   0:00  0.01% sshd
  363 root      12  58    0 2920K 2336K sleep   9:53  0.01% mibiisa
26294 root       1  58    0 8320K 3216K sleep  18:57  0.00% authns_server
  168 root       1  48    0 6200K 5592K sleep   0:45  0.00% cron
  277 root       1  50    0 3024K 1440K sleep   0:38  0.00% sshd
  370 root       1 100  -20 2152K 1240K sleep   0:37  0.00% xntpd
    1 root       1  58    0 1600K  792K sleep   0:08  0.00% init

Users and Groups

Add Oracle dba and installation groups plus an oracle user logged in as root.

groupadd -g 300 dba
groupadd -g 301 oinstall
useradd -u 300 -c "Oracle" -d  -g "dba" -m -s /bin/tcsh oracle

The groups can be added to the /etc/group file and the user can added to /etc/passwd and /etc/shadow. Note that /bin/tcsh is shell dependant. The passmgmt [-a|-m|-d] can also be used for user management. The passmgmt utility will additionally manage the /etc/shadow file.

Set the password for the oracle user.

passwd oracle

Oracle User Startup Configuration Files

.cshrc, .profile or .login are used to execute environment settings when a user logs in. An example .cshrc file is shown below. It is usually best to place the Oracle binaries on an internal disk and the actual database files on something like a RAID array This should be faster and reduce I/O contention between Oracle binaries and the database files. There are skeleton startup files in the /etc/skel directory called local.cshrc, local.login and local.profile.

#
#This .cshrc file is executed in tcsh (/usr/local/bin/tcsh) 
#
setenv ORACLE_BASE /<mount-point-1>/oracle
setenv ORACLE_HOME /<mount-point-1>/oracle/product/8.1.7
setenv ORACLE_DOC /<mount-point-1>/oracle/doc
setenv LD_LIBRARY_PATH /<mount-point-1>/oracle/product/8.1.7/lib:/usr/openwin/lib
setenv JAVA_HOME /<mount-point-1>/oracle/product/jre/1.1.8
setenv TNS_ADMIN /<mount-point-1>/oracle/product/8.1.7/network/admin
setenv ORACLE_SID <SID>
setenv ORACLE_DBF1 /<mount-point-1>/oracle/oradata/$ORACLE_SID
setenv ORACLE_DBF2 /<mount-point-2>/oracle/oradata/$ORACLE_SID
setenv ORACLE_BACKUPS /<mount-point-2>/backups
setenv ORACLE_SBIN /<mount-point-1>/oracle/product/8.1.7/sbin
setenv ORACLE_ALERT /<mount-point-1>/oracle/admin/$ORACLE_SID/bdump
setenv EDITOR vi

setenv PATH /bin:/usr/bin:/etc:/usr/ccs/bin:/usr/openwin/bin:/usr/ucb:/usr/local/bin:/usr/sbin:/usr/X/bin:$JAVA_HOME
setenv PATH ${PATH}:/<mount-point-1>/oracle/product/8.1.7/bin:/<mount-point-1>/oracle/product/8.1.7/sbin

set host=`hostname`
alias sp 'set prompt="$user@$host:r":"$cwd> "'		#Create a set prompt variable on every execution of sp
alias cd 'cd \!*;sp'					#Executed on every cd command, displaying the current directory
alias rm 'rm -i'					#Interactive rm command
alias ll `ls -la`					#Substitution for ls -la

cd

alias dbs 'cd $ORACLE_HOME/dbs'
alias bin 'cd $ORACLE_HOME'
alias net8 'cd $TNS_ADMIN'
alias pfile 'cd $ORACLE_BASE/admin/$ORACLE_SID/pfile'
alias alert 'cd $ORACLE_ALERT'
alias sbin 'cd $ORACLE_HOME/sbin'
alias dbf1 'cd $ORACLE_BASE/oradata/$ORACLE_SID'
alias dbf2 'cd /<mount-point-2>/oracle/oradata/$ORACLE_SID'

set filec						#Sets file completion with the tab key in tcsh and escape in csh
set history=100
umask 077						#Defaults file permissions to 700 (User rwx ONLY)
#set echo
#set noclobber ignoreeof	                        #disallow redirection to existing files
set fignore=.o                  	        	#ignore object files 
set history=100 savehist=25

The oratab File

Add a file called /var/opt/oracle/oratab. Set the last character to Y or N. Y will shutdown and restart the database and listener processes on reboot and N will not. The path listed in the oratab file is the same as the $ORACLE_HOME variable. Do not use the variable, hard-code the path.

<SID>:/u0/oracle/product/8.1.7:Y

Shutting Down and Starting Up Oracle on Reboot

The Shutdown / Startup Script

Add the file /etc/init.d/oracle as in the script is shown below. This file is executed on reboot. The files dbstart and dbstop are part of the installation and included in the $ORACLE_HOME/bin directory.

#!/sbin/sh

ORACLE_HOME=/u0/oracle/product/8.1.7

case "$1" in
        'start')
                su - oracle -c $ORACLE_HOME/bin/dbstart				#Database - handles multiple <SID>s
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"			#Listener
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_start"		#Agent

                exit 0
        ;;

        'stop')
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_stop"
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
                su - oracle -c $ORACLE_HOME/bin/dbshut
        ;;

        *)
                echo "usage: start or stop"
                exit 0
        ;;
esac
exit 0

Setting the Shutdown / Startup Script to Execute on Reboot

Automate the execution of the /etc/init.d script by adding script copies or symbolic links to the startup and shutdown directory, ie. the /etc/rc2.d and /etc/rc0.d directories respectively.

  1. The shutdown directory is /etc/rc0.d. This directory will execute process (K)ill scripts on Solaris shutdown. The scripts are executed in order of the integers in the filenames, ie. K02test1 is executed before K03test2. Place the oracle shutdown scripts above K00... but as close to K00... as possible, ie. execute the Oracle process' shutdown first.

    ln -s /etc/init.d/oracle K05oracle

    The startup directory is /etc/rc2.d. Note that the startup directory contains both (K)ill and (S)tartup scripts, or links. If anything needs to be killed before starting when Solaris starts-up then this is where it goes. Place the oracle startup link in the sequence of file/link names as far to the end of the list as possible.

    ln -s /etc/init.d/oracle S95oracle

Solaris / Oracle Memory Variables

Setting up the Solaris Kernel involves addition of Oracle-specific variables to the /etc/system file. Note that if these parameters are set incorrectly then the Solaris box may not reboot. There is a lot of information on the web and from Oracle support as to how these variables should be set. Generally the larger the processes parameter in a database then the higher some of these values need to be. Note that the Oracle documentation for Oracle-Solaris /etc/system variables is apparently incorrect. In fact so far I have not come across anyone who knows how to set these variables properly. If the values are not high enough you should get an Oracle End of communication channel error when attempting to start up the Oracle instance. The most simplistic version and explanation I have found is as follows.

In the configuration below I have two instances, one is a test database and the other is a test standby database. The test database will have the processes parameter set to 200 and the standby the processes parameter set to 55. Oracle in general requires a minimum of around 55 processes, the addition of Oracle Enterprise Manager I have been told requires that processes be increased to 200. Also note that each dedicated server connection requires 1 process. Note that MTS (connection pooling) will reduce the number of processes required per connection since connections are shared. Also remember that multiplexed archiver or database writer processes (amongst others) will require and increase to the processes parameter aswell.

* SEMMNS = [Sum processes parameters for each instance plus double the largest one] + [# of instances * 10]
* 200x2 (TEST) + 55 (STBYTEST) + 2x10 = 475

* Configuration for Oracle
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=100
set semsys:seminfo_semmns=475
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767

Remember, any comments in /etc/system are preceeded by * and not #. Also I have seen some examples of these variable settings which alter both SEMMSL and SEMMNS. I have no reason to be sure as of yet that setting SEMMNS alone accounts for more processes started up by Oracle. I do not know why SEMMSL would be required to be set aswell. So far I have not encountered any problems after increasing SEMMNS only.

Solaris Reboot

At this stage you need to reboot the Solaris machine to allow the above changes to take effect, specifically changes to the /etc/system file require a Solaris reboot. Note that boot -s will reboot the machine in single-user mode; similar to rebooting into safe-mode in Windows.

sync;reboot OR sync;shutdown -i6 -g30 -y OR boot [-s].

reboot, boot and shutdown -i6 are warm-boot processes, they do not shut the power off. shutdown [-i5] is a cold-boot. Note that the -i5 option instead of the -i6 option will require a physical flip of the switch on the machine.

Installing the Oracle Binaries

The CDROM Drive

Now install from the CDROM. Note this !!! Installing Oracle from the CDROM on Solaris requires two CD's and thus the CD will have to be changed. If you execute the Oracle runInstaller from the cdrom mount point you will get stuck on the CD change because once the CD is removed from the drive the mount point will freak-out, ie. simply disappear. Note that on some machines the CDROM mount point will mount automatically and thus this problem should not occur.

So either copy the CD's to the hard-drive and install from the hard-drive or install from the CDROM onto the hard-drive where you will execute the runInstaller from the hard-drive and not the CDROM.

Below is shown how to create a mount point for the cdrom drive if placing a CD in the CDROM drive does not auto-mount the CD drive.

su - root
mkdir /cdrom
mount -r -F hsfs /dev/cdrom

Basically this maps the mount point /dev/cdrom to the directory name /cdrom. Or something like that. I am not a SysAdmin so that part is a myth to me. Please do the RTFM thing is this does not work.

Oracle Installation Location File

You may need to add or edit a file called /var/opt/oracle/oraInst.loc depending on the version of Oracle 8.1.? you are installing. Oracle 8.1.7 will create this file for you automatically, I think !

#Oracle Installer Location File Location
#Thu Apr 12 19:02:57 PDT 2001
inventory_loc=/u0/oracle/oraInventory
inst_group=oinstall

The Installation of Oracle

Now to install Oracle. The Java Runtime Environment (JRE) is required by the Oracle installation software.

  1. Create a directory on your internal drive (place to install Oracle binaries) called oracle, the same as the $ORACLE_BASE variable in the .cshrc file shown above. Preferably on a mount point which has plenty of space, over 100M is required as a minimum. Note that it is advisable to install the Oracle binaries on an internal hard-drive rather than on a RAID array from a performance perspective. On the other hand placing the binaries on a RAID array will probably be less likely to fail due to disk failure since RAID arrays have hot-backups, etc.

  2. setenv DISPLAY=127.0.0.1:0.0
    xhost+ (Make sure that X is running - xinit ???)
    
  3. Now run the runInstaller file on the CD from your $ORACLE_BASE directory /cdrom/oracle8i#1/runInstaller. Remember, don't run it from the CD.

  4. Somewhere during the installation you will be asked to do two things.

    1. Execute a script in a separate window (xterm, whatever, ...) called root.sh logged in as root.

    2. Change the CD to the second CD (set to the second CD on the hard-drive if you copied the CD's to your hard-drive).

Select whatever installation options required. I would recommend installing a custom installation and selecting the minimum options required. Note that Oracle has certain things which it will not allow you to avoid installing. Also note that any installed options you have not paid for, Oracle theoretically wants licensing fees for. Extra installed options you do not need tend to create a lot of unwanted junk in the database. This could affect performance and makes for excessive maintenance.

Most importantly do not allow the installer to create a database for you. dbassist does weird things with some of the variables; basically it sets them incorrectly, especially MTS parameters, amongst other things. Unless you absolutely need Legato do not install it. The Oracle installer will allow future additions to the Oracle binaries without affecting the existing installation or databases. Some changes would require database changes. These database changes would probably all be automated by the installer. If not then $ORACLE_HOME/rdbms/admin scripts will solve further problems (See Post-Database Creation Scripts in Creating an Oracle Database). Read about newly installed options and any scripts required to be run on existing databases before installing new options.

A warning and perhaps a suggestion. The Standard edition of Oracle has a much more attractive price than the Enterprise edition, basically 10%. However, there is an awful lot you will not be able to do with the Standard edition. If your company can afford an Oracle DBA they can probably afford Enterprise edition. If not then you are probably using dual or quad processor NT machines and seriously overpaying for Oracle. Oracle runs much better on UNIX than on NT, probably something to do with NT and generally more speed in NT means more machine. More machine to Oracle means more cash since Oracle OLTP licensing is based on CPU MHz (speed) * numbers of processors. NT will generally work out more expensive than Solaris for Oracle even though Solaris UNIX licensing is an extra 50%. This is because where an NT box requires 4 CPU's a Solaris RISC box will probably only require 2 CPUs. Also the Solaris box will not simply reboot itself whenever it feels like it. Note that UNIX really is much faster than NT, mostly due to the (R)educed (I)nstruction (S)et (A)rchitecture. Note that Oracle pricing structures have currently changed very favorably in respect to the user. Oracle Standard now has a base-cost of $15,000 and Oracle Enterprise Edition now has a base-cost of $40,000. This is still possibly more expensive than SQL-Server. However, Oracle is many orders of magnitude faster than SQL-Server.

Configuring the Listener

The Server

The file below is the listener configuration file. This file is installed in the $ORACLE_HOME/network/admin directory. Note that using the IP-Address instead of the hostname for the database server machine is faster. However, subsequent changes to IP-Addresses on your network will require changing the listener configuation file and bouncing the listener.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname> or IP-Address)(PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /<path>/oracle/product/8.1.7)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = <SID>)
      (ORACLE_HOME = /<path>/oracle/product/8.1.7)
      (SID_NAME = <SID>)
    )
  )

Start the listener by using the lsnrctl utility. Enter listener control commands within the utility or as a parameter to the utility. lsnrctl start starts the listener, lsnrctl stop stops the listener and lsnrctl status will show status of database services served by the listener. Typing help within the listener control utility will display a summary of all available listener control commands.

The Client Side

<SID> =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname> or IP-Address)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = <SID>)
    )
   )

RMAN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname> or IP-Address)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = RMAN)
      #RMAN cannot connect through MTS
      (SERVER=DEDICATED)
    )
  )

EXTPROC_CONNECTION_DATA.<hostname> or IP-Address =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

Above is the tnsnames.ora file placed on the client machine. To test the connection with the database server execute the command tnsping <SID> from a shell on the client machine. Note the example of the recovery manager tns specification as being a dedicated connection. The external specification is installed by the Oracle Net8 Oracle configuation tool in order to access externally compiled library procedures and functions.

The Oracle Parameter Configuration File (init<SID>.ora)

The parameter file contains Oracle parameter values which override the default values. The parameter file is executed when the Oracle instance is started up. See Oracle Instance Startup Parameters and an Example Parameter File.