Monday, May 16, 2011

Oracle 10g R2 Installation

<!--[if !supportLists]-->1 <!--[endif]-->Overview

<!--[if !supportLists]-->1.1 <!--[endif]-->Purpose of Document

This document is intended for use by IT personnel to record the run-time server and baseline stack procedure. This document is intended for use by Seygen, Inc. to create a particular setup for use in its business practices.

<!--[if !supportLists]-->1.2 <!--[endif]-->Installation Directions

This document contains installation information for Oracle 10gR2, Oracle Patch, and Oracle BPEL. These components should be installed in the aforementioned order.

<!--[if !supportLists]-->1.3 <!--[endif]-->Prerequisites

This installation assumes that the following documents and resources are available:

<!--[if !supportLists]-->1.3.1 <!--[endif]-->Required Installed Software

The following indicates the relationship between software that should be installed. Where software is needed prior to the installation of a certain component, it will be shown in brackets.
  • CentOS 5.3
  • Oracle10gR2 [requires CentOS 5.3]
  • Oracle 10gR2 Patch [requires installation of 10gR2]
  • Oracle BPEL [requires installation of Oracle 10gR2 and Oracle Patch]

<!--[if !supportLists]-->1.3.2 <!--[endif]-->DVD

The following media contains software needed to complete the installations mentioned in this manual:
  • Oracle 10GR2 CD

<!--[if !supportLists]-->1.3.3 <!--[endif]-->Documentation

This document is needed to complete the installation.
  • Installing Oracle 10gR2
    • Includes:
      • Oracle 10gR2 Installation
      • Oracle 10gR2 Patch
      • Oracle BPEL Installation

<!--[if !supportLists]-->1.3.4 <!--[endif]-->Permissions

Permissions required are oracle and root.

<!--[if !supportLists]-->2 <!--[endif]-->Oracle 10g R2 Pre-Installation and Setup

This installation assumes a clean install on CentOS 5.3. The following CDs are needed during the installation of Oracle and to install the patch:

<!--[if !supportLists]-->2.1 <!--[endif]-->Pre-Installation Steps

<!--[if !supportLists]-->2.1.1 <!--[endif]-->Hardware Requirements

