Jump to content

Installing Oracle Database 10g on RHEL 5

From TetraWiki
Revision as of 08:25, 28 November 2012 by Admin (talk | contribs)

Template:Testing

Installing Oracle Database 10g on RHEL 5
Shashank Shekhar Tewari
Tetra Information Services

Please check http://www.puschitz.com/ first if you run into any errors or doubts. Although the installation on that page applies to RHEL 4, most of it is relevant for RHEL 5 as well.

The following procedure is a step-by-step guide with tips and information for installing Oracle Database 10g on Red Hat Linux. This guide shows how I

installed:- Oracle 10g (10.2.0.3) on Red Hat Enterprise Linux 5This article covers the following subjects and steps:* Downloading Oracle10g Software * Checking Memory and Swap Space* Checking /tmp Space* Checking Software Packages (RPMs) * Checking the kernel RPM* Checking glibc RPMs* Checking gcc, make, and binutils RPMs* Checking the openmotif RPM* Checking the setarch RPM* Checking the redhat-release RPM* Checking Kernel Parameters* Sizing Disk Space for Oracle10g* Creating Oracle User Accounts* Setting Shell Limits for the Oracle User* Creating Oracle Directories* Setting Oracle Environments* Installing Oracle10g on a Remote Linux Server* Starting Oracle Universal Installer* Using Oracle Universal Installer* Updates after Running Oracle Universal Installer* Oracle Post-installation Tasks* Startup and Shutdown of the Oracle10g Database* Shutdown of other Oracle 10g Background Processes

Downloading Oracle10g Software and Burning Oracle10g CDsDownload Oracle10g for Linux from OTN:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.htmlgunzip ship.db.lnx32.cpio.gzUnpack ship.db.lnx32.cpio:$ cpio -idmv < ship.db.lnx32.cpioDisk1/stage/Components/oracle.server/10.2.0.3.0/1Disk1/stage/Components/oracle.server/10.2.0.3.0Disk1/stage/Components/oracle.serverDisk1/stage/Components/oracle.tg/10.2.0.3.0/1/DataFilesDisk1/stage/Components/oracle.tg/10.2.0.3.0/1Disk1/stage/Components/oracle.tg/10.2.0.3.0Disk1/stage/Components/oracle.tgDisk1/stage/Components/oracle.assistants.dbca/10.2.0.3.0/1/DataFiles/doc.3.1.jarDisk1/stage/Components/oracle.assistants.dbca/10.2.0.3.0/1/DataFiles/class.jar...Installation can continue from the installed path itselfChecking Memory and Swap SpaceOracle says that the system must have at least 512MB of RAM and 1GB of swap space or twice the size of RAM. And for systems with more than 2 GB of RAM, the swap space can be between one and two times the size of RAM. You might also want to check out Sizing Swap Space.To check the size of physical memory, execute:grep MemTotal /proc/meminfoTo check the size of swap space, execute:grep SwapTotal /proc/meminfo

Checking /tmp SpaceAccording to Oracle's documentation, the Oracle Universal Installer (OUI) requires up to 400 MB of free space in the /tmp directory. But OUI checks if /tmp is only greater than 80 MB.To check the space in /tmp, run:$ df /tmpChecking Software Packages (RPMs)Before you install a Oracle Database 10g, you need to check the system for required RPMs. Checking the kernel RPMIt is important that the kernel version for RHELAS2.1 is 2.4.9-e.25 or higher. To check the kernel version run:uname -rFor more information on upgrading the kernel, see Upgrading the Linux Kernel.Installing RPMs# yum install glibc* gcc* binutils* make* openmotif*


If any other dependency is needed, please check the package via 'yum provides <package name>' or by googling the dependency.

