Chinaunix首页 | 论坛 | 博客
  • 博客访问: 262402
  • 博文数量: 44
  • 博客积分: 1431
  • 博客等级: 上尉
  • 技术积分: 558
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 12:53
文章分类
文章存档

2012年(1)

2011年(28)

2010年(15)

分类: Oracle

2010-12-24 13:39:47

Install Oracle 11g Release 1 on RHEL 5

Posted by  on July 14, 2010.

In this article we will go through step by step installation of Oracle 11g Release 1 on RHEL 5 (Red Hat Enterprise Linux 5). It can be referred as a quick installation guide for Oracle 11g R1 on RHEL5.

Checking the Hardware Requirements

We need to make sure tha the hardware we have is compatible with Oracle 11g R1.

-- Check Physical Memory.

# grep MemTotal /proc/meminfo

MemTotal:      2059516 kB

/*

 At least 1GB of physical Memory (RAM) is required.

 In my case I have 2GB.

*/

 

-- Check Swap Space.

# grep SwapTotal /proc/meminfo

SwapTotal:     3148732 kB

 

/*

 RAM between 1GB and 2GB then Swap = 1.5 times the size of RAM

 RAM between 2GB and 16GB then Swap = equal to the size of RAM

 RAM more than 16GB then Swap Size = 0.75 times the size of RAM

 Since my RAM is 2GB, so I have 3GB of Swap Size.

*/

 

# df -h /dev/shm

Filesystem            Size  Used Avail Use% Mounted on

tmpfs                1006M     0 1006M   0% /dev/shm

 

/*

 OS shared memory should be at least equal to what your memory

 management targets (automatic memory management) are going to

 be later on. For example if you have plans to use memory management

 targets lower then 1000M so 1006 M of shared memory file system

 is sufficient for you.

 But if you would like to have a bigger shared memory (/dev/shm)

 size then do the following:

*/

 

# mount -t tmpfs tmpfs -o size=1500m /dev/shm

# df -h /dev/shm

Filesystem            Size  Used Avail Use% Mounted on

tmpfs                 1.5G     0  1.5G   0% /dev/shm

 

-- Check space available in /tmp

# df -h /tmp

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3             8.7G  3.7G  4.5G  45% /

 

/*

  You need to have at least 150M to 200M of space in the /tmp directory.

  Make sure you have more then 200M in the column "Avail" in the above output.

*/

 

-- Disk space requirements for oracle software and pre-configured database.

-- I have a separate partition "/u01" that I created for Oracle Software

-- and database files

# df -h /u01

Filesystem            Size  Used Avail Use% Mounted on

/dev/sdb1              12G  159M   11G   2% /u01

 

-- I have 11G avaialbale space on the partition /u01.

-- Which is quite sufficient according to the requirements below.

/*

  Space requirement for Oracle 11g Release 1 Software:

     Enterprise Edition      4.35G

     Standard Edition      3.73G

 

  Space requirement for Orale 11g R1 Database Files:

     Enterprise Edition      1.68G

     Standard Edition      1.48G

     (

      creating a database is always optional with oracle installation.

      Can be done later.

     )

*/

Checking the Software Requirements

Check if software requirements for Oracle 11g R1 are met on this machine.

/*

 To install Oracle 11g Release 1 on RHEL 5 you should be running

 a kernel version 2.6.18 or later.

*/

# uname -r

2.6.18-194.el5

Now we need to make sure we have all necessary packages for Oracle. Put your Linux Media into DVD and go to the "Server" directory.

cd /dvd_mount_point/Server

 

For Linux 64-bit:

rpm -Uvih binutils-2*`uname -p`*

rpm -Uvih compat-libstdc++-33*`uname -p`*

rpm -Uvih compat-libstdc++-33*i386*

rpm -Uvih elfutils-libelf-0*`uname -p`*

rpm -Uvih elfutils-libelf-devel-0*`uname -p`*

rpm -Uvih gcc-4*`uname -p`*

