当前位置:   article > 正文

Linux下Oracle数据库安装详解_linux下安装oracle

linux下安装oracle

安装环境

系统:Linux CentOS7 64位
Oracle版本:Oracle 11g R2


一、安装前准备

1、创建运行oracle数据库的系统用户和用户组

[yxc@localhost ~]$ su root  #切换到root
Password: 
[root@localhost ~]# groupadd oinstall  #创建用户组oinstall
[root@localhost ~]# groupadd dba  #创建用户组dba
[root@localhost ~]# useradd -g oinstall -g dba -m oracle  #创建oracle用户,并加入到oinstall和dba用户组
[root@localhost ~]# passwd oracle  #设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆
Changing password for user oracle.
New password:   # 密码
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:   # 确认密码
passwd: all authentication tokens updated successfully.
[root@localhost ~]# id oracle # 查看新建的oracle用户
uid=1001(oracle) gid=1002(dba) groups=1002(dba)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

如下图所示:
在这里插入图片描述

2、修改/etc/sysctl.conf文件,输入命令: vi /etc/sysctl.conf ,将下列内容加入该文件。

fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

使用/sbin/sysctl -p命令使 sysctl.conf 配置生效。


3、修改操作系统核心参数
输入命令:vi /etc/security/limits.conf,将下列内容加入该文件。

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
  • 1
  • 2
  • 3
  • 4

4.、修改/etc/pam.d/login 文件,输入命令:vi /etc/pam.d/login,将下列内容加入该文件。

session required /lib/security/pam_limits.so
session required pam_limits.so
  • 1
  • 2

5、 编辑 /etc/profile ,输入命令: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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

6、创建数据库软件目录和数据文件存放目录,注意磁盘空间即可,这里我放到oracle用户下,输入如下命令:

mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oracle/product
  • 1
  • 2
  • 3
  • 4

7、更改目录属主为 oracle 用户所有,输入命令:

chown -R oracle:oinstall /home/oracle/app
  • 1

8、切换为oracle用户登录

su - oracle
  • 1

9、配置 oracle 用户环境变量
编辑 bash_profile ,输入命令:vi .bash_profile,添加如下环境变量。

export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
  • 1
  • 2
  • 3
  • 4
  • 5

10、切换为 root 用户,关闭 selinux

su root
# 修改/etc/selinux/config文件
vi /etc/selinux/config
  • 1
  • 2
  • 3

修改SELINUX为disabled,如下:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled   #此处修改为disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

二、软件包依赖

安装oracle之前需要许多软件包依赖,如果可用外网,使用如下命令安装。

yum install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
  • 1

查看这些软件包版本,可使用如下命令,如有未安装的会有提示。

rpm -q binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common gli
    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/739551
    推荐阅读
    相关标签
      

    闽ICP备14008679号