Configuring RHAS 30 for Oracle and Increasing Memory Size


Applicable installations
This installation instruction has been checked for:
- Oracle Enterprise Manager (9i and 10g)
- Red Hat Advance Server developer version

Following requirements need to be met for a successful installation of  Oracle 9.2.0.6 (a 3 CD set which includes the base release and all fixes from prior patchsets including 9.2.0.4) on Red Hat Enterprise Linux AS/ES 3.0 (RHEL3) on platform Linux x86 .

Software
* Linux kernel version should be 2.4.21-4.EL
* Glibc Version Number glibc 2.3.2-95.3
* Required OS Components for 9i
- compat-db-4.0.14.5
- compat-gcc-7.3-2.96.122
- compat-gcc-c++-7.3-2.96.122
- compat-libstdc++-7.3-2.96.122
- compat-libstdc++-devel-7.3-2.96.122
- openmotif21-2.1.30-8.i386.rpm
- setarch-1.3-1

* Required OS Components for 10g
+ compat-db-4.1.25-9
+ compat-gcc-32-3.2.3-47.3
+ compat-gcc-32-c++-3.2.3-47.3
+ compat-oracle-rhel4-1.0-3
+ compat-libcwait-2.0-1
+ compat-libgcc-296-2.96-132.7.2
+ compat-libstdc++-296-2.96-132.7.2
+ compat-libstdc++-33-3.2.3-47.3
+ xorg-x11-deprecated-libs-devel-6.8.1-23.EL
+ xorg-x11-deprecated-libs-6.8.1-23.EL

In addition, install the following rpm's (available on Disk3 of the RHEL4.0 media)
+ openmotif21-2.1.30-11
+ libaio-0.3.102-1
+ libaio-devel-0.3.102-1

Installing RHAS 30 (we required to install the developer version)
In this section the OS is installed.
- Insert the first cdrom (autoboot)
- Hit Enter to get going (no need to rescue)
- Skip the media test
- On the installation screen, hit Next
- On the language selection, choose your language
- On the keyboard selection, choose your keyboard
- On the mouse selection, choose your mouse
- On the disk setup, choose to partition with DiskDruid
- create a root (/) partition at least 2GB, preferrably bigger than 2.5GB and make it type ext3
- create a swap partition at least 2GB, recommended double the size of the internal physical memory
- create an oracle partition (/oracle) size depending on the software to be installed, recommended the remaining disk space
- On the bootloader configuration, choose the bootloader of your choice, remmended to go with the default "Grub"
- On the network configuration, configure your network. If you are unsure, leave it to the defaults (DHCP)
- On the Firewall configuration, set your firewall options. If you are unsure, leave it to the defaults (Enable firewall).
- On additional Language support, choose your preferred langauge.
- On the timezone selection, choose your home country/city.
- Set the root password.
- On the package selection, select "customize the set of packages to be installed"
- Select at least the following packagesets:
- X Window System
- Gnome Desktop Environment
- Graphical Internet
- Server Configuration Tools
- Development Tools
- Legacy Software Development
- Administrative Tools
- X Software Development

- At the Graphical Interface configuration, choose the suggested videocard and memory size. If you are unsure, choose the Other > Generic VGA compatible
- At the monitor configuration, choose the suggested monitor. If you are unsure, choose the Generic CRT > Monitor 640x480
- At the Customize Graphics Configuration, choose the the "Text" login type and choose the screen resolution and depth. If you are unsure, choose 640x480 at 8bit.
- Let the system reboot

Installing additional packages (not needed if everything was installed properly)
In this section, additional packages are installed required by oracle.
To see if these development packages are installed on your server, run the following command:
rpm -q gcc cpp compat-libstdc++ glibc-devel glibc-headers glibc-kernheaders binutils

- After system bootup, login as root and insert the Disk2:
mount /mnt/cdrom
rpm -iv /mnt/cdrom/RedHat/RPMS/sysstat-4.0.7-4.i386.rpm
eject
- insert Disk3:
mount /mnt/cdrom
rpm -iv /mnt/cdrom/RedHat/RPMS/compat-db-4.0.14-5.i386.rpm
rpm -iv /mnt/cdrom/RedHat/RPMS/ORBit-0.5.17-10.4.i386.rpm
rpm -iv /mnt/cdrom/RedHat/RPMS/libpng10-1.0.13-8.i386.rpm
rpm -iv /mnt/cdrom/RedHat/RPMS/gnome-libs-1.4.1.2.90-34.1.i386.rpm
eject