rpm -Uvih gcc-c++-4*`uname -p`*

rpm -Uvih glibc-2*`uname -p`*

rpm -Uvih glibc-2*i686*

rpm -Uvih glibc-common-2*`uname -p`*

rpm -Uvih glibc-devel-2*`uname -p`*

rpm -Uvih glibc-devel-2*i386*

rpm -Uvih libaio-0*`uname -p`*

rpm -Uvih libaio-0*i386*

rpm -Uvih libaio-devel-0*`uname -p`*

rpm -Uvih libgcc-4*`uname -p`*

rpm -Uvih libgcc-4*i386*

rpm -Uvih libstdc++-4*`uname -p`*

rpm -Uvih libstdc++-4*i386*

rpm -Uvih libstdc++-devel-4*`uname -p`*

rpm -Uvih make-3*`uname -p`*

rpm -Uvih numactl-devel-0*`uname -p`*

rpm -Uvih sysstat-7*`uname -p`*

rpm -Uvih unixODBC-2*`uname -p`*

rpm -Uvih unixODBC-2*i386*

rpm -Uvih unixODBC-devel-2*`uname -p`*

 

For Linux 32-bit:

rpm -Uvih binutils-2*

rpm -Uvih compat-libstdc++-33*

rpm -Uvih elfutils-libelf-0*

rpm -Uvih elfutils-libelf-devel-0*

rpm -Uvih glibc-2*`uname -p`*

rpm -Uvih glibc-common-2*

rpm -Uvih glibc-devel-2*

rpm -Uvih glibc-headers-2*

rpm -Uvih gcc-4*

rpm -Uvih gcc-c++-4*

rpm -Uvih libaio-0*

rpm -Uvih libaio-devel-0*

rpm -Uvih libgcc-4*

rpm -Uvih libstdc++-4*

rpm -Uvih libstdc++-devel-4*

rpm -Uvih make-3*

rpm -Uvih numactl-devel-0*

rpm -Uvih sysstat-7*

rpm -Uvih unixODBC-2*

rpm -Uvih unixODBC-devel-2*

NOTE: If you are using RHEL5 DVD then you should find them all in the "Server" directory in your DVD. And if you don't find one there you may download it from the Linux vendor's Web site.
If you have your Linux distribution in 3 CDs then these will be scattered on all three CDs in the Server directory on all CDs.

Pre-Installation Steps

Make sure that there is an entry in /etc/hosts file for your machine like this:

[IP-address]  [fully-qualified-machine-name]  [machine-name]

 

/*

 Where "fully-qualified-machine-name" is your

 "machine_name"."domain_name"

*/

Next we need to adjust the Linux Kernel Parameters to support Oracle.
Open /etc/sysctl.conf and add the following lines:

# Oracle settings

fs.file-max = 65536

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65500

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

Note: You may find the parameters mentioned above already present in the /etc/sysctl.conf file. If they have a value lower then mentioned above then make sure you change it, but if they have a larger value then perhaps its safe to leave it as is.

-- Make the kernel parameters changes effective immediately:

# /sbin/sysctl -p

 

-- Verify the parameters are changed or not?

# /sbin/sysctl -a | grep name_of_kernel_parameter -- e.g. shmall

Now setup User that we will use as Oracle owner and the groups that it will need for installing and managing Oracle.

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba

/usr/sbin/groupadd oper

/usr/sbin/useradd -g oinstall -G dba,oper oracle

/usr/bin/passwd oracle

Create directories where the Oracle Software and database will be installed.

mkdir -p /u01/app/oracle/product/11.1.0/db_1

chown -R oracle:oinstall /u01

chmod -R 0775 /u01

 

