Oracle 9i release 1 (9.0.1) on Red Hat 9.1

From Oracle FAQ
Jump to: navigation, search

Installing Oracle 9.0.1 on Redhat Linux 9.1:

1. Installing Redhat Linux 9

Hard Disk Partitions

     We partitioned the 80GB Hard disk like this
     /           -      15000  MB
     swap        -      3000   MB  (Swap Space must be greater then or        equal to  2 * RAM)
     /usr1       -       30000 MB 
     /usr2       -       32000 MB

Packages Selected


2.Installing Oracle 9.0.1


Step 1 : Store the Oracle setup to Hard disk

Login as root and save the oracle setup to the Hard Disk (/usr1). Copy each Disk in seperate folders. You must do this because, once the installation is started, oracle wont allow you to unmount (umount) the CD ROM. So when oracle setup asks for the second CD, you wont be able to take out the first CD and load the second one and as a result the installation may fail.

Step 2 : Setting swap space

In order to perform a typical Oracle 9i installation and to create a simple prototype database, Oracle says that you need a minimum of 512MB of RAM for the Oracle9i (9.0.1) Server, and the amount of disk space (swap space) should be equal to twice the amount of RAM or at least 400MB, whichever is greater.

I successfully installed oracle 9.0.1 without increasing the swap space

NOTE: If you do not have enough swap space or RAM during the Oracle installation, in particular during the database creation, your Oracle server (Linux) will temporarily become unresponsive to any events for several minutes.

To check the memory, run:

grep MemTotal /proc/meminfo

To check the swap space, run:

cat /proc/swaps



You can also add temporary swap space by creating a temporary swap file instead of using a rawdevice.

Here is the procedure:

su - root

  1. dd if=/dev/zero of=tmpswap bs=1k count=900000
  2. chmod 600 tmpswap
  3. mkswap tmpswap
  4. swapon tmpswap

To disable the temporary swap space after installation, execute the following commands:

su - root

  1. swapoff tmpswap
  2. rm tmpswap


Step 3 : Setting Shared Memory

For Oracle 9i installation I had to increase the maximum shared memory size on my Linux server. The Oracle Database Configuration Assistant displayed the following error message on my server: ORA-27123: unable to attach to shared memory segment.

I temporarely increased the shmmax setting for the kernel by executing the following command:

$ su - root

  1. cat /proc/sys/kernel/shmmax

3 33554432

To increase the shared memory,

  1. echo `expr 1024 \* 1024 \* 1024` > /proc/sys/kernel/shmmax

