Você está na página 1de 14

Short Guide to install Oracle 10 on Linux

Martin Zahn, 06.10.2008

Download Files

Overview

This guide is a short description how to install Oracle 10.2.0.x on Linux (32 or 64 Bit). The full Oracle installation guide can be found here: Oracle® Database Installa
Release 2 (10.2) for Linux x86.

In this guide we use the following ORACLE_BASE, ORACLE_HOME and ORACLE_SID.

ORACLE_BASE=/export/home/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0

export ORACLE_SID=GENTIC

Download

Download the following software from the Oracle Download or Metalink Site

10201_database_linux32.zip (Base Software)

10201_companion_linux32.zip (Companion Software)

p6810189_10204_Linux-x86.zip (Patchset)

After downloading check the CKSUM / MD5SUM as described on Oracle's Site.

cksum 10201_database_linux32.zip
md5sum p6810189_10204_Linux-x86.zip

Requirements

Checking Memory and Swap Space

Oracle says that the system must have at least 1GB of physical RAM and 1GB of swap space or twice the size of RAM. And for systems with more than 2 GB of RAM, the swap
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/meminfo


MemTotal: 515700 kB

To check the size of swap space, execute:

grep SwapTotal /proc/meminfo


SwapTotal: 1004052 kB

You also can add temporary swap space to your system by creating a temporary swap file instead of using a raw device. Here is the procedure:
su - root
cd /root
dd if=/dev/zero of=/root/tmpswp bs=1k count=500000
500000+0 records in
500000+0 records out
chmod 600 tmpswp
mkswap tmpswp
Setting up swapspace version 1, size = 511995 kB
swapon tmpswp
grep SwapTotal /proc/meminfo
SwapTotal: 1504044 kB

Checking /tmp Space

The Oracle Universal Installer requires up to 400 MB of free space in the /tmp directory. If you do not have enough space in the /tmp filesystem, you can temporarily create a tmp
filesystem. Here is how you can do this (/u01 is another filesystem)

su - root
mkdir /u01/tmp
chown root:root /u01/tmp
chmod 1777 /u01/tmp
export TEMP=/u01
export TMPDIR=/u01

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

su - root
rmdir /u01/tmp
unset TEMP
unset TMPDIR

Checking Kernel Parameters (Values from Oracle Site for 10.2.0.x)

To see all kernel parameters, execute:

su - root
sysctl -a

Verify that the kernel parameters shown in the following table are set to values greater than or equal to the recommended value shown. Do not change the value of any kernel par
it is already higher than listed as minimum requirement.

Parameter Value File

semmsl 250
/proc/sys/kernel/sem
semmns 32000

semopm 100

semmni 128

shmall 2097152 /proc/sys/kernel/shmall

shmmax Half the size of physical memory (in bytes) /proc/sys/kernel/shmmax


Parameter Value File

shmmni 4096 /proc/sys/kernel/shmmni

file-max 65536 /proc/sys/fs/file-max

Minimum:1024
ip_local_port_range /proc/sys/net/ipv4/ip_local_port_range
Maximum: 65000

rmem_default 1048576 /proc/sys/net/core/rmem_default

rmem_max 1048576 /proc/sys/net/core/rmem_max

wmem_default 262144 /proc/sys/net/core/wmem_default

wmem_max 262144 /proc/sys/net/core/wmem_max

We added the following lines to the /etc/sysctl.conf file which is used during the boot process:

# Kernel Parameters for Oracle 10.2.0


kernel.shmall = 2097152
kernel.shmmax = 2147483648
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 = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.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/init.d/bootmisc script which is invoked by /etc
these new added lines or settings in /etc/sysctl.conf become effective immediately, execute the following command:

Configuring kernel parameters:

su - root
sysctl -p

Creating Oracle User Account

To create the oracle account and group(s), execute the following commands:

su - root
groupadd -g 400 dba
useradd -u 400 -g 400 -d /export/home/oracle -s /bin/bash -c "Oracle Owner" oracle

Members of the dba group can administer Oracle databases, for example starting up and shutting down databases. In this guide, we are creating the oracle user account to have t
responsibility.
Note on the «oinstall» Group

The oinstall group is often needed for those organizations who have separate groups that maintain the software and the database. In this scenario, the group membership prevents
database by personnel who maintain the software, and it prevents the database administrators from making changes to the software and the installations inventory directory.

When using oinstall during the install of the software, one must set their default group to the one that will be maintaining the database before creating the database or permission

Oinstall is not needed when the same people will be maintaining the software and the database. In this situation, it will create more work and add an extra layer of complexity to t
installation.

