2.DB安装前的准备工作
1.配置yum源
略
2.配置透明巨页
cat <<EOF >> /etc/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
fi
EOF
chmod 775 /etc/rc.d/rc.local
3.配置系统内核参数
cat <<EOF >> /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1835008
kernel.shmmax = 7516192768
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
EOF
/sbin/sysctl -p
4.配置系统资源参数
cat <<EOF >>/etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
EOF
5.配置用户登录限制
echo "session required /lib/security/pam_limits.so" >> /etc/pam.d/login
echo "session required pam_limits.so" >> /etc/pam.d/login
6.配置资源限制
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 "umask 022" >> /etc/profile
echo "fi" >> /etc/profile
7.创建oracle用户
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54330 racdba
useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
echo "###################################"
echo "Password settings for oracle:"
echo oracle | passwd --stdin oracle
8.创建目录
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app /oradata /backup
chmod -R 775 /u01/app /oradata /backup
9.修改系统环境变量参数
9.1.配置10g和11g别名
[oracle@yuanzj.com:/home/oracle]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias 10g='source /home/oracle/.db10g'
alias 11g='source /home/oracle/.db11g'
[oracle@yuanzj.com:/home/oracle]$ ls -lh .db1*
-rw-r--r-- 1 oracle oinstall 816 Feb 16 16:14 .db10g
-rw-r--r-- 1 oracle oinstall 816 Feb 16 16:15 .db11g
9.2.Oracle10g环境变量:
[oracle@yuanzj.com:/home/oracle]$ cat .db10g
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=yuanzj.com
export ORACLE_UNQNAME=orcl10g
export ORACLE_BASE=/u01/app/ora10g
export ORACLE_HOME=/u01/app/ora10g/product/10.2.0/db_1
export ORACLE_SID=orcl10g
export ORACLE_TERM=xterm
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
alias sqlplus='rlwrap sqlplus'
alias sas='rlwrap sqlplus / as sysdba'
alias scott='rlwrap sqlplus scott/tiger'
alias hr='rlwrap sqlplus hr/hr'
alias rman='rlwrap rman'
9.3.Oracle11g环境变量:
[oracle@yuanzj.com:/home/oracle]$ cat .db11g
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=yuanzj.com
export ORACLE_UNQNAME=orcl11g
export ORACLE_BASE=/u01/app/ora11g
export ORACLE_HOME=/u01/app/ora11g/product/11.2.0/db_1
export ORACLE_SID=orcl11g
export ORACLE_TERM=xterm
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
alias sqlplus='rlwrap sqlplus'
alias sas='rlwrap sqlplus / as sysdba'
alias scott='rlwrap sqlplus scott/tiger'
alias hr='rlwrap sqlplus hr/hr'
alias rman='rlwrap rman'
注意:规划好不同版本数据库部署路径和实例名
10.配置selinux
cp /etc/selinux/config{,.bak} && sed -i '/SELINUX/s/enforcing/disabled/g;/SELINUX/s/permissive/disabled/g' /etc/selinux/config
setenforce 0
getenforce
11.配置防火墙
service iptables stop
chkconfig iptables off
12.配置hosts文件
[oracle@yuanzj.com:/home/oracle]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.18 yuanzj.com yuanzj
注意:如果主机名是yuanzj.com类似的,一定要写yuanzj,不然oem启动失败
13.安装依赖包
[root@yuanzj ~]# cat rpm.txt
ksh
libXtst-devel.x86_64
libXtst-devel.i686
libstdc++-devel.i686
kernel-headers
glibc-devel.i686
glibc-devel.x86_64
gnome-icon-theme
dmz-cursor-themes
sgml-common
libaio.i686
libaio.x86_64
libaio-devel.x86_64
libaio-devel.i686
ncurses-devel.x86_64
ncurses-devel.i686
elfutils-libelf-devel.x86_64
elfutils-libelf-devel.i686
compat-gcc-34
compat-gcc-34-c++
libXxf86misc.i686
libXxf86vm.i686
libXt.i686
libXt.x86_64
libXmu.x86_64
libXmu.i686
mpfr
cpp
xorg-x11-xauth
compat-gcc-34-c++
libdaemon
avahi
avahi-glib
shared-mime-info
libIDL-devel.i686
libIDL-devel.x86_64
ORBit2-devel.i686
ORBit2-devel.x86_64
GConf2-devel.i686
GConf2-devel.x86_64
gnome-vfs2-devel.i686
gnome-vfs2-devel.x86_64
libbonobo-devel.i686
libbonobo-devel.x86_64
libtool-ltdl.i686
libtool-ltdl.x86_64
unixODBC-devel.i686
unixODBC-devel.x86_64
gtk2-engines.i686
gtk2-engines.x86_64
libmcpp
mcpp
xorg-x11-server-utils
libXv-devel.i686
libXv-devel.x86_64
ConsoleKit-x11
xorg-x11-xinit
libXp-devel.i686
libXp-devel.x86_64
libXxf86dga
libdmx
xorg-x11-utils
compat-db43.i686
compat-db43.x86_64
ppl.i686
ppl.x86_64
cloog-ppl.i686
cloog-ppl.x86_64
gcc
gcc-c++
compat-libstdc++-33.i686
compat-libstdc++-33.x86_64
compat-db.i686
compat-db.x86_64
gnome-themes
system-icon-theme
system-gnome-theme
readline-devel.i686
readline-devel.x86_64
libgnome-devel.i686
libgnome-devel.x86_64
binutils-devel.i686
binutils-devel.x86_64
elfutils-devel.i686
elfutils-devel.x86_64
numactl-devel.i686
numactl-devel.x86_64
elfutils.i686
elfutils.x86_64
sysstat
make
zip
imake
unzip
lvm2
lvm2-libs
rdate
xinetd
mutt
eject
links
man
libcurl.i686
libdrm.i686
libidn.i686
libssh2.i686
mesa-dri-drivers.i686
mesa-libGL.i686
mesa-libGLU.i686
nspluginwrapper.i686
compat-libcap1
libstdc++-devel
cifs-utils
[root@yuanzj ~]# yum -y install `cat rpm.txt `
14.安装rlwarap
[root@yuanzj ~]# yum -y install rlwrap-0.42-1.el6.x86_64.rpm