VM_Centos7.3_X64_安装Oracle12C 总结笔记
声明:本文居多内容参考原文来之网络;
一:安装Centos7.3 虚拟机
1:操作系统下载
CentOS 7官方下载地址:https://www.centos.org/download/
说明:本案例使用的CentOS-7-x86_64-Everything-1611.iso版本安包
以下针对各个版本的ISO镜像文件,进行一一说明:
CentOS-7.0-x86_64-DVD-1503-01.iso 标准安装版,一般下载这个就可以了(推荐)
CentOS-7.0-x86_64-NetInstall-1503-01.iso 网络安装镜像(从网络安装或者救援系统)
CentOS-7.0-x86_64-Everything-1503-01.iso 对完整版安装盘的软件进行补充,集成所有软件。(包含centos7的一套完整的软件包,可以用来安装系统或者填充本地镜像)
CentOS-7.0-x86_64-GnomeLive-1503-01.iso GNOME桌面版
CentOS-7.0-x86_64-KdeLive-1503-01.iso KDE桌面版
CentOS-7.0-x86_64-livecd-1503-01.iso 光盘上运行的系统,类拟于winpe
CentOS-7.0-x86_64-minimal-1503-01.iso 精简版,自带的软件最少
2:VM虚拟机 下载及安装
1:VM 安装包下载:http://sw.bos.baidu.com/sw-search-sp/software/ca7ad8c6d3103/VMware-workstation-full-14.0.0.24051.exe
注:其注册码自己百度
2:VM 程序安装教程:请查看《vmware workstation 12 pro 虚拟机安装系统教程》
3:VM 虚拟机安装 Centos7.3 系统
1: 请查看《CentOS 7.3 安装》
2:在系统重启后出现了 lic 等错误配置信息。请自己百度
4:配置静态ip地址:
1:请参考此文:《centos 7.3 设置静态IP》
5:搭建yum 环境:
1:请参考此文:《 CentOS7.2 创建本地YUM源和局域网YUM源 》
二 :Oracle12C数据库安装
1:安装包下载
1:安装步骤参考了此文:《 Linux 平台安装Oracle Database 12c 》
官方的下载地址:
1:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
2:https://edelivery.oracle.com/EPD/Download/get_form?egroup_aru_number=16496132
URL地址2需要先注册,然后才能登陆下载,注册登陆界面https://edelivery.oracle.com
关于这两者有啥区别: 听一个同事说,用metalink 账号下载的安装文件完整一些。具体情况是不是如此,还不得而知。
地址1下载的文件为:
linuxamd64_12c_database_1of2.zip
linuxamd64_12c_database_2of2.zip
地址2下载的文件为:
V38500-01_1of2.zip
V38500-01_2of2.zip
2)检查硬件要求(Check Hardware Requirements)
1 Check CPU
1 [root@localhost ~]# grep "model name" /proc/cpuinfo 2 model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 3 model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 4 model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 5 model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 6 [root@localhost ~]# 7 [root@localhost ~]# cat /proc/cpuinfo | grep "processor" | wc -l 8 4 9 [root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 10 2 11 [root@localhost ~]#
2 Check Memory
1 root@localhost ~]# grep MemTotal /proc/meminfo 2 MemTotal: 3587024 kB 3 [root@localhost ~]# grep SwapTotal /proc/meminfo 4 SwapTotal: 3801084 kB 5 [root@localhost ~]# free -g 6 total used free shared buff/cache available 7 Mem: 3 0 0 0 2 2 8 Swap: 3 0 3 9 [root@localhost ~]#
Oracle 12c 对系统内存的最低要求为1G,推荐2G或更大的内存,从上面结果可以知道系统内存23G,完全满足要求。
Oracle对交换分区(Swap Space)的推荐设置如下,这里Swap Space为35G,不是16G,需要做一下调整。
3 Check Disk Capacity
1 [root@localhost ~]# df -h 2 Filesystem Size Used Avail Use% Mounted on 3 /dev/mapper/cl-root 50G 6.9G 44G 14% / 4 devtmpfs 1.7G 0 1.7G 0% /dev 5 tmpfs 1.8G 140K 1.8G 1% /dev/shm 6 tmpfs 1.8G 9.0M 1.8G 1% /run 7 tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup 8 /dev/sda1 1014M 173M 842M 18% /boot 9 /dev/mapper/cl-home 969G 33M 969G 1% /home 10 tmpfs 351M 40K 351M 1% /run/user/0 11 /dev/sr0 7.8G 7.8G 0 100% /run/media/root/CentOS 7 x86_64 12
3: 检查软件要求(Checking the Software Requirements)
用于Oracle Linux 7和Red Hat Enterprise Linux 7的软件包
必须安装以下软件包(或更高版本):
1 binutils-2.23.52.0.1-12.el7.x86_64 2 compat-libcap1-1.10-3.el7.x86_64 3 compat-libstdc++-33-3.2.3-71.el7.i686 4 compat-libstdc++-33-3.2.3-71.el7.x86_64 5 gcc-4.8.2-3.el7.x86_64 6 gcc-c++-4.8.2-3.el7.x86_64 7 glibc-2.17-36.el7.i686 8 glibc-2.17-36.el7.x86_64 9 glibc-devel-2.17-36.el7.i686 10 glibc-devel-2.17-36.el7.x86_64 11 ksh 12 libaio-0.3.109-9.el7.i686 13 libaio-0.3.109-9.el7.x86_64 14 libaio-devel-0.3.109-9.el7.i686 15 libaio-devel-0.3.109-9.el7.x86_64 16 libgcc-4.8.2-3.el7.i686 17 libgcc-4.8.2-3.el7.x86_64 18 libstdc++-4.8.2-3.el7.i686 19 libstdc++-4.8.2-3.el7.x86_64 20 libstdc++-devel-4.8.2-3.el7.i686 21 libstdc++-devel-4.8.2-3.el7.x86_64 22 libXi-1.7.2-1.el7.i686 23 libXi-1.7.2-1.el7.x86_64 24 libXtst-1.2.2-1.el7.i686 25 libXtst-1.2.2-1.el7.x86_64 26 make-3.82-19.el7.x86_64 27 sysstat-10.1.5-1.el7.x86_64
执行脚本
1 yum install binutil* -y 2 yum install compat* -y 3 yum install gcc* -y 4 yum install glibc* -y 5 yum install ksh* -y 6 yum install libaio* -y 7 yum install libgcc* -y 8 yum install libstd* -y 9 yum install libXi* -y 10 yum install libXtst* -y 11 yum install make* -y 12 yum install sysstat* -y
binutils-2.25.1-22.base.el7.x86_64
package compat-libstdc++ is not installed
gcc-4.8.5-11.el7.x86_64
gcc-c++-4.8.5-11.el7.x86_64
glibc-2.17-157.el7.x86_64
glibc-devel-2.17-157.el7.x86_64
package ksh is not installed
libaio-0.3.109-13.el7.x86_64
package libaio-devel is not installed
libgcc-4.8.5-11.el7.x86_64
libstdc++-4.8.5-11.el7.x86_64
libstdc++-devel-4.8.5-11.el7.x86_64
libXext-1.3.3-3.el7.x86_64
libXtst-1.2.2-2.1.el7.x86_64
libX11-1.6.3-3.el7.x86_64
libXau-1.0.8-2.1.el7.x86_64
libXi-1.7.4-2.el7.x86_64
make-3.82-23.el7.x86_64
sysstat-10.1.5-11.el7.x86_64
4 :系统配置准备
1 创建Oracle用户和用户组(注:我这里没有设置oracle用户的密码:如果有需要 请直接用root用户进行 passwd oracle 的命令为oracle用户设置一个密码)
1 [root@localhost ~]# groupadd dba 2 [root@localhost ~]# groupadd oinstall 3 [root@localhost ~]# useradd -g oinstall -G dba oracle 4 [root@localhost ~]# id oracle 5 uid=1001(oracle) gid=1002(oinstall) groups=1002(oinstall),1001(dba) 6 [root@localhost ~]# 7
2 创建安装目录
1 root@localhost ~]# mkdir -p /u01/app/oracle 2 [root@localhost ~]# chown -R oracle:oinstall /u01/app/oracle 3 [root@localhost ~]# chmod -R 775 /u01/app/oracle
3 CentOS7关闭防火墙和selinux
1 [root@localhost ~]# /usr/sbin/sestatus 2 SELinux status: enabled 3 SELinuxfs mount: /sys/fs/selinux 4 SELinux root directory: /etc/selinux 5 Loaded policy name: targeted 6 Current mode: enforcing 7 Mode from config file: disabled 8 Policy MLS status: enabled 9 Policy deny_unknown status: allowed 10 Max kernel policy version: 28 11 [root@localhost ~]# setenforce 0 12 [root@localhost ~]# /usr/sbin/sestatus 13 SELinux status: enabled 14 SELinuxfs mount: /sys/fs/selinux 15 SELinux root directory: /etc/selinux 16 Loaded policy name: targeted 17 Current mode: permissive 18 Mode from config file: disabled 19 Policy MLS status: enabled 20 Policy deny_unknown status: allowed 21 Max kernel policy version: 28
1 [root@localhost ~]# systemctl stop firewalld 2 [root@localhost ~]# systemctl disable firewalld 3 Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. 4 Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. 5 [root@localhost ~]# systemctl status firewalld 6 鈼?firewalld.service - firewalld - dynamic firewall daemon 7 Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) 8 Active: inactive (dead) 9 Docs: man:firewalld(1) 10 11 Dec 13 20:01:29 localhost.localdomain systemd[1]: Starting firewalld - dynamic fire.... 12 Dec 13 20:01:32 localhost.localdomain systemd[1]: Started firewalld - dynamic firew.... 13 Dec 13 22:07:20 localhost.localdomain systemd[1]: Stopping firewalld - dynamic fire.... 14 Dec 13 22:07:21 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firew.... 15 Hint: Some lines were ellipsized, use -l to show in full. 16 [root@localhost ~]# cat /etc/selinux/config 17 18 # This file controls the state of SELinux on the system. 19 # SELINUX= can take one of these three values: 20 # enforcing - SELinux security policy is enforced. 21 # permissive - SELinux prints warnings instead of enforcing. 22 # disabled - No SELinux policy is loaded. 23 #SELINUX=enforcing 24 SELINUX=disabled 25 # SELINUXTYPE= can take one of three two values: 26 # targeted - Targeted processes are protected, 27 # minimum - Modification of targeted policy. Only selected processes are protected. 28 # mls - Multi Level Security protection. 29 SELINUXTYPE=targeted 30 31 32 [root@localhost ~]# reboot
----检查结果:
1 [root@localhost ~]# /usr/sbin/sestatus 2 SELinux status: disabled 3 [root@localhost ~]# /usr/sbin/getenforce 4 Disabled 5 [root@localhost ~]#
4 修改系统内核参数
在修改系统内核参数前,你可以用命令先查看一下当前各类系统参数的值,亦或直接查看配置文件/etc/sysctl.conf
1 [root@localhost ~]# getconf PAGESIZE 2 4096 3 [root@localhost ~]# sysctl -a | grep sem 4 kernel.sem = 250 32000 32 128 5 kernel.sem_next_id = -1 6 [root@localhost ~]# sysctl -a | grep shm 7 kernel.shm_next_id = -1 8 kernel.shm_rmid_forced = 0 9 kernel.shmall = 18446744073692774399 10 kernel.shmmax = 18446744073692774399 11 kernel.shmmni = 4096 12 vm.hugetlb_shm_group = 0 13 [root@localhost ~]# sysctl -a | grep file-max 14 fs.file-max = 378794 15 [root@localhost ~]# sysctl -a | grep ip_local_port_range 16 net.ipv4.ip_local_port_range = 32768 60999 17 [root@localhost ~]#
关于内核参数的一些设置建议,可以参考下面资料:.
1 kernel.shmmax 2 3 关于内核参数kernel.shmmax,oracle 建议,kernel.shmmax的值不能少于物理内存的一半,而且要大于Oracle中sga-max-size的值,否则会造成oracle性能下降 4 5 一般32bit操作系统,直接设置为系统支持的最大内存即可,64bit操作系统设置大于sga-max-size的值即可 6 7 如:当前内存为2G 则kernel.shmmax = 2*1024*1024=2097152 8 9 当前内存为8G则 kernel.shmmax = 7*1024*1024=7340032 10 11 Kernel.shmall 12 13 Shmall指系统一次可以使用的共享内存段的最大数量,以页为单位。Oracle默认设置为 kernel.shmall = 2097152 14 15 即最大8G(2097152*4/1024/1024),(在调整SGA时需要注意,SGA大小设置不可超过该值),根据系统内存大小和使用的不同可以参考如下:设置的一般规律 16 17 kernel.shmall = 8G/4k=8388608k/4k=2097152 ---内存8G 18 19 kernel.shmall = 16G/4k=16777216k/4k=4194304 ---内存16G 20 21 kernel.shmall = 32G/4k=33554432k/4k=8388608 ---内存32G 22 23 (RedHat linux系统中页大小为4096即4K,实际环境以getconf PAGE_SIZE结果为准) 24 25 kernel.shmmni 26 27 shmmni 指系统共享内存段的最大数量 28 29 oracle设置默认值为4096,一般是足够用了,不需要调整 30 31 文件句柄数的相关内核参数设置 32 33 fs.file-max 34 35 fs.file-max指系统能够打开最大的文件句柄数 36 37 oracle建议设置为65536,一般不用修改 38 39 信号的相关内核参数设置 40 41 kernel.sem 42 43 kernel.sem是指 semmsl,semmns,semopm,semmni这4个参数 44 45 semmsl 指每个线号集的最大信号数,Oracle建议是设置为oracle的最大进程数+10 46 47 semmni 指整个系统的信号集的最大数量 48 49 semmns 指整个系统的信号总数,也就是semmni*semmsl的结果 50 51 semopm 指每个semop系统调用可以执行的信号操作的最大数量 52 53 oracle默认设置 54 55 semmsl=250 56 57 semmns=3200 58 59 semopm=100 60 61 semmni=128 62 63 即kernel.sem= 250 3200 100 128 64 65 例:在oracle ora.init文件参数中设置PROCESSES参数为5000 66 67 则semmsl=5010,semmni=128,semmns=semmsl* semmni=641280 68 69 另外semopm建议设置等于semmsl值即5010 70 71 那么kernel.sem=5010 641280 5010 128 72 73 网络相关的内核参数设置 74 75 net.core.rmem_default 76 77 net.core.rmem_default 指网络套接字的默认接收缓冲区的大小,oracle建议设置为265K即262144 78 79 net.core.rmem_max 80 81 net.core.rmem_max 指网络套接字的最大接收缓冲区的大小,oracle10g及以前版本建议设置为256k即262144 82 83 oracle11g建议设置为4M 即4194304 84 85 net.core.wmem_default 86 87 net.core.wmem_default指网络套接字的默认发送缓冲区的大小,oracle建议设置为265K即262144 88 89 net.core.wmem_max 90 91 net.core.wmem_max 指网络套接字的最大发送缓冲区的大小,oracle10g及以前版本建议设置为256k即262144 92 93 oracle11g建议设置为1M即1048576 94 95 net.ipv4.ip_local_port_range 96 97 net.ipv4.ip_local_port_range ,指本地的允许打开随机端口范围 98 99 oracle10g前建议端口范围为1024 65000,oracle11g建议端口范围为: 100 65500 并忽略oracle安装程序任何关于这个参数的警告 101 102 Asynchronous I/O相关的内核参数设置 103 104 fs.aio-max-nr 105 106 fs.aio-max-nr 指系统允许的最大的异步IO请求大小 107 108 oracle默认设置为1M即1048576,一般不用更改
修改前最后先备份一下/etc/sysctl.conf,以防万一。
1 [root@localhost ~]# cd /etc/sysc 2 sysconfig/ sysctl.d/ 3 [root@localhost ~]# cd /etc/ 4 [root@localhost etc]# cat sysctl.conf 5 # sysctl settings are defined through files in 6 # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. 7 # 8 # Vendors settings live in /usr/lib/sysctl.d/. 9 # To override a whole file, create a new file with the same in 10 # /etc/sysctl.d/ and put new settings there. To override 11 # only specific settings, add a file with a lexically later 12 # name in /etc/sysctl.d/ and put new settings there. 13 # 14 # For more information, see sysctl.conf(5) and sysctl.d(5). 15 [root@localhost etc]# cp sysctl.conf sysctl.conf.bak 16 [root@localhost etc]# 17 #-----在 sysctl.conf 文档下方增加上以下内容