( The mark ` before and after the expression “expr 1024 \* ...” is not single quotes. Its the symbol below tilde)

  1. cat /proc/sys/kernel/shmmax

1073741824

It is recommended to increase the shmmax setting permanently for Oracle.These parameters apply to all Red Hat Linux versions. But note that except for the shmmax parameter, these parameter do not need to be changed for installing Oracle on Linux. But you might want to adjust all shared memory settings later to optimize the server for Oracle.

Step 4 : Checking /tmp Space

I could successfully install oracle without increasing the /tmp space.

The Oracle Universal Installer requires up to 400 MB of free space in the /tmp directory.

To check the space in /tmp, run:

$ df /tmp

If you do not have enough space in the /tmp directory, you can temporarily create a tmp directory in another filesystem. Here is how you can do this:

su - root

  1. mkdir /<AnotherFilesystem>/tmp
  2. chown root.root /<AnotherFilesystem>/tmp
  3. chmod 1777 /<AnotherFilesystem>/tmp
  4. export TEMP=/<AnotherFilesystem> (used by Oracle)
  5. export TMPDIR=/<AnotherFilesystem> (used by Linux programs like the linker "ld")

When you are done with your Oracle installation, shutdown Oracle and remove the temporary directory:

su - root

  1. rmdir /<AnotherFilesystem>/tmp
  2. unset TEMP
  3. unset TMPDIR


Step 5 : Creating Oracle User Accounts

Login as root and create groups ‘dba’ and ‘oinstall’

su - root

  1. groupadd dba
  2. groupadd oinstall ( Group owner of oracle files)
   Here dba is the group of users to be granted with SYSDBA  system previlege and oinstall is the group owner of oracle files

Now Create the oracle user by giving this command

  1. useradd -c “Oracle Software Owner” -g oinstall -G dba oracle

Now give password to the oracle user

  1. passwd oracle

Step 6 : Creating Oracle Directories

     We created the Oracle direstories in ‘/usr2’

su - root

  1. mkdir -p /usr2/oracle/product/9.0.1
  2. chown -R oracle:oinstall /usr2
  3. mkdir /var/opt/oracle
  4. chown oracle.dba /var/opt/oracle
  5. chmod 755 /var/opt/oracle

Step 7 : Installing JDK

To run the Database Confiduration Assistand (dbca), you have to install JDK

Download the file “jdk118_v3-glibc-2.1.3.tar.bz2”

You can download JDK from anyone of these sites

   <http://www.blackdown.org/>
  <http://java.sun.com/>
  http://www.filewatcher.com

Now install JDK by running this command as root

su - root

  1. bzip2 -dc jdk118_v3-glibc-2.1.3.tar.bz2 | tar xf - -C /usr/local

After that create a symbolic link to the JDK under /usr/local/java:

  1. ln -s /usr/local/jdk118_v3 /usr/local/java

Step 8 : Setting Oracle Environments

Red Hat 9 includes now the Native POSIX Thread Library (NPTL) which is an improved implementation of POSIX threads for Linux. But using NPTL will cause several problems for Oracle applications. Note that Oracle9i has not been certified on Red Hat 9!

So to fix this problem, you can set the environment variable LD_ASSUME_KERNEL to 2.4.1, which means that the old "Linuxthreads with floating stacks" implementation will be used. Otherwise the Oracle installer runInstaller will hang, the Database Configuration Assistant dbca won't start etc. May hapen

You will get the following error while trying to start the Oracle installer and dbca if the LD_ASSUME_KERNEL environment variable is not set correctly

“Unable to initialize threads: cannot find class java/lang/Thread Could not create Java VM”

To set the environement variables

Login as oracle and edit the .bash_profile

$ vi .bash_profile

Now enter these lines and save the file

export LD_ASSUME_KERNEL = 2.4.1 export ORACLE_BASE= /usr1/oracle export ORACLE_HOME=/usr1/oracle/product/9.0.1 export ORACLE_SID=web export ORACLE_TERM=xterm export DISPLAY=localhost:0.0 export NLS_LANG=AMERICAN export DISPLY=localhost:0.0 export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export LD_LIBRARY_PATH export PATH=$PATH:$ORACLE_HOME/bin CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib export CLASSPATH

Step 9 : Starting runInstaller

Oracle installer must be run from X. You will need to allow the local oracle user to write to your X display.

For that, login as root and run this command,

  1. xhost +127.0.0.1

If you forgot to set the DISPLAY environment variable (e.g. export DISPLAY=oracleserver:0.0), or if you forgot to give the remote console - your Oracle Server - authority to display X information on your desktop PC (e.g. xhost +oracleserver), then you will get the following error:

Xlib: connection to ":0.0" refused by server Xlib: Client is not authorized to connect to Server

In this case, I always had to kill runInstaller in Oracle 9.0.1 which was still running in the background. If I didn't do this in 9.0.1, runInstaller didn't completely come up any more without displaying any error messages. You might also want to clean up /tmp/OraInstall.


Now switch to oracle and run runinstaller from its path. Here it is like this,


  1. su - oracle

$ cd /usr2/ora9.0.1/DISK1/Install/linux $ ./runInstaller


Step 10 : Oracle Installation Steps

This is how I answered the questions of Oracle Installer

Screen 1 : Welcome Screen

Click Next

Screen 2 : Inventory Location

Accept default values and click Next

Screen 3 : Unix Group Name

Give “oinstall” as the unix group and click Next

You could also use "dba" which I do not recommend for security reasons.

Now the installer will ask you to run orainstRoot.sh from another window before proceeding. For that take another terminal and login as root. Now cd to /tmp and run the orainstRoot.sh

  1. ./orainstRoot.sh

After running the orainstRoot.sh, come back to the installation terminal and click ‘OK’

Screen 4 : File locations

Use the default values and click ‘Next’

Screen 5 : Available products

Use the default values and click Next

Screen 6 : Installation Types

Select custom ane click Next

Screen 7 : Available products

Use default values and click Next

Screen 8 : Components Locations

Use default values and click Next

Screen 9 : Privileged Operating System Groups

I used the default values: OSDBA Group = dba, OSOPER Group = dba

Screen 12 : Create Database

Select ‘No’ and click Next

Screen 11 : Oracle Managent Server Repository

Use the default values and click Next

Screen 12 : Summary

Start the Installation

When the Installation is around 11% you may get an error like this

“Error in writing from file /product/9.2.0/oem_webstage/emwebsite_de.html to......”

Simply ignore that error. Similar errors may appear for almost all the .html files in the directory- “/product/9.2.0/oem_webstage/”. (This may continue up to 14%). Ignore all those errors


In the Istallation phase, we didnt get anyother errors after the html file error on 14%

After completing the Installation part, Oracle Installaer will start the relinking part.

We got a relinking error, after the Installer had completed 64% of its relinking.

"Error invoking target install of makefile /opt/oracle/product/9.0.1/plsql/lib/ins_plsql.mk"

This error is due to the absence of two required rpms glibc-devel-2.3.2-5.i386.rpm and glibc-2.3.2-5.i686.rpm

Now keep the installation window as such and login as root in another terminal. Download the rpm files and store them as root. (You can get these rpms from <http://www.filewatcher.com>)

First Install the glibc-devel rpm by using this command,

  1. su - root
  2. rpm -Uvh - -force - -nodeps glibc-devel-2.3.2-5.i386.rpm

Preparing... ########################################### [100%] 1:glibc ########################################### [100%]

After successfully installing the glibc-devel, install the glibc rpm,

  1. su - root
  2. rpm -Uvh - - force - -nodeps glibc-2.3.2-5.i686.rpm


Preparing... ########################################### [100%] 1:glibc ########################################### [100%]


After its successful installation switch to oracle using,

  1. su - oracle

Now goto bin directory in oracle home

$ cd $ORACLE_HOME/bin

There edit the genclntsh file and change the value of LD_SELF_CONTAINED

From

   LD_SELF_CONTAINED= ”-z defs”

To

   LD_SELF_CONTAINED= “”

Save the file and exit. After that execute the script

$ ./genclntsh

Now you may get an error

“Cannot stat ‘/DISCARD :No such file or directory”

If you get the messge,

“Created /opt/oracle/product/9.0.1/lib/libclntst9.a” after that, then dont worry about the error

After that goto the installation terminal and hit ‘Retry’ in the error dialog box.

This always worked for me. After that the Installation will go smoothly. After the installation is completed, the installer will ask you to run the root.sh file.

Now login as root in another window and run the root.sh file and click continue..

In the final stage of the installation the installer will run Network configuration assistant and other two components. Forget about the other two. But the Network configuration Assiasyant may sometimes hang. In that case, simply select it, click stop and start it again. This will work for sure.

At the end of the installation click exit.

Step 11 : Startup and Shutdown of Oracle 9i database


Before connecting to sqlplus, make sure that these parameters are correct

Open the file $ORACLE_BASE/admin/web/pfile/init.ora

Change the value of db_name from DEFAULT to web

db_name = web

and save the file

Now open the file /etc/oratab and change the line,

web:/usr2/oracle/product/9.2.0:N

to

web:/usr2/oracle/product/9.2.0:Y


Now you can connect to sqlplus and start oracle without mounting To start oracle, login as oracle and give the commands

su - oracle

$sqlplus /nolog

SQL > conn / as sysdab Connected

SQL > startup nomount

Step 12 : Creating Database

You can create the database either by running Database Configuration Assistnad (dbca) or by running databse creation scripts as sys user

I first created the database creation scripts using dbca and then ran the scripts manually. For that start dbca and select the “Generate database creation scripts” option and start the installaton.

To start dbca , Login as oracle and type dbca

su - oracle

$dbca

You may get the same java error that you got a little bit earlier, while trying to start the oracle installer. Then just login as root and add xhost (xhost +127.0.0.1) and run dbca again as oracle user.


You may get errors from dbca. If you have selected the db script generation option, then abort the installation on seeing the first error.

Now $ORACLE_BASE/admin/web/scripts/ directory and run the web.sh

Before running web.sh modify the init.ora file path in CreatDB.sql which is called by web.sh.

su - oracle

$ cd $ORACLE_HOME/admin/web/scripts/ $ web.sh

At one stage I got the following error,

“Oracle not available. Disconnection forced”

This was because, the oracle password file orapassw was not present. Then I created a new password file .

To create a new password file, run this command as oracle

su - oracle $ orapwd file=password_file_name password=the_secret_password

eg: orapwd  file=$ORACLE_HOME/../../orapassw password=ora123

Now run the script again. This time you will be able to create the database.If Same Error comes again check actual alertlog.ora ie $ORACLE_BASE/admin/web/bdump/alertweb.ora and Just add following parameter in $ORACLE_HOME/dbs/init.ora file

         compatible=9.0.0.0.0

You may get another error related to UNDO tablespace creation. Just add following parameter in $ORACLE_HOME/dbs/init.ora file

         UNDO_MANAGEMENT=AUTO
         UNDO_TABLESPACE=UNDOTBS 

Retry web.sh after removing old dbf files.


After creating Database ...

$su - oracle

$sqlplus /nologin SQL > connect / as sysdba SQL >shutdown immediate

   Database closed.
   Database dismounted.
   ORACLE instance shut down.

SQL > startup

   ORACLE instance started.  
   Total System Global Area     101393832 bytes
   Fixed Size                       41880 bytes  
   Variable Size                 18448912 bytes
   Database Buffers              82739200 bytes
   Redo Buffers                    163840 bytes
   Database mounted.
   Database opened.

SQL> exit


  To make jobs running automatically...
  Add following parameters in initweb.ora.
  
  processes=150
  job_queue_processes=40
  job_queue_interval=60

  save and quit.
  sqlplus system/manager 
  SQL>show parameter job
  SQL>process               Value
  SQL>--------------------- -----  
  SQL>job_queue_processes       0
  SQL> alter system set job_queue_processes=40 scope=pfile;
  SQL> system alterd.
  
Restart machine or oracle to make it effective.

After creating the database, login as system/manager and create the required table spaces and import the dump files.

Table Spaces Created for Calicut Mediation

 For calicut mediation, we created these tablespaces manually.

MCP_TAB MCP_TAB_SPC BOW_TAB MCS_TAB_SPC SNAP_IND SNAP_TAB TEMP_TAB

To create the tablespaces first create the directories,

/usr1/oracle/oradata/web

Now run these sql querries as system manager.

CREATE TABLESPACE "MCP_TAB" BLOCKSIZE 8192 DATAFILE '/usr2/oracle/oradata/web/mcp_tab.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 80M MAXSIZE 1000M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING SEGMENT SPACE MANAGEMENT AUTO


CREATE TABLESPACE "MCP_TAB_SPC" BLOCKSIZE 8192 DATAFILE '/usr2/oracle/oradata/web/mcp_tab_spc.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 80M MAXSIZE 1000M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING SEGMENT SPACE MANAGEMENT AUTO

...... etc

Please user Seperate tablespaces for tables and indexes with different      datafiles.

Step 13 : Automatic starup and shutdown for Oracle

Login as root
  1. cd /etc/rc.d/init.d
create a new file here  named oracle containing following script.
  1. vi oracle
#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance
ORA_HOME="/usr1/oracle/product/9.0.1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_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 "$ORA_HOME/bin/lsnrctl start"
       su - $ORA_OWNR -c $ORA_HOME/bin/dbstart
       touch /var/lock/subsys/oracle
       echo "OK"
       ;;
   stop)
       # Oracle listener and instance shutdown
       echo -n "Shutdown Oracle: "
       su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
       su - $ORA_OWNR -c $ORA_HOME/bin/dbshut
       rm -f /var/lock/subsys/oracle
       echo "OK"
       ;;
   reload|restart)
       $0 stop
       $0 start
       ;;
   *)
       echo "Usage: $0 start|stop|restart|reload"
       exit 1
esac
exit 0

You can simply copy and paste this file into your system and change it according to your settings and change it's ownership and the attributes to be the same as the other files in the directory.

The fifth line of this code reads:

  1. chkconfig: 345 91 19

It is used by the chkconfig command when setting the scripts in the run-levels. The value 345 lists the run-levels in which we allow Oracle to run, so if you want to be able to run an Oracle instances only in levels 3 and 5, then change this value to 35. The next value (91) describes the order number in the startup sequence. This means that if there are 100 startup processes, the Oracle startup will be the 91st to run. The next number is the shutdown number, meaning that when the system is shutdown and there are for example 100 processes to be shutdown, the Oracle process will be 19 in order. These numbers are used to set the relative position of the Oracle startup and shutdown processes. They are set here as an example. You can change them, but keep in mind that Oracle instancse can not be run without some processes in the system running beforehand.

Now execute the following command:

  1. chkconfig -add oracle
 This will add the corresponding links in the run-level directories as listed in the beginning of the script. 

To test the newly created automation, you have to reboot your system, but remember that before this automation runs, the kernel parameters should be set. In fact you may include the kernel tune commands in your start) section of the above script.

Also open $ORACLE_HOME/sqlplus/admin/glogin.sql Add the followings if you need

      Alter session set nls_date_format=’DD/MM/YYYY’;
      Alter session set sort_area_size=300000000;
      Alter session set sort_area_retained_size=100000000;
It will work at each login.
  

Let me know your status. Send details to: dhanooj_kp@yahoo.co.in or dhanooj_kp@hotmail.com