Setup Oracle 11gR2 on CentOS 5.4

From Bitbull Wiki
Jump to navigation Jump to search

1 Parameters

oracle host tstora01
oracle SID TST01
installation base /opt/u00/setup/11.2.0EE
oracle base dir /opt/u00/app/oracle
oracle home /opt/u00/app/oracle/product/11.2.0/db1
dbfiles, redolog1, controlfile1 /opt/u01/oradata
redolog2, controlfile2 /opt/u02/oradata
archive logs /opt/u03/arch
controlfile3, redolog3 /opt/u03/oradata
backup dest /opt/u04/flash

2 prepare the OS

2.1 create user

mkdir -p /opt/u00/home
groupadd -g 400 dba
useradd -u 400 -g 400 -d /opt/u00/home/oracle -s /bin/bash -c "Oracle Owner" oracle
mkdir -p /opt/u00/home/oracle/admin/sqlnet

2.2 create dirs

mkdir -p /opt/u00/app/oracle/product/11.2.0/db1
mkdir -p /opt/u01/oradata/TST /opt/u02/oradata/TST /opt/u03/oradata/TST /opt/u03/arch /opt/u04/flash
chown -R oracle:dba /opt/u*
chown -R oracle:dba /opt/u*

2.3 set system config

/etc/sysctl.conf
# Kernel Parameters for Oracle 11
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
/etc/security/limits.conf
# To increase the shell limits for Oracle 11g
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

2.4 install needed packages

yum -y install libaio compat-db libXtst.i386 xauth libXp glibc-devel.i386 vnc-server \
compat-libstdc++-33 make gcc openmotif pdksh gcc-c++ libaio-devel libstdc++-devel \
compat-libstdc++-33 sysstat unixODBC unixODBC-devel elfutils-libelf-devel

2.5 create base env for oracle user

~oracle/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Oracle specific aliases and functions
export ORACLE_HOSTNAME=$(hostname -s)
export ORACLE_SID=TST01
export LISTENER_NAME=$ORACLE_SID
export ORACLE_BASE=/opt/u00/app/oracle
export ORACLE_HOME=/opt/u00/app/oracle/product/11.2.0/db1
export ORACLE_DOC=$ORACLE_HOME/doc
export ORACLE_ADMIN=$ORACLE_HOME/network/admin
export TNS_ADMIN=$ORACLE_HOME/network/admin/sqlnet
export PATH=$ORACLE_HOME/bin:$HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export LANG=en_US.UTF-8
export TEMP=/tmp
export TMPDIR=/tmp
export EDITOR=vi
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.al32utf8
export ORA_NLS10=$ORACLE_HOME/nls/data
ulimit -u 16384 -n 63536

3 prepare installation media

3.1 get the media from oracle

go to oracle page
http://www.oracle.com/technology/software/products/database/index.html

and download disk1 and disk2

3.2 unpack the media

unzip installer cds here before you start

cd /opt/u00/setup/11.2.0EE
# installation base dir
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_1of2.zip

4 install application

ssh -X oracle@tstora01
cd /opt/u00/setup/11.2.0EE/database
/opt/u00/setup/11.2.0EE/database/runInstaller 


1. Install database software only
2. Single instance Database installation
3. English language
4. Standard Edition
5. Set Base Path and Software Location
6. Set Inventory Directory and group
7. Set groups for Administrator and Operator
8. Be sure there are no unknown errors
9. Overview screen
10. Start this scripts as root:
/opt/u00/app/oraInventory/orainstRoot.sh
/opt/u00/app/oracle/product/11.2.0/db1/root.sh
11. Thats it

5 create the database

ssh -X oracle@tstora01
dbca
this is a sample configuration:
DATAFILES
  /opt/u01/oradata/TST01/

LOGFILES (50MB)
GROUP 1
    /opt/u01/oradata/TST01/redog1m1.rdo
    /opt/u02/oradata/TST01/redog1m2.rdo
GROUP 2
    /opt/u02/oradata/TST01/redog2m1.rdo
    /opt/u03/oradata/TST01/redog2m2.rdo
  GROUP 3
    /opt/u03/oradata/TST01/redog3m1.rdo
    /opt/u01/oradata/TST01/redog3m2.rdo

CONTROL FILES
    /opt/u01/oradata/TST01/control01.ctl
    /opt/u02/oradata/TST01/control02.ctl
    /opt/u03/oradata/TST01/control03.ctl

LOG_ARCHIVE_DEST 
   /opt/u03/arch/TST01/*.arc

FLASH_DEST 
   /opt/u04/flash/TST01

CHARACTER SET AL32UTF8
1. Welcome
2. Create a Database
3. General Purpose or Transaction Processing
4. Set GDN and SID
5. Do not install Enterprise Manager
6. set Passwords
7. Set Database Files Location
8. Activate FRA if you like: /opt/u04/flash/TST01
9. Automatic Archiving must be enabled
10. Install sample schemas if you like
11. Configure SGA
12. Configure Character Set
13. Configure Control Files
14. Configure Data Files
15. Configure RedoLog Group 1
16. Configure RedoLog Group 2
17. Configure RedoLog Group 3
18. Create Database

6 install enterprise manager (dbconsole)

ssh -X oracle@tstora01
lsnrctl start #needed by dbconsole
dbca
1. Welcome
2. Configure Database Options
3. Select Database
4. Select Enterprise Manager
Select Alert Notifications
Select Daily Backup if you like
only possible if FRA has been configured during DB Creation
5. Database Components
6. Enterp Passwords as choosen at DB Creation time
7. Select Dedicated Server Mode

7 finish installation

7.1 start/stop script

do this as user root:

wget -O - http://www.bitbull.ch/dl/scripts/orainit.sh > /etc/init.d/orainit
chmod 755 /etc/init.d/orainit
vi /etc/init.d/orainit # configure vars
chkconfig orainit --add
chkconfig orainit on
service orainit stop
service orainit start

8 links

8.1 installation

Oracle Database installation Guide
http://www.oracle.com/technology/obe/11gr1_db/install/dbinst/dbinst.htm
Akadia Oracle 11g Installation Guide
http://www.akadia.com/services/ora_howto_install_oracle11_on_linux.html
prepare EL5 Server for oracle 11g installation and guides trough install process
http://www.bitbull.ch/dl/scripts/oracle-11g-install.sh
prepare EL5 Server for oracle 10g installation and guides trough install process
http://www.bitbull.ch/dl/scripts/oracle-10g-install.sh

8.2 maintenance

Script to generate a fullbackup of instance and write logs to syslog
http://www.bitbull.ch/dl/scripts/ora-backup.sh

8.3 monitoring and handling

monitor users and transactions
http://www.bitbull.ch/dl/scripts/oracle-check-deadlocks.sh
change ORACLE_SID for DB administration tasks and generate a nice PS1 prompt
http://www.bitbull.ch/dl/scripts/orasid.sh
check oracle table space usage
http://www.bitbull.ch/dl/scripts/oracle-check-tablespace.sh
oracle alertlog monitor, syslog wrapper and error mailer
http://www.bitbull.ch/dl/scripts/oracle-check-alertlog.sh
search for invalid objects and error mailer
http://www.bitbull.ch/dl/scripts/oracle-check-invalid-objects.sh
Script to start/stop Oracle 10g Database by SystemV
http://www.bitbull.ch/dl/scripts/orainit.sh
monitor users and transactions and error mailer
http://www.bitbull.ch/dl/scripts/oracle-check-deadlocks.sh