./runInstaller
(1)仅安装数据库软件
(2)单实例安装
(3)选中文
(4)安装企业版
(5)指定安装位置,应该与环境变量相同
(6)创建清单,应该与环境变量相同
(7)默认
(8)执行脚本
配置监听和创建实例
配置监听 netca
(1)监听程序配置
(2)添加一个监听
(3)监听程序名LISTENER
(4)选定的协议TCP
(5)使用标准端口号1521
(6)是否配置另外一个监听程序,否
(7)配置完成
(8)点击完成
配置数据库实例 dbca
(1)创建数据库
(2)一般用途或事务处理
(3)填写全局数据库名yuchunju.yu,SID:orcl
与.bash_profile中的ORACLE_SID一致
(4)默认
(5)口令管理
(6)默认
(7)指定快速恢复区
(8)示例方案,可选可不选
(9)字符集设置,其余默认,看一遍都配置了什么
UTF8
(10)完成
执行脚本
#!/bin/sh
echo '#--------------------------------------------yum 安装'
yum install -y expect* elfutils-libelf* gcc-* make* binutils* libaio* glibc*
yum install -y libgomp* kernel-headers* compat-libstdc++* libgcc* libstdc++* sysstat* unixODBC* ksh*
echo '#--------------------------------------------修改ip地址'
cat >/etc/hosts<<EOF
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
EOF
echo '#--------------------------------------------创建用户与组'
groupadd -g 501 oinstall
groupadd -g 502 dba
useradd -g oinstall -G dba oracle
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R oracle.oinstall /u01/app/oracle/
chmod -R 775 /u01/app/oracle/
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
echo '#------------------------------------------------修改用户密码passwd oracle'
echo "111111" | passwd oracle --stdin > /dev/null 2>&1
echo '#------------------------------------ vi /etc/sysctl.conf'
cat >> /etc/sysctl.conf <<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
EOF
sysctl -p
echo '#----------------------------------------------------------vi /etc/security/limits.conf'
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
echo '#------------------------------------vi /etc/pam.d/login'
echo 'session required pam_limits.so' >>/etc/pam.d/login
echo '#------------------------------------------------------修改profile'
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
umask 022
fi
EOF
echo '#--------------------------------------------------------修改 csh.login'
cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif
EOF
echo '#-----------------------------oracle 用户配置文件ORACLE_HOSTNAME 请自行设置'
# Oracle Settings oracle
cat >> /home/oracle/.bash_profile<<EOF
# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
ORACLE_SID=orcl; export ORACLE_SID
# ---------------------------------------------------
# ORACLE_UNQNAME
# ---------------------------------------------------
#ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME
# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
#JAVA_HOME=/usr/local/java; export JAVA_HOME
# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
# ---------------------------------------------------
# ORACLE_PATH
# ---------------------------------------------------
ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH
# SQLPATH=/u01/app/common/oracle/sql; export SQLPATH
# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM
# ---------------------------------------------------
# NLS_DATE_FORMAT
# ---------------------------------------------------
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"; export NLS_DATE_FORMAT
# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN
# ---------------------------------------------------
# ORA_NLS11
# ---------------------------------------------------
ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin
PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=\${PATH}:/u01/app/common/oracle/bin
export PATH
# ---------------------------------------------------
# LD_LIBRARY_PATH
# ---------------------------------------------------
LD_LIBRARY_PATH=\$ORACLE_HOME/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
# ---------------------------------------------------
# CLASSPATH
# ---------------------------------------------------
CLASSPATH=\$ORACLE_HOME/JRE
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export CLASSPATH
# ---------------------------------------------------
# THREADS_FLAG
# ---------------------------------------------------
THREADS_FLAG=native; export THREADS_FLAG
# ---------------------------------------------------
# TEMP, TMP, and TMPDIR
# ---------------------------------------------------
export TEMP=/tmp
export TMPDIR=/tmp
# ---------------------------------------------------
# NLS_LANG 字符集设置
# ---------------------------------------------------
export NLS_LANG="american_america.zhs16gbk"
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
if [ \$USER = "oracle" ] ; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF