# cat /proc/version
Linux version 3.10.0-514.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version
4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Nov 22 16:42:41 UTC 2016
#cd /etc/sysconfig/network-scripts/ #切换路径
#vi ifcfg-ens33 #编辑你的网卡文件
-----------以下为文件中内容-----------
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" #设置静态的IP
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="51dd3e15-9ec2-4aeb-b1bf-f371da401511"
DEVICE="ens33"
ONBOOT="yes" #系统启动时激活网卡
IPADDR="192.168.233.99" #IP地址
PREFIX="24" #子网掩码
GATEWAY="192.168.233.2" #网关地址
DNS1="192.168.233.2" #DNS地址
IPV6_PRIVACY="no"
# vi /etc/hostname
-----------以下为文件中内容-----------
centos
# vi /etc/hosts
-----------以下为文件中内容-----------
192.168.233.99 centos
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
# vi /etc/redhat-release
-----------以下是文件内容-----------
redhat-7
# systemctl stop firewalld.service #临时关闭防火墙
# systemctl disable firewalld.service #禁止使用防火墙(重启也是禁止的)
# vi /etc/selinux/config
-----------以下为文件中内容-----------
# 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
注:重启系统使所有配置生效
# yum install -y net-tools vim* wget ntp telnet
# yum -y install xorg-x11-xauth xclock
# cat /etc/ssh/sshd_config
X11Forwarding yes
X11UseLocalhost no -- 禁止将X11转发请求绑定到本地回环地址上
AddressFamily inet -- 强制使用IPv4通道
# xclock
# yum install -y binutils compat-libcap1 compat-libstdc* gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc libstdc++ libstdc++-devel libXi libXtst make sysstat elfutils-libelf-devel unixODBC unixODBC-devel
官网CentOS7依赖说明
Oracle Linux 7和Red Hat Enterprise Linux 7 必须安装以下软件包(或更高版本),官方是这么说的:
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -g dba -m oracle
# passwd oracle #根据提示输入密码
# id oracle
uid=1002(oracle) gid=1003(dba) 组=1003(dba)
# mkdir -p /opt/data/oracle #oracle数据库安装目录
# mkdir -p /opt/data/oraInventory #oracle数据库配置文件目录
# mkdir -p /opt/data/database #oracle数据库软件包解压目录
# chown -R oracle:oinstall /opt/data/oracle/
# chown -R oracle:oinstall /opt/data/oraInventory/
# chown -R oracle:oinstall /opt/data/database
# vi /etc/sysctl.conf
-----------将以下内容根据实际情况修改后粘贴至文件中------------
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744 #设置最大打开文件数
fs.aio-max-nr = 1048576
kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024
kernel.shmmax = 7730941132 #单个段允许使用的大小,设置为内存的90%如:8*1024*1024*1024*90%
kernel.shmmni = 4096 #整个系统共享内存端的最大数,缺省值 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范围
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
# sysctl -p
# vi /etc/security/limits.conf
-----------将以下内容根据实际情况修改后粘贴至文件中------------
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /home/oracle/.bash_profile
-----------将以下内容根据实际情况修改后粘贴至文件中------------
export ORACLE_BASE=/data/oracle #oracle数据库安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle数据库路径
export ORACLE_SID=orcl #oracle启动数据库实例名
export ORACLE_TERM=xterm #xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系统环境变量
export LANG=C #防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致,如:ZHS16GBK,否则出现数据导入导出中文乱码问题
# source /home/oracle/.bash_profile
将Oracle两个安装包
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
上传至/usr/local/src/ 路径中
# cd /usr/local/src/ #切换到文件上传路径
# unzip linux.x64_11gR2_database_1of2.zip -d /opt/data
# unzip linux.x64_11gR2_database_2of2.zip -d /opt/data
# chown -R oracle:oinstall /opt/data/database
[oracle@centos ~]$ cd /opt/data/
[oracle@centos data]$ ls -al
total 0
drwxr-xr-x 5 root root 56 Sep 4 17:32 .
drwxr-xr-x. 4 root root 32 Sep 4 17:31 ..
drwxr-xr-x 8 oracle oinstall 128 Sep 4 19:00 database
drwxr-xr-x 2 oracle oinstall 6 Sep 4 17:31 oraInventory
drwxr-xr-x 2 oracle oinstall 6 Sep 4 17:31 oracle
# xclock
注:弹出小时钟在继续执行,如不弹出,使用MobaXterm直接以oracle用户登陆(使用su - oracle 切换可能某些变量不生效会报错导致无法弹出窗口)
# cd /opt/data/database #切换到安装文件路径下
# ./runInstaller
Win端弹出安装窗口
参照:https://jingyan.baidu.com/article/363872eccfb9266e4aa16f5d.html 安装即可
#/opt/data/oraInventory/orainstRoot.sh
#/opt/data/oracle/product/11.2.0/db_1/root.sh
# vi /etc/oratab
orcl:/opt/data/oracle/product/11.2.0/db_1:N
改为
orcl:/opt/data/oracle/product/11.2.0/db_1:Y
注:orcl为实例名/opt/data/oracle/product/11.2.0/db_1为安装的$ORACLE_HOME,根据情况自行修改。
$ vi $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTNER=$1
改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
$ vi $ORACLE_HOME/bin/dbshut
ORACLE_HOME_LISTNER=$1
改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
# vi /etc/rc.d/rc.local
------------将以下内容写入文件末尾--------------
su oracle -lc dbstart
# chmod +x /etc/rc.d/rc.local
# cat /etc/rc.d/rc.local
-------------------------------------------------
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
----------------------------------------------------
翻译一下:
这个文件是为了兼容性的目的而添加的,
建议创建自己的systemd服务或udev规则来在开机引导时运行脚本而不是使用这个文件。
与以前的版本引导时的并行执行相比较,这个脚本将不会在其他所有的服务后执行。
请记住,你必须执行“chmod +x /etc/rc.d/rc.local”来确保确保这个脚本在引导时执行。
$ lsnrctl status
$ ps -ef | grep ora