时间:2021-07-01 10:21:17 帮助过:5人阅读
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4181979136
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
生效
sysctl -p
(2)限制
cat >> /etc/security/limits.conf<<EOF
#ORACLE SETTING
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat >> /etc/pam.d/login<<EOF
session required pam_limits.so
EOF
(3)依赖包
下面为官方推荐Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4安装软件包
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
检查缺失包
rpm -q --qf ‘%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n‘ binutils \
compat-libcap1 \
compat-libstdc++ \
compat-libstdc++.i686 \
gcc \
gcc-c++ \
glibc.i686 \
glibc \
glibc-devel \
glibc-devel.i686 \
ksh \
libgcc.i686 \
libgcc \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
make \
sysstat \
unixODBC \
unixODBC-devel
安装显示not install的包
(4)创建所需用户和组
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -g oinstall -G dba oracle
设置密码:
passwd oracle
(5)创建所需目录
chmod -R 777 /oracle
chmod -R 770 /oracle/app/
chmod -R 775 /oracle/app/oracle/
mkdir -p /oracle/app/oracle
chown -R oracle:oinstall /oracle/app/oracle/
chown -R oracle:oinstall app/
(6)配置环境变量
su - oracle
vi .bash_profile
添加下面的内容:
##################################################
# User specific environment and startup programs
##################################################
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=PROD
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:$ORACLE_HOME/bin
export ORACLE_TERM=xterm
#export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
##################################################
# set NLS_LANG to resolve messy code in SQLPLUS
##################################################
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
##################################################
# Shell setting.
##################################################
umask 022
set -o vi
export PS1="\${ORACLE_SID}@`hostname` \${PWD}$ "
##################################################
# Oracle Alias
##################################################
alias ls="ls -FA"
alias vi=vim
alias base=‘cd $ORACLE_BASE‘
alias home=‘cd $ORACLE_HOME‘
alias alert=‘tail -200f $ORACLE_BASE/admin/RACDB/bdump/alert_$ORACLE_SID.log‘
alias tnsnames=‘vi $ORACLE_HOME/network/admin/tnsnames.ora‘
alias listener=‘vi $ORACLE_HOME/network/admin/listener.ora‘
说明:ORACLE_SID与字符集等环境变量根据实际要求修改
如果出现下面乱码,修改临时环境变量
export LANG=en_US
YES
pdksh可以忽略
开始安装
[oracle@localhost software]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
[oracle@localhost software]$ cp OPatch-p6880880_112000_Linux-x86-64.zip $ORACLE_HOME
[oracle@localhost software]$ cd $ORACLE_HOME
[oracle@localhost 11.2.0]$ mv OPatch OPatch_100057_OLD
[oracle@localhost 11.2.0]$ unzip OPatch-p6880880_112000_Linux-x86-64.zip
[oracle@localhost 11.2.0]$ export PATH=$PATH:$ORACLE_HOME/OPatch
---查看当前补丁情况
[oracle@localhost 11.2.0]$ opatch lsinventory
Oracle 中间补丁程序安装程序版本 11.2.0.3.6
版权所有 (c) 2013, Oracle Corporation。保留所有权利。
Oracle Home : /oracle/app/oracle/product/11.2.0
Central Inventory : /oracle/app/oraInventory
from : /oracle/app/oracle/product/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2015-11-09_17-43-41下午_1.log
Lsinventory Output file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2015-11-09_17-43-41下午.txt
--------------------------------------------------------------------------------
已安装的顶级产品 (1):
Oracle Database 11g 11.2.0.4.0
此 Oracle 主目录中已安装 1 个产品。
此 Oracle 主目录中未安装任何中间补丁程序。
--------------------------------------------------------------------------------
OPatch succeeded.
[oracle@localhost 11.2.0]$ cd /oracle/software/21352635/
[oracle@localhost 21352635]$
[oracle@localhost 21352635]$
[oracle@localhost 21352635]$ ls -l
总用量 88
drwxr-xr-x 4 root root 4096 9月 1 15:50 17478514/
drwxr-xr-x 4 root root 4096 9月 1 15:50 18031668/
drwxr-xr-x 4 root root 4096 9月 1 15:50 18522509/
drwxr-xr-x 4 root root 4096 9月 1 15:50 19121551/
drwxrwxr-x 4 root root 4096 9月 1 15:50 19769489/
drwxrwxr-x 4 root root 4096 9月 1 15:50 20299013/
drwxrwxr-x 4 root root 4096 9月 1 15:50 20760982/
drwxrwxr-x 4 root root 4096 9月 1 15:50 21352635/
-rw-r--r-- 1 root root 3068 9月 1 15:51 patchmd.xml
-rw-rw-r-- 1 root root 48324 10月 17 06:06 README.html
-rw-r--r-- 1 root root 21 9月 1 15:51 README.txt
[oracle@localhost 21352635]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle 中间补丁程序安装程序版本 11.2.0.3.6
版权所有 (c) 2013, Oracle Corporation。保留所有权利。
PREREQ session
Oracle Home : /oracle/app/oracle/product/11.2.0
Central Inventory : /oracle/app/oraInventory
from : /oracle/app/oracle/product/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2015-11-09_17-44-30下午_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
[oracle@localhost 21352635]$
[oracle@localhost 21352635]$ opatch apply
Oracle 中间补丁程序安装程序版本 11.2.0.3.6
版权所有 (c) 2013, Oracle Corporation。保留所有权利。
Oracle Home : /oracle/<