1. 分配给临时文件系统的磁盘空间
临时目录中至少有1 GB的空间。Oracle建议2 GB或更多
2. 交换相对于RAM的空间分配
4 GB到16 GB之间:等于RAM的大小
超过16 GB:16 GB
3. 验证共享内存(/dev/shm)是否已正确安装且大小足够
> SGA+PGA 或 =物理内存*50%
1.所需软件介绍
序号 | 类型 | 内容 |
---|---|---|
1 | 数据库 | p13390677_112040_Linux-x86-64_1of7.zip,p13390677_112040_Linux-x86-64_2of7.zip |
2 | 操作系统 | OracleLinux-R7-U6-Server-x86_64-dvd.iso |
3 | 虚拟机软件 | VMware? Workstation 12 Pro 12.5.9 build-7535481 |
4 | 工具 | Xmanager Enterprise 5 |
5 | 工具 | rlwrap-0.42 (用于记录sqlplus、rman等命令的历史记录) |
2.IP地址规划
主机名 | IP接口名稱 | 地址类型 | IP 地址 | 注册位置 |
---|---|---|---|---|
xag138 | xag138 | DB | 192.168.40.138 | /etc/hosts |
3.操作系统本地磁盘分区规划
序号 | 分区名称 | 大小 | 用途说明 |
---|---|---|---|
1 | /boot | 200MB | 引导分区 |
2 | /tmp | 4G | 临时空间 |
3 | /home | 4G | 所有用户的home目录 |
4 | swap | 8G | 交换分区(物理內存小於8G則 *2 反之 同物理內存 |
5 | / | 38G | 根分区 oracle和grid的安装目录 |
4.網卡配置
[root@xag138 ~]# cd /etc/sysconfig/network-scripts/
[root@xag138 network-scripts]# cat ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="ens33"
UUID="0224e944-0b68-47d5-b327-71d0e5560845"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.40.138"
GATEWAY="192.168.40.2"
NETMASK="255.255.255.0"
DNS1="8.8.8.8"
#重啟網卡
[root@xag138 network-scripts]# service network restart
5.禁用防火墙
#关闭firewall:停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
6.安裝基本工具
[root@XAG138 ~]# yum -y install nano vim wget curl net-tools lsof zip unzip
#安裝rlwrap
[root@XAG138 ~]# cd /usr/local/src
[root@XAG138 src]# pwd
/usr/local/src
[root@XAG138 src]# yum -y install perl autoconf
[root@XAG138 src]# wget http://www.rpmfind.net/linux/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm
[root@XAG138 src]# rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
7.配置主机名
[root@xag138 ~]# cat /etc/hostname
xag138
[root@xag138 java]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=xag138
vim /etc/hosts
#增加如下
192.168.40.138 xag138
8.Automatic Setup(自动配置)
[root@xag138 ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
[root@xag138 ~]# yum install oracle-rdbms-server-11gR2-preinstall
[root@xag138 /]# cat /etc/security/limits.conf
# oracle-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024
oracle soft nofile 1024
# oracle-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536
oracle hard nofile 65536
# oracle-rdbms-server-11gR2-preinstall setting for nproc soft limit is 16384
# refer orabug15971421 for more info.
oracle soft nproc 16384
# oracle-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384
oracle hard nproc 16384
# oracle-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KB
oracle soft stack 10240
# oracle-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KB
oracle hard stack 32768
oracle hard memlock 134217728
# oracle-rdbms-server-11gR2-preinstall setting for memlock hard limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM
oracle soft memlock 134217728
#### 修改
将
oracle soft nofile 1024
改成
oracle soft nofile 16384
[root@xag138 /]# cat /etc/sysctl.conf
# oracle-rdbms-server-11gR2-preinstall setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-rdbms-server-11gR2-preinstall setting for kernel.sem is ‘250 32000 100 128‘
kernel.sem = 250 32000 100 128
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386
kernel.shmall = 1073741824
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmax is 4294967295 on i386
kernel.shmmax = 4398046511104
# oracle-rdbms-server-11gR2-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-rdbms-server-11gR2-preinstall setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-rdbms-server-11gR2-preinstall setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-rdbms-server-11gR2-preinstall setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-rdbms-server-11gR2-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
#可选项
[root@xag138 ~]# yum update
9.Additional Setup
#编辑 /etc/selinux/config
[root@xag138 /]# cat /etc/selinux/config
#SELINUX=enforcing
#SELINUXTYPE=targeted
SELINUX=permissive
#生效
[root@xag138 /]# setenforce Permissive
#oracle用户的登录密码,后续登录要用,记着。
echo "123456" | passwd --stdin oracle
#设置密码永不过期
chage -M -1 oracle
chage -l oracle
[root@xag138 /]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
10.创建目录
mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
mkdir -p /u02/oradata/
chown -R oracle:oinstall /u02
chmod -R 775 /u02
11.配置/dev/shm大小
#验证共享内存是否已正确安装且大小足够
# > SGA+PGA 或 =物理内存*50%
vim /etc/fstab
#修改/dev/shm的大小
修改/etc/fstab的这行: 默认的:
tmpfs /dev/shm tmpfs defaults 0 0
改成:
tmpfs /dev/shm tmpfs defaults,size=4G 0 0
#重新mount /dev/shm使之生效:
mount -o remount /dev/shm
df -h
...
tmpfs 4.0G 0 4.0G 0% /dev/shm
...
12.创建scripts 目录及setEnv.sh文件(从此处开始无特别说明都是在oracle用户下操作)
[oracle@xag138 ~]$ mkdir /home/oracle/scripts
#创建 setEnv.sh 文件 [不同机器上 ORACLE_ 的 HOSTNAME、UNQNAME、SID 不同]
----------------------------------------------------------------------
cat > /home/oracle/scripts/setEnv.sh <<EOF
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=xag138; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB138; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME
ORACLE_SID=DB138; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
alias sqlplus=‘rlwrap sqlplus‘
alias rman=‘rlwrap rman‘
EOF
=================================================================
[oracle@xag138 ~]$ cat /home/oracle/scripts/setEnv.sh
TMP=/tmp; export TMP
TMPDIR=/tmp; export TMPDIR
ORACLE_HOSTNAME=xag138; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB138; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1; export ORACLE_HOME
ORACLE_SID=DB138; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:/u01/app/oracle/product/11.2.0.4/db_1/bin:/usr/sbin:/u01/app/oracle/product/11.2.0.4/db_1/bin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin; export PATH
PATH=/u01/app/oracle/product/11.2.0.4/db_1/bin:/u01/app/oracle/product/11.2.0.4/db_1/bin:/usr/sbin:/u01/app/oracle/product/11.2.0.4/db_1/bin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin; export PATH
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.4/db_1/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=/u01/app/oracle/product/11.2.0.4/db_1/JRE:/u01/app/oracle/product/11.2.0.4/db_1/jlib:/u01/app/oracle/product/11.2.0.4/db_1/rdbms/jlib; export CLASSPATH
alias sqlplus=‘rlwrap sqlplus‘
alias rman=‘rlwrap rman‘
#Add a reference to the "setEnv.sh" file at "/home/oracle/.bash_profile" file
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
#生效
source /home/oracle/.bash_profile
#Create a "start_all.sh" and "stop_all.sh" script
---------------------------------------------------------------
cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF
---------------------------------------------------------------
cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbshut \$ORACLE_HOME
EOF
=====================================================
chown -R oracle.oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh
13.解压
[oracle@xag138 setup]$ pwd
/u01/setup
[oracle@xag138 setup]$ ls
p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@xag138 setup]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@xag138 setup]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@xag138 setup]$ rm p13390677_112040_Linux-x86-64_1of7.zip
[oracle@xag138 setup]$ rm p13390677_112040_Linux-x86-64_2of7.zip
14.安装
[oracle@xag138 database]$ pwd
/u01/setup/database
[oracle@xag138 database]$ ls
install readme.html response rpm runInstaller sshsetup stage welcome.html
[oracle@xag138 database]$ export DISPLAY=192.168.0.7:0.0
[oracle@xag138 database]$ ./runInstaller