Sunday, September 7, 2008

Installing Oracle 10g2 on CentOS 5.0 under VMware

This is a quick and dirty guide that has only the bare essentials of installing Oracle database 10g2 on CentOS 5.0. This was done in a virtual environment under VMWare Workstation but other than the things that are clearly VMWare specific, the installation is exactly the same as on a physical machine.

CentOS (32 bit) Installation
During the package selection do not select any of the "super-package" options (server, server with gui etc), uncheck all of these and select "Customize now". Choose the following package groups, the default selections are adequate except in the case of the Legacy Software Support group:
  • Gnome Desktop Environment
  • Editors
  • Development Libraries
  • Development Tools
  • Legacy Software Development
  • Server Configuration Tools
  • Administration Tools
  • Base
  • Java
  • Legacy Software Support, NOTE: add compat-db and openmotif (libXp will automatically be included as a dependency)
  • System Tools
  • X Window System
VMWare specific: install VMWare-Tools, run vware-config-tools.pl, run vmware-toolbox and enable time synchronization with the host.

Compulsory Configuration Options
  • Assign a static IP, do not use DHCP
  • Turn off the firewall
  • Disable SELinux
Optional Configuration Options
  • Disable IPV6 networking (instructions here)
  • Minimize services (do you really need BlueTooth facilities running?)
  • Install sysstat package (contains sar and iostat)
  • Personal customizations for bash, vim etc.
Prepare for Oracle
It is necessary to add some Oracle-specific users and groups and then change some kernel parameters. We also need to "fool" the Oracle install into believing that we are running on a certified OS by temporarily changing /etc/redhat-release. As root do this

groupadd dba
groupadd oinstall
useradd -g oinstall -G dba -s /bin/bash oracle
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
passwd oracle
cp /etc/redhat-release /etc/redhat-release.orig
echo "Red Hat Enterprise Linux AS release 4 (Nahant)" > /etc/redhat-release

Update /etc/sysctl.conf to include

# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

and then run sysctl -p to load these new parameters.

Set limits on the number of processes and files that can simultaneously be running or open in /etc/security/limits.conf

* soft nofile 1024
* hard nofile 65536
* soft nproc 2047
* hard nproc 16384

Update the PAM login configuration by adding this line to /etc/pam.d/login

session required pam_limits.so

Switch to the oracle user and edit ~/.bash_profile to include the following (obviously change the SID to whatever you want to name your own database)

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID=BRS01
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
export LD_LIBRARY_PATH CLASSPATH

Read this file to get into the new environment by doing

source .bash_profile

and then double check the parameters by echoing them out e.g. echo $ORACLE_SID produces BRS01 in my case.

Oracle Installation
As the user oracle, download and unzip the installation files

unzip 10201_database_linux32.zip

and then change into the "database" directory and run

./runInstaller

and fill in the name of the database (same as the SID in the bash_profile file), a password for the administrators and then it is just clickety, click, click! Assuming you accept all the defaults, of course.

Post Installation
We now need to restore the file containing the OS version

mv /etc/redhat-release.orig /etc/redhat-release

If you want to use the GUI management tools (Database- or Grid-Control) you need to explicitly add a new service to the listener for this new database. If you don't you will get an ORA-12505 in the GUI management tool (TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)) as well as the following error in $ORACLE_HOME/hostName_dbName/sysman/log/emoms.log

ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
The Connection descriptor used by the client was:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=c5-10g2.homeunix.net)(PORT=1521)))(CONNECT_DATA=(SERV
ICE_NAME=BRS01)))

To fix this add a new service to the SID_LIST in $ORACLE_HOME/network/admin/listerner.ora that includes the new database name and ORACLE_HOME location. For example for my database called BRS01, listener.ora looks like this

SID_LIST_LISTENER =

(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = BRS01)
(ORACLE_HOME =
/u01/app/oracle/product/10.2.0/db_1)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = c5-10g2.homeunix.net)(PORT = 1521))
)
)

Fire It Up!
The database can be started in two ways: the command-line-only approach is simply this (as the oracle user)

$ lsnrctl start
$ sqlplus sys/ as sydba
SQL> startup

The GUI approach requires that the listener still be started from the command line (lsnrctl start) but then you go can to http://dbHostName:1158/em and simply click "Startup" and then enter usernames and passwords.

And that's all there is to it!

No comments: