Centos7.5 安装oracle11g

一、安装环境

主机名:slave.com
OS: centos7.5
软件版本:Oracle 11.2.0.4
CPU: 1个
内存: 8G
swap: 16G
/u01 : 20G
/data: 50G
/backup: 50G
安装方式:CentOS 7为Gnome

二、安装rpm包
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
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
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
elfutils-libelf-devel-0.164-2.el6 (x86_64)
pdksh-5.2.14-37.el5_8.1 (x86_64)

三、数据库安装

  1. 编辑文件/etc/hosts添加主机名及IP地址

    [root@slave ~]# vim /etc/hosts
    193.192.168.4.185 slave.com
    2.创建用户和组
    [root@slave ~]# groupadd -g 500 oinstall
    [root@slave ~]# groupadd -g 501 dba
    [root@slave ~]# useradd -g oinstall -G dba -u 500 oracle
    [root@slave ~]# passwd oracle
    Changing password for user oracle.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.

  2. 创建目录
    [root@slave ~]# mkdir -p /u01/app/oracle
    [root@slave ~]# mkdir -p /data/oradata
    [root@slave ~]# mkdir -p /backup/{expdbbackup,rmanbackup,onlinelog,archivelog,backupsh}
    [root@slave ~]# chown -R oracle:oinstall /u01
    [root@slave ~]# chown -R oracle:oinstall /data
    [root@slave ~]# chown -R oracle:oinstall /backup

  3. 扩大tmpfs
    oracle 11g引入了memory_target参数,memory_target 和 /dev/shm(即tmpfs)有紧密联系,tmpfs的大小制约了memory_target的使用范围
    1) 查看tmpfs大小(tmpfs默认的大小是物理内存的一半)
    [root@slave ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/centos-root 50G 1.2G 49G 3% /
    devtmpfs 5.8G 0 5.8G 0% /dev
    tmpfs 18G 0 18G 0% /dev/shm
    tmpfs 5.8G 8.7M 5.8G 1% /run
    tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
    /dev/sda1 1014M 143M 872M 15% /boot
    tmpfs 1.2G 0 1.2G 0% /run/user/0
    /dev/mapper/centos-u01 20G 45M 19G 1% /u01
    /dev/mapper/centos-data 50G 53M 47G 1% /data
    /dev/mapper/centos-backup 50G 53M 47G 1% /backup

2) 编辑/etc/fstab
[root@slave ~]# vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=18432M 0 0

3) 重新挂载
[root@slave ~]# mount -o remount /dev/shm

5.修改内核参数
1) 编辑/etc/sysctl.conf添加以下内容
[root@slave ~]# vim /etc/sysctl.conf
#oracle
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
#end
2) 执行sysctl -p命令使文件生效
[root@slave ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576

  1. 修改系统资源限制
    1) 编辑/etc/security/limits.conf添加以下内容
    [root@slave ~]# vim /etc/security/limits.conf
    #oracle
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    #end
    2) 编辑文件/etc/pam.d/login添加以下内容
    [root@slave ~]# vim /etc/pam.d/login
    #Oracle
    session required pam_limits.so
    #end
    3) 编辑/etc/profile文件添加以下内容
    [root@slave ~]# vim /etc/profile
    #oracle
    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
    #end
  2. 设置环境变量
    1) 在oracle用户下编辑文件.bash_profile添加以下内容
    [root@slave ~]# su - oracle
    [oracle@slave ~]$ vim .bash_profile
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    ORACLE_SID=oa
    PATH=$ORACLE_HOME/bin:$PATH
    export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

2) 执行source .bash_profile命令使环境变量生效
[oracle@slave ~]$ source .bash_profile

  1. 关闭Linux安全增强
    1) 编辑/etc/selinux/config修改SELINUX=disabled

2)执行setenforce 0不重启操作系统临时关闭selinux模式
[oracle@slave ~]$ setenforce 0

9.安装oracle
1) 上传安装文件
[root@slave ~]# cd /home/oracle/
[root@slave oracle]# ls
p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip

2) 解压
[root@slave oracle]# unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@slave oracle]# unzip p13390677_112040_Linux-x86-64_2of7.zip
[root@slave oracle]# ls
database p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
3) 使用Xshell远程登录执行runInstaller开始安装
[root@slave ~]# export DISPLAY=192.168.4.56:0.0
[root@slave ~]# su - oracle
Last login: Fri Jan 18 19:24:18 CST 2019 on pts/1
[oracle@slave ~]$ export DISPLAY=192.168.4.56:0.0
4)测试结果
[root@slave ~]# xhost +
access control disabled, clients can connect from any host
Last login: Fri Jan 18 19:30:13 CST 2019 on pts/0

[oracle@slave ~]$ cd database/
[oracle@slave database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 44343 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16383 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-01-18_07-43-51PM. Please wait ...[oracle@slave da
tabase]$

4) 启动安装界面
Centos7.5 安装oracle11g

5) 取消 I wish to receive security updates via my Oracle Support.勾选,点击下一步
Centos7.5 安装oracle11g
6) 此报错可以忽略,点击Yes,并点击下一步
Centos7.5 安装oracle11g
7) 选择Skip software updates,点击下一步
Centos7.5 安装oracle11g
8) 选择Create and configure a database,点击下一步
Centos7.5 安装oracle11g
9) 选择Server Class,点击下一步

Centos7.5 安装oracle11g
10) 选择Single instance database installation,点击下一步
Centos7.5 安装oracle11g
11) 选择Advanced install,点击下一步

Centos7.5 安装oracle11g
12) 选择语言English,点击下一步
Centos7.5 安装oracle11g
13) 选择Enterprise Edition,点击下一步

Centos7.5 安装oracle11g
14) 选择Oracle Base、Software Location路径,点击下一步
Centos7.5 安装oracle11g
15) 选择Inventory Directory,点击下一步
Centos7.5 安装oracle11g

16) 选择General Purpose/Transaction Processing,点击下一步
Centos7.5 安装oracle11g
17) 设置Global database name、Oracle Service Identifier,Global database name和Oracle Service Identifier保持一致,点击下一步
Centos7.5 安装oracle11g
18) 设置Memory,选择Enable Automatic Memory Management
Centos7.5 安装oracle11g
19) 设置Character sets,选择Use Unicode(AL32UTF8)
Centos7.5 安装oracle11g
20) 设置Security,保持默认选项
Centos7.5 安装oracle11g
21) 设置Sample Schemas,保持默认选项,点击下一步
Centos7.5 安装oracle11g
22) 保持默认选项,点击下一步
Centos7.5 安装oracle11g
23) 保持默认选项,点击下一步
Centos7.5 安装oracle11g
24) 保持默认选项,点击下一步
Centos7.5 安装oracle11g
25) 选择Use the same password for all accounts,设置密码(密码需参考密码管理规范),点击下一步
Centos7.5 安装oracle11g
26) Database Operator(OSOPER) Group(Optional)选择oinstall,点击下一步
Centos7.5 安装oracle11g
27) 安装程序进行配置检查
Centos7.5 安装oracle11g
28) 配置检查通过,点击Install
Centos7.5 安装oracle11g
39) 开始安装
Centos7.5 安装oracle11g
30) 报错
Centos7.5 安装oracle11g
解决办法:
[oracle@slave database]$ vi $ORACLE_HOME/sysman/lib/ins_emagent.mk

Search for the line
$(MK_EMAGENT_NMECTL)
Change it to:
$(MK_EMAGENT_NMECTL) -lnnz11
31) 创建数据库
Centos7.5 安装oracle11g
32) 创建数据库完成,点击Password Management修改sys,system用户密码,并确定OK。
Centos7.5 安装oracle11g
33)提示使用root用户执行两个shell脚本

Centos7.5 安装oracle11g
34) 执行shell脚本
[root@slave ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

[root@slave ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific roo

35) 单击OK,安装完成。

上一篇:Redhat6.8安装Oracle11g下遇到两个问题记录


下一篇:vim中的ctrl+s导致的“假死”、无响应、不接受输入