Recommendation: if you don't need the oinstall group for added security,  just install using the dba group.

Setting Shell Limits for the Oracle User

Most 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 use

To see all shell limits, run:

ulimit -a

Setting Limits for the Oracle User

After you changed and increased /proc/sys/fs/file-max, there is still a per user limit of open file descriptors which is set to 1024 by default:

su - oracle
ulimit -n
1024

To change this, you have to edit the file /etc/security/limits.conf as root and make the following changes or add the following lines, respectively:

# To increase the shell limits for Oracle 10


oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

The «soft limit» in the first line defines the number of file handles or open files that the Oracle user will have after login. If the Oracle user gets error messages about running out
Oracle user can increase the number of file handles like in this example up to 63536 («hard limit») by running the following command:

ulimit -n 63536

Note that we do not recommend to set the «hard limit» for nofile for the oracle user equal to /proc/sys/fs/file-max. If you do that and the user uses up all the file handles, then the
file handles. This could mean that you won't be able to initiate new remote logins any more since the system won't be able to open any PAM modules which are required for perfo
we set the hard limit to 63536 and not to 65536.

You also need to make sure that pam_limits is configured in the file /etc/pam.d/system-auth.

This is the PAM module that will read the /etc/security/limits.conf file. The entry should read like:

session required pam_limits.so


session required pam_unix.so

Now login to the oracle account again since the changes will become effective for

new login sessions only.

su - oracle
ulimit -n
4096

Make Settings Permanent

For the Bourne, Bash, or Korn shell, add the following lines to the $HOME/.bash_profile

if [ $USER = "oracle" ]; then


        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 63536
        else
              ulimit -u 16384 -n 63536
        fi
fi

Setup Environment

Before installing the Oracle software, set the environment in $HOME/admin/.GENTIC,

this file will be sourced each time after login. In the example below, gentic is the

SID of the database which we will create.

cd $HOME
. ./.gentic

ls -l
drwxr-xr-x   4 oracle dba  4.0K Sep 26 14:51 admin
lrwxrwxrwx   1 oracle dba    15 Oct  2 10:18 .gentic -> admin/.gentic

cat .gentic

#!/bin/bash

unset TWO_TASK

export ORACLE_SID=GENTIC
export LISTENER_NAME=$ORACLE_SID
export ORACLE_BASE=/export/home/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_DOC=$ORACLE_HOME/doc
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=/export/home/oracle/admin/sqlnet

export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.al32utf8
export ORA_NLS10=$ORACLE_HOME/nls/data
export TEMP=/tmp
export TMPDIR=/tmp
export EDITOR=vi

ulimit -u 16384 -n 63536

Installing Oracle Base, Companion and Patch

This is only a brief description of the installation, the screenshots are not shown,

however note the following important issues.

Order of the Installation


Install Base Product (10.2.0.1)

Install Companion Disk to avoid NCOMP error

Install Patch (10.2.0.4)

Do not create a Database using Oracle installer, this is an extra step, install software only.

Create the Oracle Inventory in $ORACLE_BASE/product.

Choose «Oracle Database 10g Products 10.2.0.1.0» option when installing companion

Create Oracle Home Directories

Oracle Installer does not create Oracle Base / Oracle Home directories.

mkdir -p /export/home/oracle/product/10.2.0

Start Installer

As Oracle10g is certified only on some Linux editions you may get the following error when you run Oracle's runInstalle
installation will stop:

Checking operating system version: must be redhat-2.1,


UnitedLinux-1.0 or redhat-3
Failed <<<<

Solution: Use the option -ignoreSysPrereqs or edit/create the file /etc/redhat-release.

cd <unpacked directory>
DISPLAY=<my X-Window Host>:0.0
export DISPLAY
./runInstaller

Create Inventory in: /export/home/oracle/product

The location of the Oracle Inventory can always be checked in the file /etc/oraInst.loc

cat /etc/oraInst.loc

inventory_loc=/export/home/oracle/product
inst_group=dba

Oracle Companion Products

Choose «Oracle Database 10g Products 10.2.0.1.0» option, to avoid NCOMP error.
Cleanup $ORACLE_HOME/bin

After the installation some non used files in $ORACLE_HOME/bin can be removed.

cd $ORACLE_HOME/bin
rm *O
rm *0

Create the Listener

You can generate the needed files or you can create them manually. Put them in $TNS_ADMIN,

but create symbolic links from $ORACLE_HOME/network/admin to these files, because some tools

do not consult $TNS_ADMIN environment variable.

Example of LISTNER.ORA

