Step Zero
apt-get update
followed by a apt-get upgrade
will do the trick, although you may prefer using the GUI Synaptic Package Manager — it’s entirely up to you what method you choose. However, I much prefer to use the command line. Step One
# sudo apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm libmotif3 libaio libstdc++5 gawk alien libg++2.8.1.3-glibc2.2 ksh gcc-3.3 g++-3.3 libstdc++5
Step Two
ORACLE_BASE
directory. This is the place where Oracle will be installed. Make sure there is at least 3 GB on the partition/mount point before moving to the next step. After installed, my basic installation took about 3.4 GB on disk (without the starter database!). As your database grows, it will need more space. Reserve a total of at least 6 GB for the unpacked installer and the basic installation. You can get rid of the installer files afterwards.# sudo mkdir -p /opt/oracle
Step Three
# sudo addgroup oinstall
# sudo addgroup dba
# sudo addgroup nobody
# sudo useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash -m oracle
# sudo usermod -g nobody nobody
usermod
command is needed since because when running, the installer looks for a user called nobody
which is part of a group named nobody
(in Ubuntu, the user nobody
it’s assigned to nogroup
by default).Step Four
# sudo ln -s /usr/bin/awk /bin/awk #sudo ln -s /usr/bin/rpm /bin/rpm # sudo ln -s /usr/bin/basename /bin/basename
Step Five
/etc/rc.d
directory structure of a Red Hat box. We do this with more symlinks:#sudo mkdir /etc/rc.d #sudo ln -s /etc/rc0.d /etc/rc.d/rc0.d #sudo ln -s /etc/rc1.d /etc/rc.d/rc1.d #sudo ln -s /etc/rc2.d /etc/rc.d/rc2.d #sudo ln -s /etc/rc3.d /etc/rc.d/rc3.d #sudo ln -s /etc/rc4.d /etc/rc.d/rc4.d #sudo ln -s /etc/rc5.d /etc/rc.d/rc5.d #sudo ln -s /etc/rc6.d /etc/rc.d/rc6.d #sudo ln -s /etc/init.d /etc/rc.d/init.d
Step Six
/etc/redhat-release
and put only one line on it. The same can be achieved by issuing the following as root:echo "Red Hat Linux release 4" > /etc/redhat-release
Step Seven
/etc/sysctl.conf
and it should have these lines on it:fs.file-max = 65535 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 1048576 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 262144
# sysctl -p
fs.file-max
sets the maximum number of open files that can be handled by the Linux kernel.kernel.shmall
determines the total amount of shared memory to be allocated in pages. In this example, I’ve set it to 8GB, which is way above the amount of memory I can handle in my box, even with swap.kernel.shmmax
controls the maximum amount of memory to be allocated for shared memory which in this example is 2GB.kernel.shmmni
defines the maximum number of segments system-wide.net.core.rmem_default
andnet.core.rmem_max
define the default and maximum read buffer queue for network operations (1 MB in this example)net.core.wmem_default
andnet.core.wmem_max
define the default and maximum write buffer queue for network operations (256 KB in this example)net.ipv4.ip_local_port_range
tells the kernel the port ranges that will be used for outbound connections.kernel.sem
has four parameters:SEMMSL
- semaphores per arraySEMMNS
- max semaphores system-wide (SEMMNI*SEMMSL
)SEMOPM
- max operations per semop callSEMMNI
- max number of semaphore arrays
cat /proc/sys/kernel/sem
or ipcs -ls
. On my machine, after the modifications on sysctl.conf
, these commands output:# cat /proc/sys/kernel/sem 250 32000 100 128 # ipcs -ls ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 100 semaphore max value = 32767
- schogini.us/wordpress/index.php/2005/11/01/setting-semaphores/
- performancewiki.com/linux-tuning.html
- pythian.com/blogs/245/the-mysterious-world-of-shmmax-and-shmall
Step Eight
/etc/security/limits.conf
, letting the oracle
user use more resources than the defaults allowed. You may notice that all these values are a power of 2 minus one. When soft limits are exceeded, you’ll get a warning; the hard limits can’t be exceeded in any situation: you’ll get an error. I’m not completely sure, but I think these limits apply to each session/login (and since Oracle doesn’t exactly log in to the machine, my best guess is these limits apply per instance running).oracle soft nproc 2047 oracle hard nproc 16383 oracle soft nofile 1023 oracle hard nofile 65535
Step Nine
limits.conf
is being interpreted as the oracle
user logs in by adding these lines to /etc/pam.d/login
. You will want to make sure that is actually happening, since the defaults are way lower and you may get all sorts of problems.session required /lib/security/pam_limits.so session required pam_limits.so
Step Ten
# cd /path/to/zipfile # unzip linux_11gR1b5_database.zip
# sudo chown -R oracle:oinstall database # sudo chown -R oracle:oinstall /opt/oracle
Step Eleven
oracle
user itself. This is what you will probably see on the output window:# su - oracle $ cd /path/to/extracted/zip/file $ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 80 MB. Actual 58633 MB Passed Checking swap space: must be greater than 150 MB. Actual 2900 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-07-11_04-38-56PM. Please wait ... Oracle Universal Installer, Version 11.1.0.2.0 Production Copyright (C) 1999, 2007, Oracle. All rights reserved. ulimit: 1: Illegal option -u ulimit: 1: Illegal option -u rpm: To install rpm packages on Debian systems, use alien. See README.Debian. error: cannot open Packages index using db3 - No such file or directory (2) error: cannot open Packages database in /var/lib/rpm rpm: To install rpm packages on Debian systems, use alien. See README.Debian. error: cannot open Packages index using db3 - No such file or directory (2) error: cannot open Packages database in /var/lib/rpm
ulimit
and the RPM-related errors, since the limits don’t restrict the installer and since we actually don’t have a RPM database on the machine — we are running on Ubuntu, remember? oracle
user’s HOME
directory, the installer will issue a warning. I simply ignored it and continued with the installation.root
. Do that when it asks, since the install depends on a few modifications on the base system (like creating the /etc/oratab
file).$ sudo -s
Password:
# /opt/oracle/oraInventory/orainstRoot.sh
Changing permissions of /opt/oracle/oraInventory to 770.
Changing groupname of /opt/oracle/oraInventory to oinstall.
The execution of the script is complete
# /opt/oracle/product/11.1.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/11.1.0/db_1
[: 185: ==: unexpected operator
[: 189: ==: unexpected operator
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
oracledb
(or whatever name you want to call it) and put it in /etc/init.d
with the contents below. This script was copied and pasted from a tutorial by Graham Williams . It will read the /etc/oratab
and fire up any instances it finds.#!/bin/bash # # /etc/init.d/oracledb # # Run-level Startup script for the Oracle Instance, Listener, and Web Interface export ORACLE_HOME=opt/oracle/products/11.1.0/db_1 export PATH=$PATH:$ORACLE_HOME/bin ORA_OWNR="oracle" # 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
# chmod a+x /etc/init.d/oracledb
# update-rc.d oracledb defaults 99 Adding system startup for /etc/init.d/oracledb ... /etc/rc0.d/K99oracledb -> ../init.d/oracledb /etc/rc1.d/K99oracledb -> ../init.d/oracledb /etc/rc6.d/K99oracledb -> ../init.d/oracledb /etc/rc2.d/S99oracledb -> ../init.d/oracledb /etc/rc3.d/S99oracledb -> ../init.d/oracledb /etc/rc4.d/S99oracledb -> ../init.d/oracledb /etc/rc5.d/S99oracledb -> ../init.d/oracledb
/etc/profile
. Be careful, since these values are valid system-wide. So make sure the paths are set according to your particular setup (if you have been doing everything according to this text, you should be fine).export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:/optp/oracle/product/11.1.0/du01/appb_1/bin
dba
group. You can use usermod
or just edit the /etc/groups
file and add your username at the end of the line that starts with dba
(my username is ‘robert’):dba:x:1002:oracle,robert
netca
) and after that, create the starter database (also with netca
). If you chose to have the installer create a database for you, then you should be fine, since when doing that, it asks for a password for the default accounts (SYS
, SYSTEM
, and DBSNMP
, SYSMAN
if you choose to install it with the enterprise manager option selected).oracle
user, type:$ sqlplus SQL*Plus: Release 11.1.0.5.0 - Beta on Wed Jul 11 17:11:53 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. Enter user-name:
Step Twelve
export ORACLE_SID=orcl
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.105.13)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
(2). When you are not connecting to network. Please use the localhost alias to connect the sqlplus.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Add some environment variants in ~/.bashrc
#Oracle Related
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
export ORACLE_ORA=/opt/oracle/product/11.1.0/db_1/bin/network/admin
export PATH=$PATH:/opt/oracle/product/11.1.0/db_1/bin
The startup can be so simple like this,
1. Login with robert user.
2. lsnrctl start
3. sqlplus / as sysdba
sql> startup
The shutdown is like this,
1. Login with robert user.
2. sqlplus /as sysdba
sql> shutdown immediate
3. lsnrctl stop