Environment
* Put gcc296 and g++296 first in $PATH variable by creating the following symbolic links (Metalink Note 252217.1), as root perform:
These are required for the relinking of some Oracle binaries (as root)
mv /usr/bin/gcc /usr/bin/gcc323
mv /usr/bin/g++ /usr/bin/g++323
ln -sf /usr/bin/gcc296 /usr/bin/gcc
ln -sf /usr/bin/g++296 /usr/bin/g++
* hostname command should return the fully qualified hostname as shown below:
% hostname
hostname.domainname
* If any Java packages are installed on the system, unset the Java environment variables, for example JAVA_HOME.
* The oracle account used to install Oracle 9.2.0.1, should not have the Oracle install related variables set by default. For example setting ORACLE_HOME, PATH, LD_LIBRARY_PATH to include Oracle binaries in .profile, .login file and /etc/profile.d shouldbe completely avoided.

Configure the kernel parameters
In this section, kernel parameters are configured.

- Configuring the kernel parameters, replace "machine123" and "oracle.com" with your own settings.
echo "" >> /etc/sysctl.conf
echo "# Oracle specific settings" >> /etc/sysctl.conf
echo "kernel.hostname = machine123.oracle.com" >> /etc/sysctl.conf
echo "# semaphores in kernel.sem: semmsl semmns semopm semmni" >> /etc/sysctl.conf
echo "kernel.sem = 256 32000 100 142" >> /etc/sysctl.conf
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.shmall = 3279547" >> /etc/sysctl.conf
echo "fs.file-max = 327679" >> /etc/sysctl.conf
# Disables packet forwarding
echo "net.ipv4.ip_forward = 0" >> /etc/sysctl.conf
# Enables source route verification
echo "net.ipv4.conf.default.rp_filter = 1" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
echo "kernel.msgmni = 2878" >> /etc/sysctl.conf
echo "kernel.msgmnb = 65535" >> /etc/sysctl.conf
echo "" >> /etc/security/limits.conf
echo "# Oracle specific settings" >> /etc/security/limits.conf
echo "oracle soft nofile 1024" >> /etc/security/limits.conf
echo "oracle hard nofile 65536" >> /etc/security/limits.conf
echo "oracle soft nproc 2047" >> /etc/security/limits.conf
echo "oracle hard nproc 16384" >> /etc/security/limits.conf


Configure the hostname
In this section, the hostname of the machine is set to the hosts file.

- Add as the first line the ip address, fully qualified name of your machine and alias. Replace the "127.0.0.2" and "machine123.oracle.com" with your own settings.
cd /etc
mv hosts hosts.org
touch hosts
echo "# Do not remove the following line, or various programs" >> /etc/hosts
echo "# that require network functionality will fail." >> /etc/hosts
echo "127.0.0.2 machine123.oracle.com machine123" >> /etc/hosts
echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts

Patching the OS for oracle related issues
In this section, postfixes are applied to the OS.

- Apply patch 3006854,INSTALLER INTEROPERABILITY PATCH FOR RHEL3.0
This patch must be installed on systems running Red Hat Enterprise Linux 3.0 before running the Oracle Universal Installer (for any Oracle product). To resolve libcwait symbol issue before invoking Oracle installer. Download from metalink patch
3006854 or download from updates.oracle.com
wget ftp://metalink_user:password@updates.oracle.com/3006854/p3006854_9204_LINUX.zip
unzip p3006854_9204_LINUX.zip
cd 3006854
sh rhel3_pre_install.sh

Shutting down unused programs
We are not using all of the started options. E.g. on your server, you do not have the pcmcia and probably don't use power management. A lot of services are started, but not configured and therefore not running.

- Finding the services configured to start:
chkconfig --list | more
- Finding the services actually running:
ls /var/lock/subsys
- Getting a description of the services
head /etc/init.d/<service>
e.g. "head /etc/init.d/sendmail"
- stopping a service
service <service> stop
e.g. "service sendmail stop"
- configuring a service not to start
chkconfig --level 345 <service> off
e.g. "chkconfig --level 345 sendmail off"

Creating the user oracle
In this section, OS oracle and its group are created.

- create the group oinstall and dba
groupadd dba          # group granted with SYSDBA system privilege
groupadd oinstall    
# group owner of Oracle files

- create the user oracle
useradd -c "Oracle software owner" -g oinstall -G dba oracle
passwd oracle


- Create the Oracle Directories
su - root
mkdir /opt/oracle
mkdir /opt/oracle/product
mkdir /opt/oracle/product/9.2.0
chown -R oracle.oinstall /opt/oracle                             
mkdir /var/opt/oracle
chown oracle.dba /var/opt/oracle
chmod 755 /var/opt/oracle

Modify /.bash_profile Adding:

# Set the LD_ASSUME_KERNEL environment variable only for Red Hat 9 and
# for Red Hat Enterprise Linux Advanced Server 3 (RHEL AS 3) !!
export LD_ASSUME_KERNEL=2.4.19
# Oracle Environment
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/9.2.0
export ORACLE_SID=FGUARD
export ORACLE_TERM=xterm
# export TNS_ADMIN= Set if sqlnet.ora, tnsnames.ora, etc.
# are not in $ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN;
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
# Set shell search paths
export PATH=$PATH:$ORACLE_HOME/bin


