Oracle10g
Requirements
As a minimum, you should have at least 500 MB ram, a 1 GB swap partition, and the following packages:
# apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm
*You should also make sure dns and/or your /etc/hosts file is set up properly so that your ip address resolves to the correct hostname.
Setting up Users
Oracle needs a system user and three new groups added to the system:
# addgroup oinstall # addgroup dba # addgroup nobody # useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle # usermod -g nobody nobody
Creating Directories and Setting Permissions
Note: The default directory schema for oracle is usually /u01 and /u02. I chose to be a little more FHS compliant and put things in /opt/oracle and /opt/oradata:
# mkdir -p /opt/oracle # mkdir /opt/oradata # chown -R oracle:oinstall /opt/ora* # chmod -R 775 /opt/ora*
Configuration Changes
Begin by adding the following lines to /etc/sysctl.conf
kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000
To update these changes run:
# sysctl -p
Next, add the following lines to /etc/security/limits.conf
* soft nproc 2407 * hard nproc 16384 * soft nofile 1024 * hard nofile 65536
Now create the following symlinks:
# ln -s /usr/bin/awk /bin/awk # ln -s /usr/bin/rpm /bin/rpm # ln -s /usr/bin/basename /bin/basename
Trick the installer by making it think we're installing this on a Red Hat machine by creating and adding the following line to /etc/redhat-release:
Red Hat Linux release 2.1 (drupal)
Installation
Login as oracle and copy the installation files (probably from a cdrom) to a temporary directory:
$ cp -r /installer/files/path/ `mktemp -d`
In order to run the Oracle installer without problems you need to set up the right environment for it to be happy:
#mkdir /etc/rc.d # ln -s /etc/rc0.d /etc/rc.d/rc0.d # ln -s /etc/rc2.d /etc/rc.d/rc2.d # ln -s /etc/rc3.d /etc/rc.d/rc3.d # ln -s /etc/rc4.d /etc/rc.d/rc4.d # ln -s /etc/rc5.d /etc/rc.d/rc5.d # ln -s /etc/rc6.d /etc/rc.d/rc6.d # ln -s /etc/init.d /etc/rc.d/init.d
Assuming you are still in the same directory that you copied the installer files in, run the installer:
$ ./runInstaller
The oracle installer will stop you twice during installation and ask you to run scripts that basically set permissions, etc. After you run the second script (root.sh), Oracle installs a service called init.cssd. The root.sh script waits 600 seconds (10 minutes) for the service to be started before going on. You need to do some setting up while it waits for you! The message on the console will show:
Expecting the CRS daemons to be up within 600 seconds.
There are three things you need to do. First, you need to edit /etc/inittab to set the active runlevels to 23 (the Debian/Ubuntu defaults) instead of 35 (the Red Hat and Suse defaults). Here's the line you need to edit:
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
Replace this with:
h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
Next, you need to edit the script that oracle installs. Navigate to line 83 and replace it with this:
SU="/bin/su"
Finally, make init restart the service:
# init q
At this point the root.sh script should continue to finish as expected and you should be done with the graphical installer.
Starting/Stopping Services
At this point you need to add another init script to make oracle startup whenever you reboot. But first, you need to take care of some broken links that the installer creates for you:
# rm /etc/rc2.d/[SK]96* # rm /etc/rc3.d/[SK]96* # rm /etc/rc5.d/[SK]96* # update-rc.d init.cssd defaults 96
Below is the init script that I customized based off of the one [http://www.togaware.com/linux/survivor/Starting_Stopping.shtml here]. This script starts/stops the oracle instance, listener, and the enterprise management web interface. You will need to change the ORACLE_HOME, ORACLE_SID, and ORA_OWNR variables to your respective setup. I named this /etc/init.d/oracledb but any name will suffice.
# # /etc/init.d/oracledb # # Run-level Startup script for the Oracle Instance, Listener, and # Web Interface export ORACLE_HOME=/your/oracle/home/goes/here export ORACLE_SID=oraclesidgoeshere export PATH=$PATH:$ORACLE_HOME/bin ORA_OWNR="oracleownergoeshere" # if the executables do not exist -- display error if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi # depending on parameter -- startup, shutdown, restart # of the instance and listener or usage display case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart touch /var/lock/oracle su $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsole echo "OK" ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut rm -f /var/lock/oracle su $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsole echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0
Once this is in place, make it executable, and link it to all the runlevels:
# chmod 755 /etc/init.d/oracledb # update-rc.d oracledb defaults 99
Before we can start our new database we have a few more customizations to make:
- /usr/local/bin/dbhome needs env. variables ORAHOME, ORASID, and ORATAB (/etc/oratab) changed
- /your/oracle/home/bin/dbhome needs the same as above
- /your/oracle/home/bin/dbshut needs the same as above
- /your/oracle/home/dbstart needs the ORATAB variable changed
For all the databases that you create and wart started at boot time, you will need to edit the /etc/oratab file accordingly.
For example, replace
dbname:/opt/oracle/:N
with:
oracle:/opt/oracle:Y
At this point you should be ready to go. You will need to set the following environment variables for things to work properly:
- ORACLE_HOME
- ORACLE_SID
- PATH
There's many ways to do this and I'll let you research that on your own! Once you reboot or restart the database you should check to make sure everything is running properly by running sqlpus or logging in through the web management interface:
http://urlgoeshere.com:5500/em
Enjoy