oracle 安装脚本

来源:互联网 发布:sql数据库实训心得 编辑:程序博客网 时间:2024/06/05 17:21

 

#!/bin/sh

groupadd dba

groupadd oper

groupadd oinstall

useradd oracle

usermod -g dba -G dba oracle

passwd oracle <<EOF

oracle

EOF

mkdir -p /u01/app/oracle

chown -R oracle:dba /u01/app/oracle

chmod -R 775 /u01/app

 

#2 modify ~/.bash_profile

cat > /home/oracle/.bash_profile <<'EOF'

if [ -f ~/.bashrc ]; then

    . ~/.bashrc

fi

 

# User specific environment and startup programs

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/db_1

export ORACLE_SID=ora10g

export ORACLE_OWNER=oracle

export ORACLE_TERM=vt100

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

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

export CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib

export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH

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

export NLS_LANG=american_america.ZHS16GBK

export LANG=en_US 

export EDITOR=vi

export TNS_ADMIN=$ORACLE_HOME/network/admin

export NLS_DATA_FORMAT="yyyy-mm-dd hh24:mi:ss"

EOF

 

 

#3 modify /etc/sysctl.conf

cat > /etc/sysctl.conf <<EOF

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

 

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

 

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

 

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

 

# Controls whether core dumps will append the PID to the core filename

# Useful for debugging multi-threaded applications

kernel.core_uses_pid = 1

 

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

 

# Controls the maximum size of a message, in bytes

kernel.msgmnb = 65536

 

# Controls the default maxmimum size of a mesage queue

kernel.msgmax = 65536

 

#append here for install O11gR2

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 21719476736 ###half of your memory

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

EOF

 

 

#4 modify /etc/security/limits.conf

# It is the resource limit for the number of processes available to a user.

cat > /etc/security/limits.conf  <<EOF

# /etc/security/limits.conf

#

#Each line describes a limit for a user in the form:

#

#<domain>        <type>  <item>  <value>

#

#Where:

#<domain> can be:

#        - an user name

#        - a group name, with @group syntax

#        - the wildcard *, for default entry

#        - the wildcard %, can be also used with %group syntax,

#                 for maxlogin limit

#

#<type> can have the two values:

#        - "soft" for enforcing the soft limits

#        - "hard" for enforcing hard limits

#

#<item> can be one of the following:

#        - core - limits the core file size (KB)

#        - data - max data size (KB)

#        - fsize - maximum filesize (KB)

#        - memlock - max locked-in-memory address space (KB)

#        - nofile - max number of open files

#        - rss - max resident set size (KB)

#        - stack - max stack size (KB)

#        - cpu - max CPU time (MIN)

#        - nproc - max number of processes

#        - as - address space limit

#        - maxlogins - max number of logins for this user

#        - maxsyslogins - max number of logins on the system

#        - priority - the priority to run user process with

#        - locks - max number of file locks the user can hold

#        - sigpending - max number of pending signals

#        - msgqueue - max memory used by POSIX message queues (bytes)

#        - nice - max nice priority allowed to raise to

#        - rtprio - max realtime priority

#

#<domain>      <type>  <item>         <value>

#

 

#*               soft    core            0

#*               hard    rss             10000

#@student        hard    nproc           20

#@faculty        soft    nproc           20

#@faculty        hard    nproc           50

#ftp             hard    nproc           0

#@student        -       maxlogins       4

 

# End of file

oracle soft nproc  2047

oracle hard nproc  16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack  10240

EOF

 

#5 /etc/profile

check_profile=`grep "ulimit -p 16384" /etc/profile`

if [ "$check_profile" == ''  ]; then

cat >> /etc/profile <<EOF

if [ $USER = "oracle" ]; then

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

     ulimit -p 16384

     ulimit -n 65536

  else

     ulimit -u 16384 -n 65536

  fi

fi

EOF

else

  echo "Negative........../etc/profile ware already modified!!"

fi

 

#6 /etc/pam.d/login

check_pam=`grep "/lib/security/pam_limits.so" /etc/pam.d/login | awk {'print $3'}`

if [ $? = 0 ];

then

    echo "Negative........../etc/pam.d/login ware already modified!!"

else

cat >> /etc/pam.d/login <<!

session required /lib/security/pam_limits.so 

session required pam_limits.so

!

fi

 

 

cd  /mnt/CentOS

yum -y install     binutil*

yum -y install     compat-libstdc++*

yum -y install     elfutils-libelf*

yum -y install     elfutils-libelf-devel*

yum -y install     elfutils-libelf-devel-static*

yum -y install     gcc*

yum -y install     gcc-c++*

yum -y install     glibc*

yum -y install     glibc-common*

yum -y install     glibc-devel*

yum -y install     glibc-headers*

yum -y install     kernel-headers*

yum -y install     ksh*

yum -y install     libaio*

yum -y install     libgcc*

yum -y install     libgomp*

yum -y install     libstdc++*

yum -y install     libstdc++*

yum -y install     make*

yum -y install     sysstat*

yum -y install  libXp*

 

 

原创粉丝点击