CentOS下Oracle 10g的安裝

keeking發表於2010-02-28
1.新增必要的組和使用者

The following operating system groups and user are required if you are installing Oracle Database:

  • The OSDBA group (dba)

    You must create this group the first time you install Oracle Database software on the system. It identifies operating system user accounts that have database administrative privileges (the SYSDBA privilege). The default name for this group is dba.

    If you want to specify a group name other than the default dba group, then you must choose the Custom installation type to install the software or start Oracle Universal Installer as a user that is not a member of this group. In this case, Oracle Universal Installer prompts you to specify the name of this group.

  • The OSOPER group (oper)

    This is an optional group. Create this group if you want a separate group of operating system users to have a limited set of database administrative privileges (the SYSOPER privilege). By default, members of the OSDBA group also have the SYSOPER privilege.

    If you want to specify a separate OSOPER group, other than the default dba group, then you must choose the Custom installation type to install the software or start Oracle Universal Installer as a user that is not a member of the dba group. In this case, Oracle Universal Installer prompts you to specify the name of this group. The usual name chosen for this group is oper.

  • An unprivileged user

    Verify that the unprivileged user nobody exists on the system. The nobody user must own the external jobs (extjob) executable after the installation.

The following operating system group and user are required for all installations:

  • The Oracle Inventory group (oinstall)

    You must create this group the first time you install Oracle software on the system. The usual name chosen for this group is oinstall. This group owns the Oracle inventory, which is a catalog of all Oracle software installed on the system.

    Note:

    If Oracle software is already installed on the system, then the existing Oracle Inventory group must be the primary group of the operating system user that you use to install new Oracle software.
  • The Oracle software owner user (typically, oracle)

    You must create this user the first time you install Oracle software on the system. This user owns all of the software installed during the installation. This user must have the Oracle Inventory group as its primary group. It must also have the OSDBA and OSOPER groups as secondary groups.

下面是shell程式
#!/bin/bash
# determining whether the oracle inverntory group exists,if exists nothing will
# be done,otherwise add the inverntory group

if [ `cat /etc/group | grep "^oinstall$" >> oracle.log 2>1&` ]
then
    :
else
    $(/usr/sbin/groupadd oinstall)
fi

# determining whether the osdba group exists,if not exists add,otherwise do
# nothing

if [ `cat /etc/group | grep "^dba$" >> oracle.log 2>1&` ]
then
    :
else
    $(/usr/sbin/groupadd dba)
fi

# determining whether the optional osoper group exists,if not exists add,
# otherwise do nothing

if [ `cat /etc/group | grep "^oper$" >> oracle.log 2>1&` ]
then
    :
else
    $(/usr/sbin/groupadd oper)
fi


# determining whether the oracle software owner user exists,if not exists add,
# otherwise do nothing

if [ `id "oracle" >> oracle.log 2>1&` ]
then
    :
else
    /usr/sbin/useradd -g oinstall -G dba,oper oracle
fi


# determining whether the user nobody exists,if not exists add,
# otherwise do nothing
if [ `id "nobody" >> oracle.log 2>1&` ]
then
    :
else
    /usr/sbin/useradd nobody
fi

# increase the shell limits
# 1.
echo 'oracle    soft    nproc    2047' >> /etc/security/limits.conf

echo 'oracle    hard    nproc    16384' >> /etc/security/limits.conf

echo 'oracle    soft    nofile    1024' >> /etc/security/limits.conf

echo 'oracle    hard    nofile    65536' >> /etc/security/limits.conf

# 2.

if [ `grep "/lib/security/pam_limits.so" /etc/pam.d/login >> oracle.log 2>1&` ]
then
    :
else
    echo 'session    required     /lib/security/pam_limits.so' >> /etc/pam.d/login
fi

#3.
echo 'if [ $USER="oracle" ];then' >> /etc/profile
echo '   if [ $SHELL = "/bin/ksh" ];then' >> /etc/profile
echo '        ulimit -p 16384' >> /etc/profile
echo '        ulimit -n 65536' >> /etc/profile
echo '   else' >> /etc/profile
echo '        ulimit -u 16384 -n 65536' >> /etc/profile
echo '   fi' >> /etc/profile
echo 'fi' >> /etc/profile

# we add a file, so oracle will treate ubuntu as redhat
touch /etc/redhat-release
echo "Red Hat Linux release 4.1" > /etc/redhat-release

# change the kernel parameter
cp /etc/sysctl.conf /etc/sysctl.conf.bak

if [ `grep "^kernel.shmall" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/kernel.shmall/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
else
    echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
fi


if [ `grep "^kernel.shmmni" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/kernel.shmmni/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
else
    echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
fi


if [ `grep "^kernel.shmmax" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/kernel.shmmax/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
else
    echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
fi


if [ `grep "^kernel.sem" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/kernel.sem/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
else
    echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
fi


if [ `grep "^fs.file-max" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/fs.file-max/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "fs.file-max = 65536" >> /etc/sysctl.conf
else
    echo "fs.file-max = 65536" >> /etc/sysctl.conf
fi


if [ `grep "^net.ipv4.ip_local_port_range" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/net.ipv4_local_port_range/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "net.ipv4_local_port_range = 1024 65000" >> /etc/sysctl.conf
else
    echo "net.ipv4_local_port_range = 1024 65000" >> /etc/sysctl.conf
fi


if [ `grep "^net.core.rmem_default" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/net.core.rmem_default/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "net.core.rmem_default = 1048576" >> /etc/sysctl.conf
else
    echo "net.core.rmem_default = 1048576" >> /etc/sysctl.conf
fi


if [ `grep "^net.core.rmem_max" /etc/sysctl.conf  >> oracle.log 2>1&` ]
then
    sed "s/net.core.rmem_max/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "net.core.rmem_max = 1048576" >> /etc/sysctl.conf
else
    echo "net.core.rmem_max = 1048576" >> /etc/sysctl.conf
fi


if [ `grep "^net.core.wmem_max" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/net.core.wmem_max/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "net.core.wmem_max = 262144" >> /etc/sysctl.conf
else
    echo "net.core.wmem_max = 262144" >> /etc/sysctl.conf
fi


if [ `grep "^net.core.wmem_default" /etc/sysctl.conf >> oracle.log 2>1&` ]
then
    sed "s/net.core.wmem_default/d/" /etc/sysctl.conf > /tmp/sysctl.conf.temp
    mv /tmp/sysctl.conf.temp /etc/sysctl.conf
    echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
else
    echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
fi

sysctl -p

# check oracle home directory
if [ -s "/etc/oraInst.loc" ]
then
    :
else
    mkdir -p /u01/app/oracle
    chown -R oracle:oinstall /u01/app/oracle
    chmod -R 775 /u01/app/oracle
    echo 'export ORACLE_BASE=/u01/app/oracle' >> /etc/profile
    mkdir -p /u01/oradata
    chown -R oracle:oinstall /u01/oradata
    chmod -R 775 /u01/oradata
    mkdir -p /u01/flash_recovery_area
    chown -R oracle:oinstall /u01/flash_recovery_area
    chmod -R 775 /u01/flash_recovery_area
    . /etc/profile
fi


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7899089/viewspace-628188/,如需轉載,請註明出處,否則將追究法律責任。

相關文章