Checking Kernel ParametersTo see all kernel parameters, execute:su - rootsysctl -aFor Oracle10g, the following kernel parameters have to be set to values greater than or equal to the recommended values which can be changed in the proc filesystem:shmmax = 2147483648 (To verify, execute: cat /proc/sys/kernel/shmmax)shmmni = 4096 (To verify, execute: cat /proc/sys/kernel/shmmni)shmall = 2097152 (To verify, execute: cat /proc/sys/kernel/shmall)shmmin = 1 (To verify, execute: ipcs -lm |grep "min seg size")shmseg = 10 (It's hardcoded in the kernel - the default is much higher)semmsl = 250 (To verify, execute: cat /proc/sys/kernel/sem | awk '{print $1}')semmns = 32000 (To verify, execute: cat /proc/sys/kernel/sem | awk '{print $2}')semopm = 100 (To verify, execute: cat /proc/sys/kernel/sem | awk '{print $3}')semmni = 128 (To verify, execute: cat /proc/sys/kernel/sem | awk '{print $4}')


rmem_default = 1048576 (To verify, execute: cat /proc/sys/core/rmem_default)

rmem_max = 1048576 (To verify, execute: cat /proc/sys/net/core/rmem_max)

wmem_default = 262144 (To verify, execute: cat /proc/sys/net/core/wmem_default )

wmem_max = 262144 (To verify, execute: cat /proc/sys/net/core/wmem_max) file-max = 65536 (To verify, execute: cat /proc/sys/fs/file-max)ip_local_port_range = 1024 65000 (To verify, execute: cat /proc/sys/net/ipv4/ip_local_port_range)NOTE: Do not change the value of any kernel parameter on a system where it is already higher than listed as minimum requirement.Oracle recommends to set the local port range ip_local_port_range for outgoing messages to "1024 65000" which is needed for high-usage systems. This kernel parameter defines the local port range for TCP and UDP traffic to choose from.I added the following lines to the /etc/sysctl.conf file which is used during the boot process:kernel.shmmax=2147483648kernel.sem=250 32000 100 128fs.file-max=65536net.ipv4.ip_local_port_range=1024 65000

rmem_default = 1048576
rmem_max = 1048576
wmem_default = 262144
wmem_max = 262144 

Adding these lines to the /etc/sysctl.conf file will cause the system to change these kernel parameters after each boot using the /etc/rc.d/rc.sysinit script which is invoked by /etc/inittab. But in order that these new added lines or settings in /etc/sysctl.conf become effective immediately, execute the following command:su - rootsysctl -pSizing Disk Space for Oracle10gOracle says that about 2.5 GB of disk space should be reserved for the Oracle software on Linux.When I did an Oracle 10g Release 2 (10.2.0.3.0) "General Purpose Database" installation (not including any software from the Oracle Database 10g Companion CD), the Oracle software used about 1.3 GB of disk space, and the preconfigured "General Purpose Database" (datafiles, etc.) used about 710 MB of disk space.$ du -m -s /u011963 /u01$ du -m -s /u01/app/oracle/oradata720 /u01/app/oracle/oradataSo if you install Oracle10g Enterprise Edition and additional software from the Oracle Database 10g Companion CD, then you need about 2.5 GB of disk for the Oracle software. And if you also want to add a preconfigured database on the same filesystem, make sure to add another 1 GB of disk space.NOTE: If you don't put Oracle10g on a separate filesystems, then make sure the root filesystem "/" has enough disk space. You can check the free space of the root filesystem with the following command:df -h /Creating Oracle User AccountsTo create the oracle account and groups, execute the following commands:su - rootgroupadd dba # group of users to be granted SYSDBA system privilegegroupadd oinstall # group owner of Oracle filesuseradd -c "Oracle software owner" -g oinstall -G dba oraclepasswd oracle

Setting Shell Limits for the Oracle UserMost shells like Bash provide control over various resources like the maximum allowable number of open file descriptors or the maximum number of processes available to a user. For more information on ulimit for the Bash shell, see man bash and search for ulimit.If you just install a small test database, then you might be ok with the current settings (note that the limits very often vary). But for (larger) production databases, you should increase the following shell limits to the following values recommended by Oracle:nofile = 65536 (To verify, execute: ulimit -n)nproc = 16384 (To verify, execute: ulimit -u)The nofile option denotes the maximum number of open file descriptors, and nproc denotes the maximum number of processes available to a single user.To see all shell limits, execute:ulimit -aTo change the "soft" and "hard" limits for the maximum number of processes for the oracle user, add the following lines to the /etc/security/limits.conf file:

oracle           soft    nproc          2047
oracle           hard    nproc          16384


To make this change permanent, you could add "ulimit -u 16384". To do this you could simply copy/paste the following commands for oracle's bash shell:


su - oracle
cat >> ~oracle/.bash_profile << EOF
ulimit -u 16384
EOF


To make the above changes permanent, you could also set the soft limit equal to the hard limit in /etc/security/limits.conf which I prefer:

oracle           soft    nproc          16384
oracle           hard    nproc          16384


Creating Oracle DirectoriesFor Oracle10g you only need to create the directory for $ORACLE_BASE:su - rootmkdir -p /u01/app/oraclechown -R oracle.oinstall /u01The OFA standard is a guideline created by Oracle to ensure reliable Oracle installations. For Oracle 10g Database, the OFA recommended Oracle home path has changed.The home path for the first 10g (10.2.0) database installation on a system would be:/u01/app/oracle/product/10.2.0/Db_1If you would install a second Oracle 10g Database 10g (10.2.0) on the same system, the Oracle home directory would be as follows:/u01/app/oracle/product/10.2.0/Db_2If the Oracle10g software is not owned by the user oracle but by the user "oraowner", then the path of the Oracle home directory would be:/u01/app/oraowner/product/10.2.0/Db_1/u01/app/oraowner/product/10.2.0/Db_2The standard directory name for Oracle10g is "app":/u01/app/oracle/product/10.2.0/Db_1Setting Oracle EnvironmentsSince the Oracle Universal Installer (OUI) "runInstaller" is run from the oracle account, some environment variables must be configured for this account before OUI is started.Execute the following commands for the Bash shell which is the default shell on Red Hat Linux (to verify your shell run: echo $SHELL):su - oracleexport ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orclNOTE: If ORACLE_BASE is used, then Oracle recommends that you don't set the ORACLE_HOME environment variable but that you choose the default path suggested by the OUI. You can set and use ORACLE_HOME after you finished running OUI.Also, the environment variables ORACLE_HOME and TNS_ADMIN should not be set. If you've already set these environment variables, you can unset them by running the following commands:unset ORACLE_HOMEunset TNS_ADMINTo have these environment variables set automatically each time you login as oracle, you can add these environment variables to the ~oracle/.bash_profile file which is the user startup file for the Bash shell on Red Hat Linux. To do this you could simply copy/paste the following commands to make these settings permanent for your oracle's Bash shell:su - oraclecat >> ~oracle/.bash_profile << EOFexport ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orclEOFInstalling Oracle10gInstalling Oracle10g on a Remote Linux ServerIf you don't install Oracle on your local system but on a remote server, then you need to relink X to your local desktop. The easiest way to do this is to use the "X11 forwarding" feature of ssh. This means that you don't have to run xhost and set the DISPLAY environment variable.Here is an example how to make use of the "X11 forward" feature of ssh. Simply run the following command from your local desktop:$ ssh -X oracle@oracle_remote_server_nameNow when you try to run any GUI tool on the remote server, it will automatically be relinked to your local desktop. If this is not working, verify that the ForwardX11 setting is not set to "no" in /etc/ssh/ssh_config on the remote server:su - root# grep ForwardX11 /etc/ssh/ssh_config | grep -v "^#"

Starting Oracle Universal InstallerChange to the directory that contains the image directory Disk1.Before you execute runInstaller, make sure the Oracle environment variables are set, see Setting Oracle Environments. You can verify the settings by running the set command:su - oracleoracle$ setTo execute runInstaller from the mounted CD, run the following command as the oracle user:oracle$ /mnt/cdrom/runInstallerUsing Oracle Universal Installer (OUI)The following example shows how to install Oracle10g Database Software and a "General Purpose" database:- Welcome Screen:- Basic Installation: Checked it which is the default- Oracle Home Location: Use default: /u01/app/oracle/product/10.2.0/Db_1- Installation Type: I used the default: Enterprise Edition- UNIX DBA Group: Use default: dba- Create Starter Databases: I checked it for this example which is the default- Global Database Name: orcl- Database password: Type in the password for SYS, SYSTEM, SYSMAN, and DBSNMP accounts- Advanced Installation: For this example I did not check itClick Next- Specify Inventory directory and credentials:- Full path of the inventory directory: Use default: /u01/app/oracle/oraInventory- Specify Operating System group name: Use default: oinstallClick Next- A window pops up to run the orainstRoot.sh script:Run the script in another terminal:su - root# /u01/app/oracle/oraInventory/orainstRoot.shCreating the Oracle inventory pointer file (/etc/oraInst.loc)Changing groupname of /u01/app/oracle/oraInventory to oinstall.#Click Continue- Product-specific Prerequisite Checks:IMP: Verify that all checks have been passed.Make sure that the status of each Check is set to "Succeeded".Note that the "Retry" button doesn't work after you fixed one of the failed checks.Click Next- Select Database Configuration:I selected "General Purpose".Click Next- Specify Database Configuration Options:- Global Database Name: I used "orcl".- SID: I used "orcl".Click Next

NOTE: If you get an error that says “TNS: could not resolve the connect identifier specified”, check your hostname.

- Select Database Management Option:I selected "Use Database Control for Database Management".Click Next- Specify Database File Storage Option:I selected "File System".- File System- Specify Database file location: /u01/app/oracle/oradata/Click Next- Specify Backup and Recovery Options:For my test installation I selected "Do no enable Automated Backups".Click Next- Specify Database Schema Passwords:Make sure that the password(s) don't start with a digit number! Otherwise youwill later get error message(s) like "ORA-00988 missing or invalid password".Click Next- Summary: Click InstallWhen a window pops up to run the root.sh script, execute the scriptin another terminal as root:su - root# /u01/app/oracle/product/10.2.0/Db_1/root.shRunning Oracle10 root.sh script...\nThe following environment variables are set as:ORACLE_OWNER= oracleORACLE_HOME= /u01/app/oracle/product/10.2.0/Db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:Copying dbhome to /usr/local/bin ...Copying oraenv to /usr/local/bin ...Copying coraenv to /usr/local/bin ...\nCreating /etc/oratab file...Adding entry to /etc/oratab file...Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed./var/opt/oracle does not exist. Creating it now./etc/oracle does not exist. Creating it now.Successfully accumulated necessary OCR keys.Creating OCR keys for user 'root', privgrp 'root'..Operation successful.Oracle Cluster Registry for cluster has been initializedAdding to inittabChecking the status of Oracle init process...Expecting the CRS daemons to be up within 600 seconds.CSS is active on these nodes.marsCSS is active on all nodes.Oracle CSS service is installed and running under init(1M)#Click OK- End of Installation:Click ExitUpdates after Running Oracle Universal InstallerAfter Oracle10g has been installed, make sure that ORACLE_HOME, PATH, and LD_LIBRARY_PATH are set for the oracle account.Note that the path for ORACLE_HOME might be different on your system!Also note that LD_LIBRARY_PATH is needed for some Oracle binaries such as sysresv!For 10g (10.2.0.3) on my system:su - oracle$ cat >> ~oracle/.bash_profile << EOFexport ORACLE_HOME=\$ORACLE_BASE/product/10.2.0/Db_1export PATH=$PATH:\$ORACLE_HOME/bin export LD_LIBRARY_PATH=\$ORACLE_HOME/libEOF. ~oracle/.bash_profileThis commmand will add the environment variables to the ~oracle/.profile and source in the file for the current shell by executing ". ~oracle/.bash_profile".NOTE: Do not add a trailing "/" on the ORACLE_HOME environment variable. Otherwise you will get the error "ORACLE not available" when you try to connect to sys, see Oracle10g/Linux Errors and Problems for more information.Oracle Post-installation TasksBefore you continue, make sure you followed the steps at Updates after Running Oracle Universal Installer.Startup and Shutdown of the Oracle10g DatabaseTo startup the database:oracle$ sqlplus /nologSQL> connect / as sysdbaSQL> startupTo shutdown the database:oracle$ sqlplus /nologSQL> connect / as sysdbaSQL> shutdownThe slash connects you to the schema owned by SYS. In the above example you will be connected to the schema owned by SYS with the privilege SYSDBA. SYSDBA gives you the following privileges:- sysoper privileges WITH ADMIN OPTION- create database- recover database untilShutdown of other Oracle 10g Background ProcessesIf you installed a preconfigured database using OUI, then several Oracle background processes are now running on your server. Execute the following command to see the background processes:ps -efTo shutdown the Oracle background processes after an Oracle Database 10g installation, you can execute the following commands:# iSQL*PlusTo stop iSQL*Plus, run:su - oracleisqlplusctl stop# Database Management ProcessesDuring the installation of Oracle 10g, OUI offered two Database Management Options:If you selected "Database Control for Database Management", then the Oracle Enterprise Manager Database Control (Database Control) can be shutdown with the following command which stops both the agent and the Oracle Containers for Java (OC4J) management service:su - oracleemctl stop dbconsoleIf you selected "Grid Control for Database Management" which is used for full "Grid Control" installations, then the Oracle Management Agent (standalone agent) for the Oracle Enterprise Manager Grid Control (Grid Control) can be stopped with the following command:su - oracleemctl stop agent# Oracle Net ListenerTo stop the listener, run:su - oraclelsnrctl stop# Cluster Synchronization Services (CSS)To shutdown Oracle CSS daemon, run:su - root/etc/rc.d/init.d/init.cssd stop

Tips and Hints for Oracle10g on Linux# To reinstall Oracle10g after a failed installation attempt, you might want to execute the following commands.Make sure you first used the De-installation option in OUI.su - rootexport ORACLE_HOME=/u01/app/oracle/product/10.2.0/Db_1. $ORACLE_HOME/bin/localconfig delete # stops the Oracle CSS daemon and deletes configurationrm -rf /u01/app/oracle/*rm -f /etc/oraInst.loc /etc/oratab /etc/oraclerm -f /etc/inittab.cssdrm -f /usr/local/bin/coraenv /usr/local/bin/dbhome /usr/local/bin/oraenvAlso make sure to unset and uncomment ORACLE_HOME from ~oracle/.bash_profile.