1、 环境信息
系统版本:Red Hat Enterprise Linux Server release 6.8 (Santiago)
Oracle版本:Release 11.2.0.3.0
VMware Workstation 15 Pro
2、安装准备
2.1、系统安装
网上教程一大堆,请自行百度。
省略。。。
安装是请选择
Desktop
,后期自己安装的时候,容易出错。
2.2、系统配置
2.2.1、关闭防火墙
[root@node ~]# chkconfig iptables off
[root@node ~]# chkconfig ip6tables off
[root@node ~]# chkconfig --list | grep ip
ip6tables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@node ~]#
2.2.2、关闭selinux
[root@node ~]# getenforce
enforcing
[root@node ~]#
[root@node ~]# 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
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@node ~]# getenforce
Disabled
[root@node ~]# sestatus
SELinux status: disabled
2.2.3、网络配置
我习惯配置两张网卡。
-
连接互联网,使用外网yum,下载安装包等作用
-
配置回环网卡,上传安装包,ssh,telnet等。
2.2.4、 /etc/hosts
将
IP
,
主机名
映射关系写入到文件。
[root@node ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.201 node
[root@node ~]#
[root@node ~]# ping node
PING node (192.168.200.201) 56(84) bytes of data.
64 bytes from node (192.168.200.201): icmp_seq=1 ttl=64 time=0.533 ms
^C
--- node ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 676ms
rtt min/avg/max/mdev = 0.533/0.533/0.533/0.000 ms
[root@node ~]#
2.3、Oracle安装
2.3.1、依赖包安装
我在这一步卡了很久,幸好我给虚拟机打了快照,要不然就重新安装系统不知道多少次。心情极其不美丽。。。。。。
安装后检查,没有安装的再次安装。
[root@node ~]# yum install -y binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat elfutils-libelf-devel compat-db cpp glibc-headers libstdc++ elfutils-libelf unixODBC unixODBC-devel bison xclock glibc.i686 libXext.i686 flex glibc-devel.i686 libstdc++-devel.i686 libaio.i686 libaio-devel.i686
[root@node ~]#
[root@node ~]# rpm -q binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat elfutils-libelf-devel compat-db cpp glibc-headers libstdc++ elfutils-libelf unixODBC unixODBC-devel bison xclock glibc.i686 libXext.i686 flex glibc-devel.i686 libstdc++-devel.i686 libaio.i686 libaio-devel.i686 | grep "not installed"
package compat-libstdc++ is not installed
package xclock is not installed
[root@node ~]#
2.3.2、上传软件包
将准备好的软件包上传到系统中。
这里就不赘述了。
2.3.3、 创建用户、组
[root@node ~]# groupadd oinstall
[root@node ~]# groupadd dba
[root@node ~]# groupadd oper
[root@node ~]#
[root@node ~]# useradd -g oinstall -G dba,oper oracle
[root@node ~]# echo "oracle" | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[root@node ~]#
[root@node ~]#
[root@node ~]# mkdir -pv /u01/app/oracle
mkdir: created directory `/u01'
mkdir: created directory `/u01/app'
mkdir: created directory `/u01/app/oracle'
[root@node ~]# chown oracle:oinstall -R /u01
[root@node ~]#
[root@node ~]#
2.4、配置变量
2.4.1、用户Oracle变量
[root@node ~]# su - oracle
[oracle@node ~]$
[oracle@node ~]$ cat .bash_profile
... ...
... ...
... ...
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
export ORACLE_SID=PROD
export PATH=${ORACLE_HOME}/bin:${PATH}
[oracle@node ~]$
2.4.2、/etc/sysctl.conf
[oracle@node ~]$ cat /etc/sysctl.conf | grep -v ^# | sed '/^$/d'
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 1073741823
kernel.shmall = 2097152
fs.aio-max-nr=1048576
fs.file-max=6815744
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@node u01]#
[root@node u01]# sysctl -p # 使配置生效
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 1073741823
kernel.shmall = 2097152
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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@node u01]#
2.4.3、/etc/security/limits.conf
[root@node u01]# cat /etc/security/limits.conf
... ...
... ...
... ...
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
2.4.4、/etc/pam.d/login
[root@node ~]# cat /etc/pam.d/login
... ...
... ...
... ...
session required pam_limits.so
[root@node ~]#
2.5、压缩包解压
[root@node u01]# unzip p10404530_112030_LINUX_1of7.zip
Archive: p10404530_112030_LINUX_1of7.zip
creating: database/
inflating: database/welcome.html
... ...
[root@node u01]# unzip p10404530_112030_LINUX_2of7.zip
... ...
[root@node u01]# chown oracle:oinstall database/ -R
[root@node u01]#
3、Oracle安装
使用新创建的用户:
oracle
,登陆系统。
[root@node database]# pwd
/u01/database
[root@node database]# ./runInstaller
执行完后,点击 close,此时 oracle 软件已经安装好了
4、建库、监听
[oracle@node ~]$ netca
一路点击下一步,咔咔咔,完事。
[oracle@node ~]$ dbca
SID与Oracle变量文件中写的保持一致。
可以一路下一步,也可以做相应的设置
5、 验证
[oracle@node ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 15 21:55:03 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL>
YUM安装历史
[root@node ~]# yum history
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
8 | root <root> | 2021-04-15 02:08 | Install | 2
7 | root <root> | 2021-04-15 01:28 | Install | 3
6 | root <root> | 2021-04-15 01:27 | Install | 1
5 | root <root> | 2021-04-15 01:13 | Install | 11
4 | root <root> | 2021-04-15 00:42 | Install | 16
3 | root <root> | 2021-04-15 00:42 | Install | 6
2 | root <root> | 2021-04-15 00:40 | Install | 11
1 | System <unset> | 2021-04-14 23:51 | Install | 1160
history list
[root@node ~]#
[root@node ~]# yum history info 2
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Transaction ID : 2
Begin time : Thu Apr 15 00:40:28 2021
Begin rpmdb : 1160:894b2751dfdfcae866a83523ea61f9f957809032
End time : 00:40:33 2021 (5 seconds)
End rpmdb : 1171:22ec6eaa90592749e43053e629b3d75309ca0cfc
User : root <root>
Return-Code : Success
Command Line : install -y binutils compat-libcap1 compat-libstdc++ compat-libstdc++ gcc gcc-c++ glibc glibc glibc-devel glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat elfutils-libelf-devel
Transaction performed with:
Installed rpm-4.8.0-55.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201604140956.x86_64/6.8
Installed subscription-manager-1.16.8-8.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201604140956.x86_64/6.8
Installed yum-3.2.29-73.el6.noarch @anaconda-RedHatEnterpriseLinux-201604140956.x86_64/6.8
Packages Altered:
Dep-Install cloog-ppl-0.15.7-1.2.el6.x86_64 @system
Install compat-libcap1-1.10-1.x86_64 @system
Dep-Install cpp-4.4.7-17.el6.x86_64 @system
Install elfutils-libelf-devel-0.164-2.el6.x86_64 @system
Install gcc-4.4.7-17.el6.x86_64 @system
Install gcc-c++-4.4.7-17.el6.x86_64 @system
Install ksh-20120801-33.el6.x86_64 @system
Install libaio-devel-0.3.107-10.el6.x86_64 @system
Install libstdc++-devel-4.4.7-17.el6.x86_64 @system
Dep-Install mpfr-2.4.1-6.el6.x86_64 @system
Dep-Install ppl-0.10.2-11.el6.x86_64 @system
history info
[root@node ~]#