/*

 The above directory structure is designed to comply with OFA

 (Oracle Flexible Architecture) i.e. a directory structure to

 support multiple oracle software installations.

 

 ORACLE_BASE=/u01/app/oracle

 -- Base directory for all oracle installations.

 

 ORACLE_HOME=ORACLE_BASE/product/11.1.0/db_1 -- 11.1.0 installation 1.

 ORACLE_HOME=ORACLE_BASE/product/11.1.0/db_2 -- 11.1.0 installation 2.

 ORACLE_HOME=ORACLE_BASE/product/10.2.0/db_1 -- 10.2.0 installation 1.

 

 and so on....

*/

Now set the shell limits for the user Oracle.
Open /etc/security/limits.conf and add these lines.

oracle           soft    nproc   2047

oracle           hard    nproc   16384

oracle           soft    nofile  1024

oracle           hard    nofile  65536

Where "nproc" is the maximum number of processes available to the user and "nofiles" is the number of open file descriptors.

Open /etc/pam.d/login and add the following line if it is already not there.

session    required     pam_limits.so

Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled

If you leave SELINUX=enforcing then you may get an error later while starting sqlplus:
sqlplus: error while loading shared libraries:
/usr/lib/oracle/default/client64/lib/libclntsh.so.11.1: cannot restore segment
prot after reloc: Permission denied

Allow the user oracle to use X server, which it will need to run Oracle Universal Installer.

# xhost +SI:localuser:oracle

Now switch to the user oracle.

# su - oracle

 

-- Let's see which shell is being used by the user Oracle.

$ echo $SHELL

/bin/bash

If the returned shell is bash then open ~/.bash_profile and add these lines:

# Oracle settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

# If /tmp doesn't have 200M space free then you can workaround it by

# pointing the variables TMP AND TMPDIR to a location where you have

# sufficient space.

 

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME

ORACLE_SID=ora11g; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

 

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

export CLASSPATH

 

if [ $USER = "oracle" ]; then

   if [ $SHELL = "/bin/ksh" ]; then

     ulimit -p 16384

     ulimit -n 65536

   else

     ulimit -u 16384 -n 65536

   fi

fi

 

umask 022

If using C shell then open ~/.login and add these lines:

# Oracle settings

setenv TMP=/tmp

setenv TMPDIR=$TMP

 

# If /tmp doesn't have 200mb space free then you can workaround it

# by pointing the variables TMP AND TMPDIR to a location where you

# have sufficient space. Oracle will then use this directory for

# temporary files.

 

setenv ORACLE_BASE /u01/app/oracle

setenv ORACLE_HOME $ORACLE_BASE/product/11.1.0/db_1

setenv ORACLE_SID ora11g

setenv ORACLE_TERM xterm

setenv PATH /usr/sbin:$PATH

setenv PATH $ORACLE_HOME/bin:$PATH

 

setenv LD_LIBRARY_PATH $ORACLE_HOME/lib:/lib:/usr/lib

setenv CLASSPATH $ORACLE_HOME/JRE:$ORACLE_HOME/jlib

setenv CLASSPATH $CLASSPATH:$ORACLE_HOME/rdbms/jlib

 

if ( $USER == "oracle" ) then

      limit maxproc 16384

      limit descriptors 65536

endif

 

umask 022

Now run the following command to make these changes effective in the current session of user oracle.

-- for bash shell

$ source ~/.bash_profile

-- for C shell

$ source ~/.login

Install Oracle 11g R1 on RHEL 5

The environment is ready for oracle installation. Its time to prepare the oracle installation media now.
Download or Copy the oracle media to the oracle user home directory i.e. /home/oracle.
Once Download/Copy is done unzip the media as follows:

$ cd /home/oracle

$ ls

linux.x64_11gR1_database_1013_1.zip

$

$ unzip linux.x64_11gR1_database_1013_1.zip

Once the unzip is finished go to the "database" directory unzipped in the previous step and start the Oracle Universal Installer.

$ cd /home/oracle/database/

$ ./runInstaller

The OUI (Oracle Universal Installer) should start and you should see following screens in the order given below:

Select Installation Method

This is the first screen you should see when you run Installer. Select Advanced here as we will create a database too with the oracle software.

·  Select Installation Method

