Introduction
This papertakes a look at installing Oracle 11g (11.1) on Linux (CentOS-5).You can readabout CentOS at www.centos.org and beassured of its' Enterprise-class quality. This paper will use Oracle's QuickInstallation Guide for Linux x86 as its' guide—noting where additionalinformation may be obtained but getting Oracle installed on Linux as fast aspossible. We at thecheapdba.com have years of experience installingOracle—starting back with Oracle 7. We will point out best practices so thatyou end up with a reliable database that provides exceptional performance. Wewill occasionally re-visit, edit, and post additions to this paper as we findfurther configuration best practices.
This paperwill not cover the installation of CentOS-5 as that can be acquired through theCentOS website and additional Linux guides. We will however point out thosealterations to the Linux environment that pertains to getting Oracle installed.
Our goalis to provide you with the steps to properly install the Oracle 11g softwarewithout having to read Oracle's installation guide from front to back cover. Wewill provide you the commands to execute (just cut-n-paste) and the desiredoutcome of those commands. If you get something other than what is expected itwould be time for you to re-visit earlier steps in this process. So hold on,here we go.
It isassumed that the installer of Oracle software has access and is running on an XWindow System workstation. Please consult X Server documentation if you needhelp. We at thecheapdba.com typically will use cygwin ( www.cygwin.com ) for all interfacing with ourLinux distribution. It has an X Window System that works quite well—and as wealways like is free.
Checking Hardware Requirements
Log into the CentOS-5 system as the root user.
Forsetting up the system to be used by Oracle there are a few prerequisites thatmust be checked and possibly changed by the root user. Log in as the root userand this document will tell you when it is time to switch from the root user tosomeone else.
How much memory
command:grep -i memtotal /proc/meminfo
results:should be at least 1GB
How much swap
command:grep -i swaptotal /proc/meminfo
results:should be 1.5 the size of memtotal if memtotal < 2GB
should be equal to memtotal ifmemtotal is between 2GB and 8GB
should be .75 the size of memtotal ifmemtotal > 8GB
What processor type
command:grep "model name" /proc/cpuinfo
results:informational
How much available RAM and swap
command:free
results:informational
How much shared memory available
command:df -k /dev/shm
results:informational
purpose:The shared memory should be sized to be at least the greater ofMEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer.
How much disk space in /tmp
command:df -k /tmp
results:should have at least 400MB available
How much disk space for Oracle binaries
command:df -k
results:Depending on installation type you should have between 1.5GB and 3.5GB
Checking Software Requirements
What distribution and version of Linux is installed
command:cat /proc/version
results:Linux version 2.6.18-8.1.15.el5 (mockbuild@builder6.centos.org)
(gcc version 4.1.1 20070105 (Red Hat4.1.1-52))
#1 SMP Mon Oct 22 08:32:04 EDT 2007
What version of the kernel is installed
command:uname -r
results:2.6.18-8.1.15.el5
Are the following packages installed (assumes CentOS-5 andabove distribution)
command:rpm-q binutils \
compat-libstdc++ \
elfutils-libelf \
elfutils-libelf-devel \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
gcc \
gcc-c++ \
libaio-devel \
libaio \
libgcc \
libstdc++ \
libstdc++ \
make \
sysstat \
unixODBC \
unixODBC-devel
results:you will probably get quite a few packages that are not installed with atypical installation. You can investigate missing packages with the followingcommand making sure you add/subtract from this list if necessary.
yumlist available "compat*" \
"elfutils*" \
"glibc*" \
"gcc*" \
"libaio*" \
"sysstat*" \
"unixODBC*"
action: Our base installation left us needing to issue the following command toinstall missing packages.
yum-y install compat-libstdc++-296.i386 \
compat-libstdc++-33.i386 \
elfutils-libelf-devel.i386 \
glibc-devel.i386 \
glibc-headers.i386 \
gcc.i386 \
gcc-c++.i386 \
libaio-devel.i386 \
sysstat.i386 \
unixODBC.i386 \
unixODBC-devel.i386
Create Oracle user and group
Create groups oinstall & dba
command:/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
Create the Oracle and change password
command:/usr/sbin/useradd -g oinstall -G dba -s /bin/bash oracle
/usr/bin/passwd oracle
Validate the nobody user exists
command:/usr/bin/id nobody
results:this user is almost always created on a base CentOS installation
action: if this user is not created use the following command to create
/usr/sbin/useradd nobody
Configuring kernel parameters
Thefollowing kernel parameters must be validated and possibly changed. Use thecommands given below to view a particular kernel setting and then change if thesetting is lower than the recommendation given in the following table.
Youcan make the changes by editing the /etc/sysctl.conf file and then rebootingthe server. The following results are what we observed on our server and shouldnot be expected on yours.
shmmni | 4096 |
shmall | 2097152 |
shmmax | 2147483648 |
semmsl | 250 |
semmns | 32000 |
semopm | 100 |
semmni | 128 |
file-max | 65536 |
ip_local_port_range | 1024 - 65000 |
rmem_default | 1048576 |
rmem_max | 1048576 |
wmem_default | 262144 |
wmem_max | 262144 |
command:/sbin/sysctl -a | grep kernel.sem
results:kernel.sem = 250 32000 100 128
command:/sbin/sysctl -a | grep kernel.shm
results:kernel.shmmni = 4096
kernel.shmall = 268435456
kernel.shmmax = 4294967295
command:/sbin/sysctl -a | grep file-max
results:fs.file-max = 102440
command:/sbin/sysctl -a | grep ip_local_port_range
results:net.ipv4.ip_local_port_range = 32768 61000
command:/sbin/sysctl -a | grep rmem_default
results:net.core.rmem_default = 109568
command:/sbin/sysctl -a | grep rmem_max
results:net.core.rmem_max = 131071
command:/sbin/sysctl -a | grep wmem_default
results:net.core.wmem_default = 109568
command:/sbin/sysctl -a | grep wmem_max
results:net.core.wmem_max = 131071
sample/etc/sysctl.conf file. This is given as an example only and does not reflectthe results obtained above by the /sbin/sysctl commands. Only add lines thatare needed and do not change any values to be lower than the base installationmight have assigned.
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
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
Setting shell limits for the Oracle user
Add the following lines to /etc/security/limits.conf
oracle softnproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Add the following lines to /etc/pam.d/login
session required/lib/security/pam_limits.so
session required pam_limits.so
Add the following lines to /etc/profile
if [ $USER ="oracle" ]; then
if [$SHELL = "/bin/ksh" ]; then
ulimit-p 16384
ulimit-n 65536
else
ulimit-u 16384 -n 65536
fi
fi
Creating Directories to Install the Oracle Software
Validate you have enough space on disk and choose adirectory to install
command:df -k
results:pick a mount point that has enough space—we have chosen /opt for the our.
Create subdirectories and give permissions to the oracleuser
Thefollowing directory used is common for Oracle installations. Note that we arecreating all directories under /opt and that there are no other applicationsusing /opt/app and below. This is very important as we are changing permissionswith the following commands.
command:mkdir -p /opt/app/oracle/product/11.1.0
chown -R oracle:oinstall /opt/app
chmod -R 775 /opt/app
Switch to the oracle user
Upto know we have been doing everything as the root user. It is now time toswitch to the oracle user to actually install the Oracle software.
command:su – oracle
Add the following line to $HOME/.bash_profile
umask022
Execute oracle's bash_profile to use new setting
command:. ./.bash_profile
Make sure the oracle user is using an X Windows System
Itis assumed you know how to set up an X Windows System as stated earlier in thedocument. Please verify it is working by issuing the xterm command andvalidating an X Terminal comes up. You may close the X Terminal if you wish.
Set Oracle environment for the installation
Issuethe following commands to set/unset particular Oracle environments inpreparation for the installation.
command:export ORACLE_BASE=/opt/app/oracle
export ORACLE_SID=orcl
unset ORACLE_HOME
unset TNS_ADMIN
Start Oracle Installer
Thispaper assumes you have downloaded the Oracle software from the net and haveunzipped the files. We have unzipped our software into /opt and the followingcommands will take you through starting the Oracle installer form that mountpoint.
command:cd /opt/database
./runInstaller
Fromthis point, Oracle will do a few minor checks on the operating system and thenput up the Oracle Installation screen. Our particular configuration did notthrow any errors at this point but it should be noted, as it can be helpful,that sometimes the Oracle installer will complain at this very early stageabout various Linux system configurations. If this is the case you might beable to bypass them by adding an additional argument to the runInstallercommand. Please only use this as a last resort to the normal installation path.
command:./runInstaller -ignoreSysPrereqs
Fromthis point on we will walk through each of the prompts one at a time to giveyou a simple feel for a full installation of the Oracle software.
Select installation method
Thisscreen is very busy to say the least. We are not going to create any databasesat this point as it is not required nor is it suggested to do at this point. Welike to create databases separately through the Database Creation Assistant (DBCA)and not confuse the software installation process.
1. Choosebasic installation
1. verifyOracle Base of '/opt/app/oracle'
2. verifyOracle Home of '/opt/app/oracle/product/11.1.0/db_1'
3. verifyinstallation type of 'Enterprise Edition'
4. verifydba group of 'dba'
2. Un-check “CreateStarter Database”
3. Un-check “AdvancedInstallation”
4. Click<NEXT>
Specify Inventory directory and credentials
1. verifypath of inventory directory of '/opt/app/oraInventory'
2. verifygroup name for install of 'oinstall'
3. Click<NEXT>
Product-Specific Prerequisite Checks
Thisscreen, the installer will verify the system environment and report on anyissues it may find. If all goes well you will get the status of 'Succeeded' forevery check. Scroll through and make sure nothing has failed or look at thestatus box at the bottom of the screen and verify you get the following:
'Check complete. The overall result of this check is:Passed'
1. verifyall statuses
2. Click<NEXT>
Summary
Thisscreen give a summary of the installation you are about to perform. It can beinteresting to click and expand the products being installed to give you anidea of the what product and version is going to be installed.
1. validate'Global Settings' for directories
2. validate'Space Requirements'
3. Click<NEXT>
Install
Thisscreen gives a status of what is being installed. If all system settings havebeen properly set and all packages been installed properly then this shouldproceed without error. The status bar gives some indication of what is beinginstalled at a particular point and the amount of work to be performed. But asall status bars you never really know how long in the process it is.
1. Notethe time it takes for specific products. If you notice one hanging or taking along amount of time (greater than 10 minutes) you could have a condition thatrequires a pre-installation patch. Don't stop the installer yet but insteadstart looking for a bug / patch for the Oracle 11g installation process and theactual product being installed.
2. ExecuteConfiguration scripts
1. openup a different terminal window
2. loginas the root user
3. run/opt/app/oraInventory/orainstRoot.sh
4. run/opt/app/oracle/product/11.1.0/db_1/root.sh
1. acceptdefault of /usr/local/bin
5. Click<OK>
3. Click<EXIT>
4. Click<YES>
Cleanup
1. Ifyou downloaded the software from the net you can now remove .zip file and thecomplete directory structure you unzipped it to. That particular command is notgiven here as it can be quite disastrous if executed from the wrong directory.
2. Addthe following lines to oracle's $HOME/.bash_profile file. This will allow youto execute various Oracle binaries to create databases, configure networksettings, and generally manage the Oracle database environment.
exportORACLE_HOME=/opt/app/oracle/product/11.1.0/db_1
exportPATH=$ORACLE_HOME/bin:$PATH
Installation is complete
Congratulationson a successful installation of the Oracle software. This paper hopefully wasalso successful in its attempt to guide you down a more simplistic path—givingyou the commands to execute and working past the minor hurdles encounteredduring installation. Obviously this paper can not predict all the issues thatyou may encounter but if you have a relatively current system with ample memoryand disk space there is no reason not to believe your installation wouldn't runsmoothly.
参考网址:
http://www.jameskoopmann.com/docs/Install_Oracle11gCentOS5.htm