Configuring VNC server
VNC server allowes you to run a very small graphical subsystem, without using a console. The Oracle Universal Installer will require a graphical display, but probably you do not want to do an installation on console.

- Configure service vncserver to be started at boottime
chkconfig --level 345 vncserver on
- Configure vncserver to start vncserver as user oracle
echo "VNCSERVERS=\"1:oracle\"" >> /etc/sysconfig/vncservers
- Start vncserver manually for the first time. You will be prompted for a password for the vncserver.
su - oracle
vncserver :1
- As user oracle, configure the vncserver session environment
cd .vnc
mv xstartup xstartup.org
touch xstartup
chmod 755 xstartup
echo "#"\!"/bin/sh" >> xstartup
echo "" >> xstartup
echo "# Uncomment the following two lines for normal desktop:" >> xstartup
echo "# unset SESSION_MANAGER" >> xstartup
echo "# exec /etc/X11/xinit/xinitrc" >> xstartup
echo "" >> xstartup
echo "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources" >> xstartup
echo "xsetroot -solid grey" >> xstartup
echo "vncconfig -iconic &" >> xstartup
echo "xhost localhost" >> xstartup
echo "PATH=\$PATH:/usr/local/bin" >> xstartup
echo "export PATH" >> xstartup
echo "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &" >> xstartup
echo "twm &" >> xstartup
- As user oracle, stop the vncserver
vncserver -kill :1
exit
- If you need to change the passwd of it, run the following command:
    /usr/bin/vncpasswd

Setting ldap ports
If you want to install the Oracle Internet Directory on the ldap standard ports, you have to erase all lines containing "ldap" or "ldaps" out of the /etc/services file.

Reboot the system
- to active all changes, reboot the system
reboot
After reboot, verify all kernel parameters have been set correct, by issuing "sysctl -a"
This because the kernel.semmax is not always accepted on 4GB and then ignored.

Oracle Installation
* Define and export the environment variable LD_ASSUME_KERNEL before starting the install process:
export LD_ASSUME_KERNEL=2.4.19

Additional Installation Steps
* Open a new terminal window
* Apply patch number 3006854 to provide libcwait symbol (as we mentioned before)
* After completing above steps start ./runInstaller from 9iR2 CD 1 from shell where you have defined above variable. You may get the following errors:
- relink error for ins_oemagent.mk - Click on Continue and complete the install
- apply the patch for Bug: 3119415 after the install is completed
- ctx relinking error in ins_ctx.mk: Click ignore. This is fixed by applying 9.2.0.4 or 9.2.0.5 patchset.