Specify Inventory Directory and Credentials

Provide Inventory directory and OS group or leave the defaults as is.

·  Specify Inventory Directory and Credentials

Select installation type

Select Enterprise Edition and press next.

·  Select installation type

Install Location

Provide ORACLE_BASE directory and ORACLE_HOME directory. If you have setup the environment as describe din this article then Installer should pick these values up as you have configured earlier.

·  Install Location

Product-Specific Prerequisite Checks

Oracle will perform prerequisite checks here and will notify you if any check fails. If you have configured the system as demonstrated in this article all checks should pass.

·  Product-Specific Prerequisite Checks

Select Configuration Option

Select "Create a Database" and press next.

·  Select Configuration Option

Select Database Configuration

Select the type of the database you want to create. I would go with "General Purpose".

·  Select Database Configuration

Specify Database Configuration Options

Provide ORACLE_SID and Global Database Name here. It should pick up the oracle sid value if $ORACLE_SID environment variable is set.

·  Specify Database Configuration Options

Specify Database Config Details

Here you need to choose if you want to use Automatic Memory Management or not. I would go with AMM enabled. Further more you can see there are three more tabs on this screen.
Character Sets - Choose the character set here. For a test database just leave the default.
Security - Enable or Disable Oracle 11g security features. Lease as default.
Sample Schemas - Choose if you want to create sample schemas like SCOTT , HR etc. Go to this tab and check the checkbox which says "Create Sample Schemas".

·  Specify Database Config Details

Select Database Management Options

Choose if you want to use Grid Control or Database Control for database management. You may also enable Email Notifications of Alerts from Database Control.

·  Select Database Management Options

Specify Database Storage Options

Choose if your database will be created in filesystem or ASM.

·  Specify Database Storage Options

Specify Backup and Recovery Options

Select "Do not enable Automated backups" and press next.

·  Specify Backup and Recovery Options

Specify Database Schema Passwords

Choose same password for all accounts and provide this master password.

·  Specify Database Schema Passwords

Privileged Operating System Groups

According to our configurations the OSDBA group is "dba", OSOPER group is "oper" and since we are not using ASM for database storage so we haven't created OSASM group. Just select oracle user's primary group oinstall as OSASM group.

·  Privileged Operating System Groups

Oracle Configuration Manager Registration

You may link your database directly to metalink. I will skip this.

·  Oracle Configuration Manager Registration

Installation Summary

This is a summary of the install.

·  Installation Summary

Installation Progress

Oracle 11g R1 Binaries are now being installed.

·  Installation Progress

Configuration Assistants

Once the oracle software binaries are installed Net Configuration and Database Configuration Assistants will kick off. This screen shows status of these assistants.

·  Configuration Assistants

Database Configuration Assistants

This is Database Configuration Assistant and it will be invoked by the Oracle Installer to create a database. Just watch it to finish successfully.

·  Database Configuration Assistants

Database Configuration Assistants

Once the database is created you should see this screen, which provides a detail of the database created. Just press OK.

·  Database Configuration Assistants

Execute Configuration Scripts

The next step is to execute a couple of scripts from user "root" as suggested by this screen.

·  Execute Configuration Scripts

Open another console and login as root. Execute following once logged in successfully.

# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory to 770.

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete

 

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

 

# /u01/app/oracle/product/11.1.0/db_1/root.sh

Running Oracle 11g root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/11.1.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 ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

End of Installation

When the root scripts are complete come back to the oracle installer and press OK on the "Execute Configuration Scripts" screen. The next screen you should see is the End of Install screen. Press Exit to quit the oracle installer.

·  End of Installation

Lets log in to the database now.

$ sqlplus / as sysdba

 

SQL> select * from v$version;

 

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production

PL/SQL Release 11.1.0.6.0 - Production

CORE    11.1.0.6.0      Production

TNS for Linux: Version 11.1.0.6.0 - Production

NLSRTL Version 11.1.0.6.0 - Production

 

阅读(2290) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~