>>>>>>>>>>>>>>>安装oracle<<<<<<<<<<<<<
*******静态IP设置*******
进入目录network-scripts
[root@bogon ~]# cd /etc/sysconfig/network-scripts/
编辑networ相关配置文件
[root@bogon ~]# vim ifcfg-eno16777736
添加/修改如下内容
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.0.38
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
DNS=192.168.0.1
重启network服务
[root@bogon ~]# systemctl restart network
*******修改主机名********
修改hosts文件
[root@bogon ~] vim /etc/hosts
添加 192.168.0.38 host38 一行
永久修改主机名,执行如下命令
[root@bogon ~] hostnamectl set-hostname host38
*******oracle安装环境配置********
添加oracle操作相关用户组及oracle用户
[root@host38 ~]# groupadd oinstall
[root@host38 ~]# groupadd dba
[root@host38 ~]# groupadd oper
[root@host38 ~]# useradd -g oinstall -G dba,oper oracle
[root@host38 ~]# passwd oracle
修改oracle要求的最低linux内核参数,打开文件sysctl.conf
[root@host38 ~]# vim /etc/sysctl.conf
添加如下内容
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
执行命令使之生效
[root@host38 ~]# sysctl -p
修改文件/etc/security/limits.conf,
[root@host38 ~]# vim /etc/security/limits.conf
添加如下内容
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 50000000
oracle hard memlock 50000000
为用户添加oracle环境变量,修改文件/home/oracle/.bash_profile,
[root@host38 ~]# vim /home/oracle/.bash_profile
添加如下内容:
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=host38
export ORACLE_UNQNAME=ORCL
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ORCL
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH
检查必须的包是否安装
[root@host38 ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
然后根据提示逐一安装未安装的程序包,我这儿缺少以下程序包:
[root@host38 ~]# yum -y install elfutils-libelf-devel
[root@host38 ~]# yum -y install gcc-c++
[root@host38 ~]# yum -y install ksh
[root@host38 ~]# yum -y install libaio-devel
[root@host38 ~]# yum -y install libstdc++-devel
[root@host38 ~]# yum -y install unixODBC
[root@host38 ~]# yum -y install unixODBC-devel
创建oracle的home目录,即刚才在/home/oracle/.bash_profile中配置的ORACLE_HOME路径
[root@host38 ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
将/u01目录授权给oracle
[root@host38 ~]# chown oracle:oinstall -R /u01
[root@host38 ~]# chmod 755 /u01
修改文件/etc/selinux/config,修改内容如下
SELINUX=permissive
执行如下命令并且重启服务器,以使以上修改全部生效
[root@host38 ~]# systemctl mask tmp.mount
[root@host38 ~]# reboot
以oracle用户登录,将oracle安装包拷入/home/oracle目录
解压oracle安装包
[oracle@host38 ~]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@host38 ~]$ unzip linux.x64_11gR2_database_2of2.zip
进入解压后目录执行oracle安装命令
[oracle@host38 database]$ ./runInstaller
然后就是一路next,
在install type环节如果选则了高级安装选项则在configuration options环节可设置数据库默认字符集,
在执行到68%左右时会出现两个与log有关的错误,不用管他点击continu
**********配置oracle开机自启动************
修改/etc/oratab文件:
orcl:/u01/app/oracle/product/11.2.0/db_1:Y 将N改成Y
创建文件/etc/rc.d/init.d/oracle,内容如下:
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_USER=oracle
case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
将新建好的oracle文件添加至chkconfig中
chkconfig --add oracle
然后就可以使用service oracle restart/start/stop等命令来重启/打开/关闭oracle了
设置oracle为开机自启动
[root@host38 ~]# chkconfig oracle on
[root@host38 ~]# chkconfig --list oracle
*******静态IP设置*******
进入目录network-scripts
[root@bogon ~]# cd /etc/sysconfig/network-scripts/
编辑networ相关配置文件
[root@bogon ~]# vim ifcfg-eno16777736
添加/修改如下内容
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.0.38
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
DNS=192.168.0.1
重启network服务
[root@bogon ~]# systemctl restart network
*******修改主机名********
修改hosts文件
[root@bogon ~] vim /etc/hosts
添加 192.168.0.38 host38 一行
永久修改主机名,执行如下命令
[root@bogon ~] hostnamectl set-hostname host38
*******oracle安装环境配置********
添加oracle操作相关用户组及oracle用户
[root@host38 ~]# groupadd oinstall
[root@host38 ~]# groupadd dba
[root@host38 ~]# groupadd oper
[root@host38 ~]# useradd -g oinstall -G dba,oper oracle
[root@host38 ~]# passwd oracle
修改oracle要求的最低linux内核参数,打开文件sysctl.conf
[root@host38 ~]# vim /etc/sysctl.conf
添加如下内容
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
执行命令使之生效
[root@host38 ~]# sysctl -p
修改文件/etc/security/limits.conf,
[root@host38 ~]# vim /etc/security/limits.conf
添加如下内容
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 50000000
oracle hard memlock 50000000
为用户添加oracle环境变量,修改文件/home/oracle/.bash_profile,
[root@host38 ~]# vim /home/oracle/.bash_profile
添加如下内容:
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=host38
export ORACLE_UNQNAME=ORCL
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ORCL
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH
检查必须的包是否安装
[root@host38 ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
然后根据提示逐一安装未安装的程序包,我这儿缺少以下程序包:
[root@host38 ~]# yum -y install elfutils-libelf-devel
[root@host38 ~]# yum -y install gcc-c++
[root@host38 ~]# yum -y install ksh
[root@host38 ~]# yum -y install libaio-devel
[root@host38 ~]# yum -y install libstdc++-devel
[root@host38 ~]# yum -y install unixODBC
[root@host38 ~]# yum -y install unixODBC-devel
创建oracle的home目录,即刚才在/home/oracle/.bash_profile中配置的ORACLE_HOME路径
[root@host38 ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
将/u01目录授权给oracle
[root@host38 ~]# chown oracle:oinstall -R /u01
[root@host38 ~]# chmod 755 /u01
修改文件/etc/selinux/config,修改内容如下
SELINUX=permissive
执行如下命令并且重启服务器,以使以上修改全部生效
[root@host38 ~]# systemctl mask tmp.mount
[root@host38 ~]# reboot
以oracle用户登录,将oracle安装包拷入/home/oracle目录
解压oracle安装包
[oracle@host38 ~]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@host38 ~]$ unzip linux.x64_11gR2_database_2of2.zip
进入解压后目录执行oracle安装命令
[oracle@host38 database]$ ./runInstaller
然后就是一路next,
在install type环节如果选则了高级安装选项则在configuration options环节可设置数据库默认字符集,
在执行到68%左右时会出现两个与log有关的错误,不用管他点击continu
**********配置oracle开机自启动************
修改/etc/oratab文件:
orcl:/u01/app/oracle/product/11.2.0/db_1:Y 将N改成Y
创建文件/etc/rc.d/init.d/oracle,内容如下:
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_USER=oracle
case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
将新建好的oracle文件添加至chkconfig中
chkconfig --add oracle
然后就可以使用service oracle restart/start/stop等命令来重启/打开/关闭oracle了
设置oracle为开机自启动
[root@host38 ~]# chkconfig oracle on
[root@host38 ~]# chkconfig --list oracle