标签:启动服务 bash ble epo library linux limit snr base
一、硬件要求
1.内存与Sweap:内存2G(以上),Sweap 2G(以上)
内存: 1-2G 2-16G 16G以上
Sweap: 1.5倍内存 1倍内存 16G
检查:# grep MemTotal /proc/meminfo
# grep SwapTotal /proc/meminfo
2.磁盘:20G以上
检查:#df -h
二、软件要求
操作系统:CentOS6.5(X86_64)
ORACLE版本:11gR2(X86_64)
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
三、网络要求
设置静态IP,将虚拟机IP地址和真实主机IP地址设在同一IP段,其它(netmask,broadcast,gateway,dns)与主机保持一致(即可实现虚拟机<--->主机;虚拟机<---->互联网通信)。
关闭防火墙、SELinux:
# setenforce 0 #SELinux临时关闭命令
# service iptables stop #防火墙临时关闭命令
四、安装RPM依赖包
RPM安装包列表:
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)
方式:见http://www.92csz.com/study/linux/11.htm
联网安装:
# yum search rpmkeyword
# yum install <package-name>
默认联网地址可以修改:vi /etc/yum.repos.d/CentOS-Base.repo
先下载后安装:
RPM包拷贝到/opt目录下(或使用wget命令)
# rpm -ivh <package-name>
csdn免积分下载地址:http://download.csdn.net/detail/u010011052/6260539
用rpm安装存在依赖问题,建议如果可行,就用yum来安装。
五、修改内核参数与系统资源限制
#vi /etc/sysctl.conf #末尾添加如下 :
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
# sysctl -p #从配置文件“/etc/sysctl.conf”加载内核参数设置
# sysctl -a #查看所有系统变量
# vi /etc/security/limits.conf #末尾添加如下 :
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /etc/pam.d/login #在session required pam_namespace.so 下面添加一条:
session required pam_limits.so
# vi /etc/profile #末尾添加如下 :
if [ $USER ="oracle" ]; then
if [ $SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
# vi /etc/hosts #否则在配置Oracle监听时会出现问题而无法启动,添加如下:
192.168.8.33 ORACLEDB #IP地址 主机名称($HOSTNAME)
# xhost + #使所有用户都能访问图形桌面
六、创建组和用户
# groupadd -g 200 oinstall
# groupadd -g 201 dba
# useradd -u 440 -g oinstall -G dba oracle
# passwd oracle
# id oracle #查看oracle用户
# vi /etc/sudoers #将oracle加入到sudo群组,在root ALL=(ALL) ALL 后添加:
oracle ALL=(ALL) ALL
七、创建ORACLE安装目录
# mkdir /opt/oracle/app/
# mkdir /opt/oracle/oradata/
# chmod 755 /opt/oracle/
# chmod 775 /opt/oracle/app/
# chown oracle.oinstall -R /opt/oracle/
八、设置环境变量
注销root ;用oracle帐号进入
$ vi ~/.bash_profile #~/表示的是当前用户的根目录/home/oracle,添加如下:
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/112
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
$ source ~/.bash_profile #立即生效
$ export LANG=en_US.UTF-8 #更改字符集(.UTF-8不能少),否则会有中文乱码
# env|more #查看配置的环境变量是否正确
九、解压与安装
$ cd /opt/oracle #/opt/oracle为安装文件存放目录
$ unzip /media/linux_11gR2_database_1of2.zip
$ unzip /media/linux_11gR2_database_2of2.zip
$ cd database
$ ./runInstaller
选择“高级安装”,以指定字符集ZH16GBK。
安装完成后,会出来一个对话框,提示使用root用户执行这两个脚本
# /opt/oracle/oraInventory/oraioot.sh
# /opt/oracle/app/product/11.2.0/dbhome_1/root.sh
su –oracle
$ lsnrctl start #开启监听
$ sqlplus / as sysdba
SQL> startup #启动数据库
十、自启动服务设置
# vi /etc/init.d/oracledb #编辑新增文件如下:
# chkconfig: 35 80 10
# description: starts the oracle dabase deamons
# /etc/init.d/oracledb
ORACLE_HOME=/opt/oracle/112
ORACLE_OWNER=oracle
case "$1" in
start)
echo -n "Starting oracledb: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart"
touch /var/lock/subsys/oracledb
echo -n "Starting lsnr: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
echo -n "Starting dbconsole: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo
;;
stop)
echo -n "shutting down dbconsole: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo -n "shutting down lsnr: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
echo -n "shutting down oracledb: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut"
rm -f /var/lock/subsys/oracledb
echo
;;
restart)
echo -n "restarting oracledb: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: `basename $0` start|stop|restart"
esac
其中35 80 10基于如下查询:
[oracle@oracledb rc.d]$ find -name ‘K*oracledb‘
./rc2.d/K10oracledb
./rc4.d/K10oracledb
./rc6.d/K10oracledb
./rc1.d/K10oracledb
./rc0.d/K10oracledb
[oracle@oracledb rc.d]$ find -name ‘S*oracledb‘
./rc5.d/S80oracledb
./rc3.d/S80oracledb
[oracle@oracledb rc.d]$ chkconfig --list oracledb
oracledb 0:off 1:off 2:off 3:on 4:off 5:on 6:off
如上oracledb文件中前两行注释也可以不写,可以采用文件链接:
# ln -s /etc/init.d/oracledb /etc/rc.d/rc3.d/S80oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc5.d/S80oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc0.d/K10oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc1.d/K10oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc2.d/K10oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc4.d/K10oracledb
# ln -s /etc/init.d/oracledb /etc/rc.d/rc6.d/K10oracledb
# chmod 775 /etc/init.d/oracledb #改变文件权限
# chkconfig --level 35 oracle on #添加服务
# vi /etc/oratab #修改oracle启动配置
orcl:/opt/oracle/112:Y #$ORACLE_SID:$ORACLE_HOME:<N|Y>:
标签:启动服务 bash ble epo library linux limit snr base
原文地址:http://www.cnblogs.com/yizitrd/p/5983593.html