# --------------------------------------------------------------------------
# File:        listener.ora
#
# Purpose:     Configuration file for Net Listener
#
# Location:    $TNS_ADMIN
#
# Certified:   Oracle 10.2.0.3 on Oracle Enterprise Linux 5
# --------------------------------------------------------------------------

GENTIC =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = DBHOST.EXAMPLE.COM)(PORT = 25000))
      (ADDRESS = (PROTOCOL = IPC)(KEY = GENTIC.EXAMPLE.COM))
    )
  )

SID_LIST_GENTIC  =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = GENTIC)
      (GLOBAL_DBNAME = GENTIC.EXAMPLE.COM)
      (ORACLE_HOME = /export/home/oracle/product/10.2.0)
    )
  )

LOG_DIRECTORY_GENTIC = /export/home/oracle/admin/sqlnet
TRACE_FILE_GENTIC = gentic.trc

Example of TNSNAMES.ORA

# --------------------------------------------------------------------------
# File:        tnsnames.ora
#
# Purpose:     Configuration File for all Net Clients
#
# Location:    $TNS_ADMIN
#
# Certified:   Oracle 10.2.0.3 on Oracle Enterprise Linux 5
# --------------------------------------------------------------------------

GENTIC =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = DBHOST.EXAMPLE.COM)(PORT = 25000))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = GENTIC.EXAMPLE.COM)
    )
  )

Example of SQLNET.ORA

# --------------------------------------------------------------------------
# File:        sqlnet.ora
#
# Purpose:     Configuration File for all Net Clients
#
# Location:    $TNS_ADMIN
#
# Certified:   Oracle 10.1.0.3 on RedHat Enterprise 5
# --------------------------------------------------------------------------

NAMES.DIRECTORY_PATH= (TNSNAMES)

Create Symbolic Links

cd $ORACLE_HOME/network/admin

lrwxrwxrwx 1 oracle dba listener.ora -> /export/home/oracle/admin/sqlnet/listener.ora


lrwxrwxrwx 1 oracle dba sqlnet.ora -> /export/home/oracle/admin/sqlnet/sqlnet.ora
lrwxrwxrwx 1 oracle dba tnsnames.ora -> /export/home/oracle/admin/sqlnet/tnsnames.ora

Start and show status of Listener GENTIC

lsnrctl start GENTIC


lsnrctl status GENTIC

Create Database

We recommend to generate the create scripts using Oracle DBCA. These scripts should be

verified because they show man important issues - important to know for every DBA.

Based on these scripts, we created our own initSID.sql and initSID.ora to create the database. In the subdirectory addo
parts of the database can be found and installed using

install-addons.bash

Edit initSID.ora and initSID.sql for your needs

Adjust and check the parameters for your environment, for example all PATH must be changed,

the value of SGA_TARGET and SGA_MAX_SIZE must be set according your physical memory, etc.

The files can be found in:

$ORACLE_BASE/admin/GENTIC/scripts/initGENTIC.sql
$ORACLE_BASE/admin/GENTIC/pfile/initGENTIC.ora

Enable Remote Administration with SYSDBA Privileges

If you want to manage all of your Oracle databases from one place and not have to log on to

each host, you must do it via a network connection. For example to remotely administer RMAN

through a network connection, you need such an environment. To enable remote administration

you have to two things:

1. Create a password file on each target database.


2. Enable remote logins for password file users.

To create the password file, as the Oracle software owner or as a member of the DBA group:

cd $ORACLE_BASE/admin/GENTIC/pfile
orapwd file=orapwGENTIC password=xxxx entries=5 force=y

After you create a password file, you need to enable remote logins. To do this, set the

instance's REMOTE_LOGIN_PASSWORDFILE initialization parameter in INIT.ORA to exclusive,

as shown:

remote_login_passwordfile = exclusive
Setting this parameter to exclusive signifies that only one database can use the password

file and that users other than SYS can reside in it. You can now use a network connection

to connect to your target database as SYSDBA.

sqlplus "sys/xxxx@<SERVICE> as sysdba"

Create Symbolic Links

Create symbolic links from $ORACLE_HOME/dbs as follows:

$ cd $ORACLE_HOME/dbs
lrwxrwxrwx  orapwGENTIC -> /export/home/oracle/admin/GENTIC/pfile/orapwGENTIC
lrwxrwxrwx  initGENTIC.ora -> /export/home/oracle/admin/GENTIC/pfile/initGENTIC.ora

Create the Database

First start the Instance, just to test your INIT file for correct syntax and system resources.

cd $ORACLE_BASE/admin/GENTIC/scripts
sqlplus /nolog
SQL> connect / as sysdba
SQL> startup nomount
SQL> shutdown immediate

Now you can create the database

SQL> @initGENTIC.sql
SQL> @shutdown immediate
SQL> startup

Check the Logfile: initGENTIC.log

Create additional Products in the Database (optional)

If you do not want all additional products to be installed, uncomment them in

install-addons.bash.

cd $ORACLE_BASE/admin/GENTIC/scripts/addons
./install-addons.bash

Create Server Parameter File

Server parameter files let you make persistent changes to individual parameters.

When you use a server parameter file, you can specify in an ALTER SYSTEM SET parameter

statement that the new parameter value should be persistent. This means that the new value

applies not only in the current instance, but also to any instances that are started up

subsequently. Traditional client-side parameter files do not let you make persistent changes
to parameter values.

cd $ORACLE_HOME/dbs
rm initGENTIC.ora

sqlplus / as sysdba
SQL> create spfile = '/export/home/oracle/admin/GENTIC/pfile/spfileGENTIC.ora'
        from pfile = '/export/home/oracle/admin/GENTIC/pfile/initGENTIC.ora';
File created.
SQL> exit;

ln -s /export/home/oracle/admin/GENTIC/pfile/spfileGENTIC.ora spfileGENTIC.ora
sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup;
SQL> exit;

Automatically Start / Stop the Database and Listener

If you want to start the database automatically on boot-time perform the following steps:

Copy standard oracle scripts dbstart and dbshut to $ORACLE_BASE/admin

Create start/stop script in /etc/init.d

Activate this start/stop script with chkconfig

Edit /etc/oratab to start/stop the desired Databases

Copy standard oracle scripts dbstart and dbshut to $ORACLE_BASE/admin

cd $ORACLE_HOME/bin
cp dbstart dbshut $ORACLE_BASE/admin

Create start/stop script in /etc/init.d as user root.

#!/bin/bash

# chkconfig: 12345 99 10

# description: Oracle auto start-stop script

# --------------------------------------------------------------------------

# File: oracle

# Purpose: Oracle auto start-stop script

# Location: /etc/init.d

#
# Certified: Oracle 10.2.0.3 on Enterprise Linux 5

# --------------------------------------------------------------------------

# Variables

ORACLE_OWNER=oracle; export ORACLE_OWNER

ORACLE_BASE=/export/home/oracle; export ORACLE_BASE

ORACLE_SCRIPTS_DIR=$ORACLE_BASE/admin; export ORACLE_SCRIPTS_DIR

ORACLE_HOME=$ORACLE_BASE/product/10.2.0; export ORACLE_HOME

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

RETVAL=0

prog="oracle"

start() {

echo -n $"Starting $prog: "

if [ ! -f $ORACLE_SCRIPTS_DIR/dbstart ]

then

echo "Oracle not started (no dbstart script)"

else

# Start RDBMS

su - $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbstart

# Start Enterprise Manager Console

# su - $ORACLE_OWNER $ORACLE_HOME/bin/emctl start dbconsole

# Start iSQL*Plus

# su - $ORACLE_OWNER $ORACLE_HOME/bin/isqlplusctl start

fi

RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/oracle

return $RETVAL

stop() {

echo -n $"Shutting down $prog: "

if [ ! -f $ORACLE_SCRIPTS_DIR/dbshut ]

then

echo "Oracle not stopped (no dbshut script)"

else

# Stop iSQL*Plus

# su - $ORACLE_OWNER $ORACLE_HOME/bin/isqlplusctl stop

# Stop Enterprise Manager Console

# su - $ORACLE_OWNER $ORACLE_HOME/bin/emctl stop dbconsole

# Stop RDBMS

su - $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbshut

fi

RETVAL=$?

[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/oracle

return $RETVAL

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop
;;

*)

echo $"Usage: $0 {start|stop}"

exit 1

esac

exit $RETVAL

Activate this start/stop script with chkconfig as root as follows

su - root
chkconfig --add oracle
chkconfig --list oracle

Edit /etc/oratab to start/stop the desired databases

su - root
cat /etc/oratab

# Entries are of the form:


# $ORACLE_SID:$ORACLE_HOME:<N|Y>:

GENTIC:/export/home/oracle/product/10.2.0:Y

Activate Enterprise Manager Console

Create the repository for the enterprise manager console as follows:

emca -repos create


emca -config dbcontrol db

Try to connect to the database control as follows:

http://<db-host>:1158/em

Automatically start and stop the DB-console

emctl start dbconsole


emctl stop dbconsole
emctl status dbconsole

Você também pode gostar