Name
Required
Comment
RAM
At least 1024 MB RAM
grep MemTotal /proc/meminfo
Swap Space
1 GB or twice RAM (If ram is 2GB or more then min one times RAM
grep SwapTotal /proc/meminfo
Temp Space
400 MB
df -k /tmp
Disk space
1.5 – 3 GB depending on type of installation
df -k
System Architecture
Check what are supported
grep "model name" /proc/cpuinfo

<!--[if !supportLists]-->2.1.2 <!--[endif]-->Create Groups and Add Users to Group

Login as “root” and create the following groups.
<!--[if !supportLists]-->Ø <!--[endif]-->Groups
<!--[if !supportLists]-->§ <!--[endif]-->groupadd dba
<!--[if !supportLists]-->§ <!--[endif]-->groupadd oinstall
<!--[if !supportLists]-->Ø <!--[endif]-->Add Oracle to Group, Change Home
<!--[if !supportLists]-->§ <!--[endif]-->useradd -g oinstall -G dba –d /u01/app/oracle oracle
<!--[if !supportLists]-->Ø <!--[endif]-->Set Password for oracle (set password to oracle)
<!--[if !supportLists]-->§ <!--[endif]-->passwd oracle

<!--[if !supportLists]-->2.1.3 <!--[endif]-->Create Oracle Directories

Login as “root” and create the following directories:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle:oinstall /u01

<!--[if !supportLists]-->2.1.4 <!--[endif]-->Edit Sysctl.conf File

The following should be performed while logged in as the root user. This section assumes a basic knowledge of the use of “vi”, a basic text editor in Unix. Commands are given, where appropriate.
  1. Open a terminal and type the following command to edit the sysctl.conf file in vi:
vi /etc/sysctl.conf
  1. Check the following parameters. If it does exist and is higher than the value shown, do not change it; otherwise, change it to the value shown below
<!--[if !supportLists]-->· <!--[endif]-->To insert text in vi, press the “I” key
kernel.shmall = 2097152
kernel.shmmax = 2147483648
  1. Add the following values to the end of the file, prior to the series of tildas (~):
#
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 = 262144
#
net.core.rmem_max = 262144
#
net.core.wmem_default = 262144
#
net.core.wmem_max = 262144
  1. Save the changes and exit vi
    • From “Insert” mode, press the ESC key and type :wq
  2. Reboot the system

<!--[if !supportLists]-->2.1.5 <!--[endif]-->Edit limits.conf File

The following should be performed while logged in as the root user. This section assumes the previous section was completed and does not repeat the commands needed to edit and save the file.
  1. Open a terminal
  2. Open the file located at /etc/security/limits.conf
  3. Add the following lines to the end of file, prior to the line reading “#End of File”:
#* soft nproc 2047
#* hard nproc 16384
#* soft nofile 1024
#* hard nofile 65536
  1. Save the changes and exit the vi editor

<!--[if !supportLists]-->2.1.6 <!--[endif]-->Set up Oracle User Profile

The following should be performed as the user oracle
  1. Open a terminal
  2. Navigate to user oracle’s home directory
cd ~
  1. Open ~/.bash_profile file and add the following lines at the end of the file, prior to the series of tildas (~):
# Oracle Settings
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=gateway
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME /lib32
PATH=/usr/sbin:$PATH
PATH=$ORACLE_HOME/bin:$PATH
TMP=/tmp
TMPDIR=$TMP
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH TMP TMPDIR
  1. Save .bash_profile and exit vi
  2. Execute the file with the following command:
. .bash_profile
  1. Check if the above settings have been applied using echo command:
echo $ORACLE_BASE
If successful, the path /u01/app/oracle should be shown.

<!--[if !supportLists]-->2.1.7 <!--[endif]-->Download and Install the Required RPM Packages

Log in as “root” to perform the package installations. Checking for package availability does not require “root” login.
  1. Open a terminal
  2. Run the following command for each of the packages listed. Note which are not found, as they will have to be installed from the System Supplemental CD.
Don’t use the .386 extensions of the package names in the rpm command below
rpm –qa | grep
Required Packages
  • binutils-2.17.50.0.6-9.el5.i386.rpm
  • compat-db-4.2.52-5.1.i386.rpm
  • compat-gcc-7.3-2.96.128.i386.rpm
  • compat-libstdc++-33-3.2.3-61.i386.rpm
  • compat-libstdc++-296-2.96-138.i386.rpm
  • cpp-4.1.2-44.el5.i386.rpm
  • elfutils-0.125-3.el5.i386.rpm
  • elfutils-libs-0.125-3.el5.i386.rpm
  • gcc-4.1.2-44.el5.i386.rpm
  • gcc-c++-4.1.2-44.el5.i386.rpm
  • glibc-2.5-34.i386.rpm
  • glibc-common-2.5-34.i386.rpm
  • glibc-devel-2.5-34.i386.rpm
  • glibc-headers-2.5-34.i386.rpm
  • glibc-kernheaders-2.4-9.1.103.EL.i386.rpm
  • libaio-0.3.106-3.2.i386.rpm
  • libaio-devel-0.3.106-3.2.i386.rpm
  • libaio-devel-0.3.106-3.2.i386.rpm
  • libstdc++-4.1.2-44.el5.i386.rpm
  • libstdc++-devel-4.1.2-44.el5.i386.rpm
  • libXmu-1.0.2-5.i386.rpm
  • libXp-1.0.0-8.1.el5.i386.rpm
  • libXtst-1.0.1-3.1.i386.rpm
  • pam-0.99.6.2-4.el5.i386.rpm
  • rpm-build-4.4.2-48.el5.i386.rpm
  • setarch-2.0-1.1.i386.rpm
  • sysstat-7.0.2-3.el5.i386.rpm
  1. Determine the packages that were not found during the previous step
  2. Insert the System Supplemental CD
cd “/media/200907241353/Required RPMs /”
  1. Install the packages (located on the System Supplemental CD) as root user using the following command:
rpm –Uvh


<!--[if !supportLists]-->3 <!--[endif]-->Install and Configure Oracle 10g R2

Oracle installation should be performed as the oracle user

<!--[if !supportLists]-->3.1 <!--[endif]-->Copy the Downloaded Oracle Software

This step requires the Oracle 10gR2 CD containing the Oracle 10gR2 software.
  1. Open a terminal
  2. Navigate to the oracle home directory and create the directory “/oracle_software” using the following commands:
cd $ORACLE_BASE
mkdir oracle_software
  1. Copy all files on the Oracle 10gR2 CD to the oracle home directory using the following command:
Remove *.* below:
cp –R “/media/Oracle 10gR2/*.*” $ORACLE_BASE/oracle_software
  1. Execute the following command to give the oracle user the ability to install the Oracle software:
chmod –R 755 $ORACLE_BASE/oracle_software/

<!--[if !supportLists]-->3.2 <!--[endif]-->Start Oracle installation Process

Use the following commands to start Oracle installation as oracle user
Enter Use the following commands to start Oracle installation
  1. Navigate to the oracle_software directory and run the installer:
cd $ORACLE_BASE/oracle_software
./runInstaller
  1. Check the values shown in Figure 1 - Select Installation Method Screen to ensure they are correct.
  2. De-select the check box next to Create Starter Database
  3. Click the Next button
<!--[if !vml]--><!--[endif]-->
Figure 1 - Select Installation Method Screen
  1. Accept the default settings for Inventory Directory and Group name by clicking the Next button.
<!--[if !vml]--><!--[endif]-->
Figure 2 - Inventory Directory and Credentials Screen
The system will check Product-Specific Prerequisite Checks and display a screen with the results.
Verify that all prerequisites passed the check. Below are some of the common pre-requisite failures and their solutions:
  • Operating system failed
    • Explanation: CentOS 5.3 is new to the accepted list of operating systems that are compatible with Oracle 10gR2. Though the installation indicates this OS failed the pre-requisite check, it is safe to proceed as the installer itself is incorrect in this case.
    • Resolution: No further action is necessary to resolve this issue.
  • Swap space requirement failed
    • Explanation: The amount of swap space is related to the RAM on the machine. Although the swap space should have been correctly determined by the system during CentOS 5.3, in some cases, this does not happen. Below is a chart showing the relationship between RAM and swap space.
    • Resolution: Cancel the installation of Oracle 10gR2. Increase the swap space to recommended levels.
RAM
Swap Space
Between 1024 MB and 2048 MB
1.5 times the size of RAM
Between 2049 MB and 8192 MB
Equal to the size of RAM
More than 8192 MB
0.75 times the size of RAM
5. Click the Next button when all prerequisites are successful or acceptable.
<!--[if !vml]--><!--[endif]-->
Figure 3 - Prerequisite Check Summary Screen
A screen with a summary of the changes that will be made during Oracle installation is shown. Check these settings and verify they are correct. If the settings are not correct, click Cancel or Back, resolve the issue, and restart the installation.
  1. If the Installer Summary is correct, press the Install button to install Oracle.
<!--[if !vml]--><!--[endif]-->
Figure 4 - Installer Summary Screen

<!--[if !supportLists]-->3.2.1 <!--[endif]-->Begin Oracle Installation

Oracle will begin installation. This will take some time and any issues that need resolved during the installation process will be shown. Resolve the issues using the on-screen prompts, as they arise.
<!--[if !vml]--><!--[endif]-->
Figure 5 - Oracle Installation Screen
The error shown below was encountered due to a conflict while creating the package. Click the Continue button to proceed, as this is not a critical issue.
<!--[if !vml]--><!--[endif]-->
Figure 6 - Error Screen During Installation
A progress screen will be shown indicating the progress of copying database files, creating and starting the instance of Oracle, and completing the database creation.
<!--[if !vml]--><!--[endif]-->
Figure 7 - Database Progress Screen
Upon completion of the Oracle installation, the Database Configuration Assistant is shown. Click OK to finish the installation process.
<!--[if !vml]--><!--[endif]-->
Figure 8 - Figure 13 - Database Configuration Assistant

<!--[if !supportLists]-->3.3 <!--[endif]-->Execute Configuration Scripts

The next screen requires the root ” user to be logged in to execute scripts. Follow the on-screen instructions to execute the scripts.
<!--[if !vml]--><!--[endif]-->
Figure 9 - Execute Configuration Scripts
  1. Open a terminal as root user
  2. Run the following scripts:
<!--[if !supportLists]-->· <!--[endif]-->. $ORACLE_BASE/oraInventory/orainstRoot.sh
<!--[if !supportLists]-->· <!--[endif]-->. $ORACLE_HOME/root.sh
  1. Press the [Enter] when prompted for a local bin directory to accept the system default.
  2. Return to the Execute Configuration Scripts screen
  3. Click the OK button to continue
  4. Click Exit a screen is shown indicating the Oracle installation was a success.

<!--[if !supportLists]-->3.4 <!--[endif]-->Post-Installation Tasks

These steps should be performed after Oracle is installed.

<!--[if !supportLists]-->3.4.1 <!--[endif]-->Update oratab file – Only if default database installed

Log in as root to perform this task. This step should only be done if the default database was installed.
  1. Open a terminal as root user
  2. Open the file /etc/oratab for editing
  3. Change the line at the bottom of the file by changing the “N” to “Y” (see Figure 10 - Oratab File Screen)
<!--[if !vml]--><!--[endif]-->
Figure 10 - Oratab File Screen
  1. Save the changes and exit to the terminal

<!--[if !supportLists]-->3.4.2 <!--[endif]-->Create init script for Startup/ Shutdown of Database

Login as “root” to perform the following:
  1. Create a new file in /etc/init.d using the following command:
vi /etc/init.d/oracle
2. Add the following to the file:
#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_1"
case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
3. Save the changes and exit.

<!--[if !supportLists]-->3.4.3 <!--[endif]-->Start Listener

Log in as oracle to start the listener.
Error below :add bin directory
  1. Open a terminal
  2. Type the following command to start the listener:
$ORACLE_HOME/bin/lsnrctl start
3. Confirm that the listener was started (a confirmation message will be shown on the screen)

<!--[if !supportLists]-->3.5 <!--[endif]-->Creating a New Database

This explains how to create a new database named gateway with SID as gateway

<!--[if !supportLists]-->3.5.1 <!--[endif]-->Create a pfile for gateway

This should be performed oracle user
  1. Open a terminal
  2. Create /u01/app/oracle/product/10.2.0/db_1/dbs/initgateway.ora file using the following command:
vi /u01/app/oracle/product/10.2.0/db_1/dbs/initgateway.ora
  1. Insert the following content into the file:
gateway.__db_cache_size=671088640
gateway.__java_pool_size=4194304
gateway.__large_pool_size=4194304
gateway.__shared_pool_size=239075328
gateway.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/gateway/adump'
*.background_dump_dest='/u01/app/oracle/admin/gateway/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u03/oradata/gateway/control01.ctl','/u08/oradata/gateway/control02.ctl'
*.core_dump_dest='/u01/app/oracle/admin/gateway/cdump'
*.db_block_size=8192
#*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='gateway'
#*.db_recovery_file_dest='/u09/oradata/gateway/flash_recovery_area'
#*.db_recovery_file_dest_size=2147483648
#*.dispatchers='(PROTOCOL=TCP) (SERVICE=gatewayXDB)'
*.job_queue_processes=10
#*.open_cursors=300
*.pga_aggregate_target=308281344
*.processes=150
#*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=924844032
*.undo_management='AUTO'
*.undo_tablespace='UNDO_1'
*.user_dump_dest='/u01/app/oracle/admin/gateway/udump'
  1. Save the changes and exit to the terminal.

<!--[if !supportLists]-->3.5.2 <!--[endif]-->Create Script for Creating Database

Create a script to be used for automatically creating a database.
  1. Open a terminal
  2. Create createdb.sql file using the following command:
vi ~/createdb.sql
  1. Insert the following content into the file:
CREATE DATABASE gateway
DATAFILE
'/u02/oradata/gateway/system_01.dbf' size 600M
SYSAUX DATAFILE
'/u02/oradata/gateway/sysaux_01.dbf' size 600M
UNDO TABLESPACE undo_1 DATAFILE
'/u04/oradata/gateway/undo_01.dbf' size 1000M
LOGFILE
'/u05/oradata/gateway/redo_01.dbf' size 20M,
'/u04/oradata/gateway/redo_02.dbf' size 20M,
'/u07/oradata/gateway/redo_03.dbf' size 20M
CHARACTER SET "WE8ISO8859P1"
NATIONAL CHARACTER SET "UTF8"
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE
'/u07/oradata/gateway/temp_01.dbf' SIZE 1000M
MAXDATAFILES 1000
MAXLOGFILES 10;
4. Save the changes and exit.

<!--[if !supportLists]-->3.5.3 <!--[endif]-->Create Database Folders

The following requires switching between root and oracle users.
As Root User
  1. Open a terminal
  2. Modify permissions to allow the oracle user to modify folders:
chown –R oracle:dba /u01
chown –R oracle:dba /u02
chown –R oracle:dba /u03
chown –R oracle:dba /u04
chown –R oracle:dba /u05
chown –R oracle:dba /u06
chown –R oracle:dba /u07
chown –R oracle:dba /u08
chown –R oracle:dba /u09
As Oracle User
  1. Create new folders for the database using the following commands:
mkdir –p /u01/oradata/gateway/
mkdir –p /u02/oradata/gateway/
mkdir –p /u03/oradata/gateway/
mkdir –p /u04/oradata/gateway/
mkdir –p /u05/oradata/gateway/
mkdir –p /u06/oradata/gateway/
mkdir –p /u07/oradata/gateway/
mkdir –p /u08/oradata/gateway/
mkdir –p /u09/oradata/gateway/
mkdir –p /u09/oradata/gateway/flash_recovery_area
  1. Create new directories using the following commands:
mkdir –p /u01/app/oracle/admin/gateway/adump
mkdir –p /u01/app/oracle/admin/gateway/bdump
mkdir –p /u01/app/oracle/admin/gateway/cdump
mkdir –p /u01/app/oracle/admin/gateway/udump

<!--[if !supportLists]-->3.5.4 <!--[endif]-->Create Database

Log in as oracle user to perform the following commands.
  1. Open a terminal
  2. Use the following to determine if you can switch to sysdba role in the terminal:
echo $ORACLE_SID
    1. If echo doesn’t show “gateway” as a result, run the following command
export oracle_sid=gateway
    1. If “gateway” is shown after running the echo command, run the following:
$ORACLE_HOME/bin//sqlplus ‘/ as sysdba’;
This should result in the message “Connected to an idle instance” and the terminal prompt should be shown as SQL>
Typo below
  1. Run the following command to start up the database:
startup nomount pfile=’/u01/app/oracle/product/10.2.0/db_1/dbs/initgateway.ora’;
A confirmation stating ORACLE instance started will be displayed.
  1. Run the following command at the SQL> prompt to create database. This may take a few minutes.
@/u01/app/oracle/createdb.sql;
A confirmation message, “Database created” will be shown upon completion.
  1. Run the following command at the SQL> prompt to validate the database catalog. This may take a few minutes.
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql;
A confirmation message, “PL/SQL procedure successfully completed” is shown upon completion.
  1. Run the following command at the SQL> prompt to catalog the database. This may take a few minutes.
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql;
A confirmation message, “PL/SQL procedure successfully completed” is shown upon completion.
  1. Exit the SQL terminal prompt by executing the following command:
EXIT

<!--[if !supportLists]-->3.5.5 <!--[endif]-->Edit the Oratab File

Log in as root to perform the following editions to the oratab file.
  1. Open a terminal
  2. Edit the oratab file for SID gateway using the following:
vi /etc/oratab
  1. Add the following line to the end of the document:
gateway: /u01/app/oracle/product/10.2.0/db_1:Y

<!--[if !supportLists]-->3.5.6 <!--[endif]-->Create Tablespace and User

Log in as oracle to create the tablespace
  1. Open a terminal
  2. Switch to the sysdba role using the following command:
sqlplus ‘/ as sysdba’;
  1. Run the following to create the tablespace:
create tablespace gatewayts1 datafile ‘/u09/oradata/gateway/gate_ts1.dbf’ size 3000M extent management local uniform size 64K;
A confirmation message, “Tablespace” is shown on completion.
  1. Run the following to create the default user:
create user td_user identified by td_user default tablespace gatewayts1;
A confirmation message, “User created” is shown on completion.
  1. Run the following to grant privileges to default user:
grant connect, resource, create table to td_user;
A confirmation message, “Grant succeeded” is shown on completion.

<!--[if !supportLists]-->3.5.7 <!--[endif]-->Confirm Database and User Creation

[This section is corrected.]
This tests whether or not the installation was successful.
  1. Open a terminal
  1. Log in to the database using the following command:
sqlplus td_user
  1. When prompted, enter ‘td_user’ as the password
A confirmation message is shown indicating that connection to Oracle is established. This confirms the user was created correctly!
exit
  1. Switch to the sysdba role using the following command:
sqlplus ‘/ as sysdba’;
  1. When prompted, enter ‘td_user’ as the password
Desc v$tablespace;
Desc dba_users;
Select username, default_tablespace from dba_users ;
Verify td_user is shown and is going to gatewayts1
If connected to oracle database, success!