
官方安装文档:https://docs.oracle.com/database/121/LTDQI/toc.htm#BHCCADGD
1.软件准备
oracle12c.zip 安装包
VMware 虚拟机
redhat7.0 系统
Xmanagement
2. 在VMware下安装redhat7.0系统
注:硬盘80GB
- 我的标准分区/boot :200M swap:2000M /:20000M
- 推荐LVM 逻辑分区
3.配置linux7.0
3.1 IP 网关 配置:手动固定ip
[root@localhost ~]# nmcli conn modify eno16777736 ipv4.addresses '192.168.144.128/24 192.168.144.1'
[root@localhost ~]# nmcli conn modify eno16777736 ipv4.method manual
[root@localhost ~]# nmcli conn modify eno16777736 connection.autoconnect yes
3.2 配置ssh服务端,停止在链接的ssh的时候启用dns解析
vim /etc/ssh/sshd_config
#UseDNS yes
UseDNS no
3.3 禁用防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
3.4 禁用selinux
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]#
[root@localhost ~]# setenforce 0
[root@localhost ~]#
[root@localhost ~]# vim /etc/selinux/
SELINUX=permissive
3.5 完成后重启
[root@localhost ~]# reboot
4.检查硬件环境
# 内存大小
[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal: kB # swap大小
[root@localhost ~]# grep SwapTotal /proc/meminfo
SwapTotal: kB # tmp文件夹大小
[root@localhost ~]# df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 % / # 磁盘大小
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 20G .8G 16G % /
devtmpfs .0G .0G % /dev
tmpfs .0G 84K .0G % /dev/shm
tmpfs .0G 8.9M .0G % /run
tmpfs .0G .0G % /sys/fs/cgroup
/dev/sda1 197M 101M 97M % /boot
/dev/sr0 .5G .5G % /run/media/root/RHEL-7.0 Server.x86_64 # cpu
[root@localhost ~]# grep "model name" /proc/cpuinfo
model name : AMD A8-4500M APU with Radeon(tm) HD Graphics
model name : AMD A8-4500M APU with Radeon(tm) HD Graphics
model name : AMD A8-4500M APU with Radeon(tm) HD Graphics
model name : AMD A8-4500M APU with Radeon(tm) HD Graphics
5. 安装linux7的包
Oracle Linux 7和红帽企业Linux 7 包
下面的包(或更新版本)必须安装:
6.安装额外的驱动程序和软件包
[root@localhost ~]# vim /etc/yum.repos.d/base.repo
[base]
name=base
baseurl=file:///mnt
enable=1
gpgcheck=0
[root@localhost ~]# yum clean all
[root@localhost ~]# mount /dev/sr0 /mnt
[root@localhost ~]# yum install -y compat-libcap1 glibc-devel ksh libaio-devel libstdc++-devel gcc gcc-c++ unixODBC
# 开放数据库连接
Open Database Connectivity (ODBC)
Open Database Connectivity (ODBC) is a set of database access APIs that
connect to the database, prepare, and then run SQL statements on the
database. An application that uses an ODBC driver can access non-uniform
data sources, such as spreadsheets and comma-delimited files. # 安装Oracle的ODBC驱动程序
yum install unixODBC-2.3.1
7.系统组oinstall和用户oracle
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
[root@localhost ~]# echo oracle | passwd --stdin oracle
[root@localhost ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
8.检查内核参数,资源限制
1、共享内存
[root@localhost ~]# vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 429496729
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576 生效该内核参数
[root@localhost ~]# sysctl -p
2.资源限制
[root@localhost ~]# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
9.创建必要的目录
Oracle基目录
一个可选的Oracle数据文件目录
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 20G 3.8G 16G 20% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 84K 2.0G 1% /dev/shm
tmpfs 2.0G 8.9M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 197M 101M 97M 52% /boot
/dev/sr0 3.5G 3.5G 0 100% /run/media/root/RHEL-7.0 Server.x86_64
Oracle基目录必须有空闲磁盘空间3 GB或4 GB的可用磁盘空间
/u01目录扩容
[root@localhost ~]# fdisk /dev/sda # 至少26G +
[root@localhost ~]# partprobe
[root@localhost ~]# mkfs.xfs /dev/sda5
[root@localhost ~]# mount /dev/sda5 /u01
[root@localhost ~]# blkid
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# mount -a
[root@localhost ~]# mount
检查需要的目录,权限
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R /u01/app/
注:权限修改不对,安装时会出现错误
10.执行xhost +
xhost + 是使所有用户都能访问Xserver.
[root@localhost oracle]# xhost +
access control disabled, clients can connect from any host
[root@localhost oracle]#
11. 复制安装文件到系统
[root@localhost ~]# cd /home/oracle/
[root@localhost oracle]#
[root@localhost oracle]# ll
total 3372752
-rw-r--r--. 1 root root 3453696911 Aug 7 22:13 ORACLE12C.zip
[root@localhost oracle]# unzip ORACLE12C.zip [root@localhost oracle]# chmod 777 database/ -R
[root@localhost oracle]# chown oracle:oinstall database/ -R
12.重启
注:没有重启的话,出现错误
12.开始 安装oracle12C:oracle用户登录
1.)oracle用户登录执行
[oracle@localhost ~]$ cd database/ [oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 9085 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1999 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
le@localhost database]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2017-08-07_10-18-09PM.log
[oracle@localhost database]$
2)安装步骤选项
3)执行脚本
- 安装停下的话,出现以下界面 用root用户登录,执行脚本
[root@localhost ~]# cd /home/oracle/
[root@localhost oracle]# cd database/
[root@localhost database]# /u01/app/oraInventory/orainstRoot.sh
[root@localhost database]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
注:执行第二个脚本,还要下一步,下一步,不然,无法成功安装数据库命令
13.安装成功
- 进入SQL,oracle登录,进入
[oracle@localhost database]$ . oraenv ORACLE_SID = [oracle] ? oracle01 # 数据库名称
The Oracle base has been set to /u01/app/oracle [oracle@localhost database]$ sqlplus / as sysdba
SQL> select instance_name,status from v$instance; #查看数据库,名称状态