NOTE: This step will not be necessary to perform if you are installing from the new release 9.2.0.4 (Part #'s B13496-01, B13497-01, and B13498-01 which is the complete distribution of 9.2.0.1 with the 9.2.0.4 already installed). Do not confuse this with the 9.2.0.4.0 patchset ( Bug: 3095277 ) which only contains the 9.2.0.4 fixes and is not a complete package. Also, it should be considered that if you have installed the 9.2.0.1.0 base release to then apply the 9.2.0.5.0 patchset ( Bug: 3501955 ) instead of 9.2.0.4.0 patchset.

ADDITIONAL NOTES
* For customers using asynch_io , apply bug: 3208258 (Fixed In Ver: 9.2.0.4 or 9.2.0.5)

RELATED DOCUMENTS
[NOTE:252217.1] Requirements for Installing Oracle 9iR2 on RHEL3


Implement Asynchronous I/O
Many times there is a requirement to check if Asynchronous I/O is working on Linux Platform, so we can try to use it for our datafiles access inside database.
slabinfo maintains statistics about objects in memory. Some of the structs used by Asynchronous I/O are threated as objects in the virtual memory, so we can
look for those structs on slabinfo. The ones related to AIO are named kio*.

$ cat /proc/slabinfo | grep kio

for example: output with async io enabled.
$ cat /proc/slabinfo | grep kio
kioctx  270   270 128    9    9 1 : 252 126
kiocb 66080 66080  96 1652 1652 1 : 252 126
kiobuf  236   236  64    4    4 1 : 252 126

output with async io disabled.
$ cat /proc/slabinfo | grep kio
kioctx 0 0 128 0 0 1 : 252 126
kiocb  0 0 96  0 0 1 : 252 126
kiobuf 0 0 64  0 0 1 : 252 126

There are 3 caches involved. The kioctx and kiocb are Async I/O data structures that are defined in aio.h. If it shows a non zero value that means async io is  nabled.
If you have the source code loaded, you can review it at file aio.h. This file is located under: /usr/src/linux-<version>/include/linux/aio.h
These data structures are using to track the I/O requests, and are allocated as part of the __init aio_setup() call in aio.c.

More Information HERE

Automatic Database Start and Shutdown on Linux

The "su" Command

The following represents the Oracle recommended method for automating database startup and shutdown of Oracle 9i instances.
Edit the /etc/oratab file, remove empty lines and set the restart flag for each instance to 'Y' for PROD databases only:
XXX:/opt/oracle/product/9.2.0:Y

Create a file called /etc/init.d/dbora containing the following:
#!/bin/sh
# description: Oracle auto start-stop script.
# chkconfig: - 20 80
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# Set ORACLE_OWNER to the user id of the owner of the Oracle database in ORACLE_HOME.
#
ORACLE_HOME=/opt/oracle/product/9.2.0
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi
case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
        su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart &"
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut &"
        su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
        ;;
esac

Use chmod to set the privileges to 750:
chmod 750 /etc/init.d/dbora

Link the file into the appropriate run-level script directories:
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora


Associate the dbora service with the appropriate run levels:
chkconfig --level 345 dbora on

The relevant instances should now startup/shutdown automatically at system startup/shutdown.
This method can still be used under Oracle 10g, provided the "ORA_HOME" variable is amended to use the correct path. The lines to start and stop the listener can be removed under Oracle 10g release 2, as the dbstart command includes an automatic start of the listener.


The "rsh" Command
With Oracle 10g, Oracle switched from recommending the "su" command to the "rsh" command. In Oracle 10g release 2, the dbstart command includes an automatic start of the listener, so there are some differences between the two versions, but the following represents the preferred method for Oracle 10g.

Edit the /etc/oratab file, remove empty lines and set the restart flag for each instance to 'Y' for PROD databases only:
TSH1:/u01/app/oracle/product/10.2.0/db_1:Y

Next, create a file called "/etc/init.d/dbora" as the root user, containing the following.
#!/bin/sh
# description: Oracle auto start-stop script.
# chkconfig: - 20 80
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
   if [ "$PLATFORM" = "HP-UX" ] ; then
      remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
      exit
   else
      rsh $HOST -l $ORACLE  $0 $1 ORA_DB
      exit
   fi
fi
#
case $1 in
'start')
        $ORACLE_HOME/bin/dbstart $ORACLE_HOME
        ;;
'stop')
        $ORACLE_HOME/bin/dbshut $ORACLE_HOME
        ;;
*)
        echo "usage: $0 {start|stop}"
        exit
        ;;
esac
#
exit

Use the chmod command to set the privileges to 750.
    chmod 750 /etc/init.d/dbora

Associate the dbora service with the appropriate run levels and set it to auto-start using the following command.
    chkconfig --level 345 dbora on

The relevant instances should now startup/shutdown automatically at system startup/shutdown.
This method relies on the presence of an RSH server, which requires additional packages and configuration.
    # Install the rhs and rsh-server packages from the OS CD/DVD.
    rpm -Uvh --force rsh-*

    # Enable rsh and rlogin.
    chkconfig rsh on
    chkconfig rlogin on
    service xinetd reload

This can be quite problematic when attempting to use this method under FC5 and FC6, where rsh is deprecated. As a result, I prefer to use the "su" command method.


After 10g Installation
--As SYSTEM:
Exec dbms_stats.gather_schema_stats(’SYS’);
exec dbms_stats.gather_dictionary_stats;

--During workload
Exec dbms_stats.gather_schema_stats(’SYS’,gather_fixed=>TRUE) ;

-- Set Default tablespace for all the users
ALTER DATABASE DEFAULT TABLESPACE <tsname>;

-- Use Row Timestamp for inserts/updates/deletes, it shows date of modification

When to Collect Dictionary Statistics
Oracle recommends the following strategy with regard to analyzing the data dictionary in Oracle Database 10g:
1. Analyze normal data dictionary objects (not fixed dictionary objects) using the same interval that you currently use when analyzing other objects. Use gather_database_stats, gather_schema_stats, or gather_dictionary_stats to perform this action. Here is an example:
Exec dbms_stats.gather_schema_stats(’SYS’,gather_fixed=>TRUE)
 
2. Analyze fixed objects only once, unless the workload footprint changes. Generally, use the dbms_stats.gather_fixed_object_stats supplied procedure when connected as SYS or any other SYSDBA privileged user. Here is an example:
Exec dbms_stats.gather_fixed_objects_stats(’ALL’);

3. Collect specific Statistics for a Table (if needed)
Exec dbms_stats.gather_table_stats(’my_user’,’my_tab’);
or
Exec dbms_stats.gather_table_stats(’my_user’,’my_tab’, degree=>dbms_stats.auto_degree);

- Shrink Tables when they are heavily deleted rows