centos7.x静默安装Oracle11gR2

centos7.x静默安装Oracle11gR2


系统准备以及查看

centos7.6 硬件

安装

使用VMware 12 安装 centos7.4 mini 系统,如下centos7.x 的虚拟硬件配置
    内存:2G	//最好2G以上,我测试所以使用2G
	CPU:2		//随便,vm 模拟
	硬盘:40G	// 20G  可能存储不够,避免磁盘空间不足 
	swap:3G	// 内存的1-2倍

检查系统信息

系统内存
[root@centosbase ~]# free
              total        used        free      shared  buff/cache   available
Mem:        1863248      101724     1557000        9696      204524     1570744
Swap:       3145724           0     3145724

查看系统位数
[root@centosbase ~]# uname -m
x86_64
查看系统名称 并修改为 redhat-7
[root@centosbase ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 
[root@centosbase ~]# vi /etc/redhat-release
    redhat-7
    #CentOS Linux release 7.6.1810 (Core) 
[root@centosbase ~]# cat /etc/redhat-release
redhat-7
#CentOS Linux release 7.6.1810 (Core) 
查看hostname,又需要的可以修改
[root@centosbase ~]# hostname
centosbase
[root@centosbase ~]# hostnamectl set-hostname oracle
[root@centosbase ~]# hostname
oracle
更新软件包
[root@centosbase ~]# yum -y upgrade
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                     | 3.4 kB  00:00:00     
updates                                                                                                    | 3.4 kB  00:00:00     
No packages marked for update
关闭selinux ,重启 reboot
将 SELINUX=enforcing 改为 SELINUX=disabled
[root@centosbase ~]# vi /etc/selinux/config
    #SELINUX=enforcing
    SELINUX=disabled
[root@centosbase ~]# cat /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=enforcing
SELINUX=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进行安装所需服务:
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
[root@centosbase ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package binutils-2.27-34.base.el7.x86_64 already installed and latest version
No package compat-libstdc++-33*.devel available.
No package compat-libstdc++-33*.devel available.
Package gcc-4.8.5-36.el7_6.1.x86_64 already installed and latest version
Package glibc-2.17-260.el7_6.4.x86_64 already installed and latest version
Package glibc-devel-2.17-260.el7_6.4.x86_64 already installed and latest version
Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
No package libaio-devel*.devel available.
Package libgcc-4.8.5-36.el7_6.1.x86_64 already installed and latest version
Package libstdc++-4.8.5-36.el7_6.1.x86_64 already installed and latest version
No package libstdc++-devel*.devel available.
Package libXi-1.7.9-1.el7.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed
---> Package compat-libstdc++-33.i686 0:3.2.3-72.el7 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed
---> Package gcc-c++.x86_64 0:4.8.5-36.el7_6.1 will be installed
---> Package glibc.i686 0:2.17-260.el7_6.4 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.17-260.el7_6.4.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.17-260.el7_6.4.i686
---> Package glibc-devel.i686 0:2.17-260.el7_6.4 will be installed
---> Package glibc-static.i686 0:2.17-260.el7_6.4 will be installed
---> Package ksh.x86_64 0:20120801-139.el7 will be installed
---> Package libXi.i686 0:1.7.9-1.el7 will be installed
--> Processing Dependency: libXext.so.6 for package: libXi-1.7.9-1.el7.i686
--> Processing Dependency: libX11.so.6 for package: libXi-1.7.9-1.el7.i686
---> Package libXi-devel.i686 0:1.7.9-1.el7 will be installed
--> Processing Dependency: xorg-x11-proto-devel for package: libXi-devel-1.7.9-1.el7.i686
--> Processing Dependency: pkgconfig(xfixes) for package: libXi-devel-1.7.9-1.el7.i686
--> Processing Dependency: pkgconfig(xext) for package: libXi-devel-1.7.9-1.el7.i686
--> Processing Dependency: pkgconfig(x11) for package: libXi-devel-1.7.9-1.el7.i686
--> Processing Dependency: pkgconfig(inputproto) for package: libXi-devel-1.7.9-1.el7.i686
---> Package libXinerama.i686 0:1.1.3-2.1.el7 will be installed
---> Package libXinerama-devel.i686 0:1.1.3-2.1.el7 will be installed
---> Package libXtst.i686 0:1.2.3-1.el7 will be installed
---> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed
---> Package libXtst-devel.i686 0:1.2.3-1.el7 will be installed
---> Package libaio.i686 0:0.3.109-13.el7 will be installed
---> Package libaio-devel.i686 0:0.3.109-13.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libgcc.i686 0:4.8.5-36.el7_6.1 will be installed
---> Package libstdc++.i686 0:4.8.5-36.el7_6.1 will be installed
---> Package libstdc++-devel.i686 0:4.8.5-36.el7_6.1 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-36.el7_6.1 will be installed
---> Package libstdc++-static.i686 0:4.8.5-36.el7_6.1 will be installed
---> Package sysstat.x86_64 0:10.1.5-17.el7 will be installed
--> Processing Dependency: libsensors.so.4()(64bit) for package: sysstat-10.1.5-17.el7.x86_64
---> Package unixODBC.i686 0:2.3.1-11.el7 will be installed
--> Processing Dependency: libreadline.so.6 for package: unixODBC-2.3.1-11.el7.i686
--> Processing Dependency: libltdl.so.7 for package: unixODBC-2.3.1-11.el7.i686
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-11.el7.x86_64
---> Package unixODBC-devel.i686 0:2.3.1-11.el7 will be installed
---> Package unixODBC-devel.x86_64 0:2.3.1-11.el7 will be installed
--> Running transaction check
---> Package libX11.i686 0:1.6.5-2.el7 will be installed
--> Processing Dependency: libxcb.so.1 for package: libX11-1.6.5-2.el7.i686
---> Package libX11-devel.x86_64 0:1.6.5-2.el7 will be installed
--> Processing Dependency: pkgconfig(xcb) >= 1.11.1 for package: libX11-devel-1.6.5-2.el7.x86_64
--> Processing Dependency: pkgconfig(xcb) for package: libX11-devel-1.6.5-2.el7.x86_64
---> Package libXext.i686 0:1.3.3-3.el7 will be installed
---> Package libXext-devel.x86_64 0:1.3.3-3.el7 will be installed
---> Package libXfixes-devel.x86_64 0:5.0.3-1.el7 will be installed
---> Package libtool-ltdl.i686 0:2.4.2-22.el7_3 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package lm_sensors-libs.x86_64 0:3.4.0-6.20160601gitf9185e5.el7 will be installed
---> Package nss-softokn-freebl.i686 0:3.36.0-5.el7_5 will be installed
---> Package readline.i686 0:6.2-10.el7 will be installed
--> Processing Dependency: libtinfo.so.5 for package: readline-6.2-10.el7.i686
---> Package xorg-x11-proto-devel.noarch 0:2018.4-1.el7 will be installed
--> Running transaction check
---> Package libxcb.i686 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6 for package: libxcb-1.13-1.el7.i686
---> Package libxcb-devel.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.13-1.el7.x86_64
---> Package ncurses-libs.i686 0:5.9-14.20130511.el7_4 will be installed
--> Running transaction check
---> Package libXau.i686 0:1.0.8-2.1.el7 will be installed
---> Package libXau-devel.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                            Arch                 Version                                      Repository             Size
==================================================================================================================================
Installing:
 compat-libcap1                     x86_64               1.10-7.el7                                   base                   19 k
 compat-libstdc++-33                i686                 3.2.3-72.el7                                 base                  196 k
 compat-libstdc++-33                x86_64               3.2.3-72.el7                                 base                  191 k
 gcc-c++                            x86_64               4.8.5-36.el7_6.1                             updates               7.2 M
 glibc                              i686                 2.17-260.el7_6.4                             updates               4.3 M
 glibc-devel                        i686                 2.17-260.el7_6.4                             updates               1.1 M
 glibc-static                       i686                 2.17-260.el7_6.4                             updates               1.3 M
 ksh                                x86_64               20120801-139.el7                             base                  885 k
 libXi                              i686                 1.7.9-1.el7                                  base                   40 k
 libXi-devel                        i686                 1.7.9-1.el7                                  base                  105 k
 libXinerama                        i686                 1.1.3-2.1.el7                                base                   14 k
 libXinerama-devel                  i686                 1.1.3-2.1.el7                                base                   13 k
 libXtst                            i686                 1.2.3-1.el7                                  base                   20 k
 libXtst                            x86_64               1.2.3-1.el7                                  base                   20 k
 libXtst-devel                      i686                 1.2.3-1.el7                                  base                   17 k
 libaio                             i686                 0.3.109-13.el7                               base                   24 k
 libaio-devel                       i686                 0.3.109-13.el7                               base                   13 k
 libaio-devel                       x86_64               0.3.109-13.el7                               base                   13 k
 libgcc                             i686                 4.8.5-36.el7_6.1                             updates               109 k
 libstdc++                          i686                 4.8.5-36.el7_6.1                             updates               318 k
 libstdc++-devel                    i686                 4.8.5-36.el7_6.1                             updates               1.5 M
 libstdc++-devel                    x86_64               4.8.5-36.el7_6.1                             updates               1.5 M
 libstdc++-static                   i686                 4.8.5-36.el7_6.1                             updates               412 k
 sysstat                            x86_64               10.1.5-17.el7                                base                  315 k
 unixODBC                           i686                 2.3.1-11.el7                                 base                  410 k
 unixODBC                           x86_64               2.3.1-11.el7                                 base                  413 k
 unixODBC-devel                     i686                 2.3.1-11.el7                                 base                   54 k
 unixODBC-devel                     x86_64               2.3.1-11.el7                                 base                   55 k
Installing for dependencies:
 libX11                             i686                 1.6.5-2.el7                                  base                  610 k
 libX11-devel                       x86_64               1.6.5-2.el7                                  base                  980 k
 libXau                             i686                 1.0.8-2.1.el7                                base                   29 k
 libXau-devel                       x86_64               1.0.8-2.1.el7                                base                   14 k
 libXext                            i686                 1.3.3-3.el7                                  base                   39 k
 libXext-devel                      x86_64               1.3.3-3.el7                                  base                   75 k
 libXfixes-devel                    x86_64               5.0.3-1.el7                                  base                   13 k
 libtool-ltdl                       i686                 2.4.2-22.el7_3                               base                   49 k
 libtool-ltdl                       x86_64               2.4.2-22.el7_3                               base                   49 k
 libxcb                             i686                 1.13-1.el7                                   base                  230 k
 libxcb-devel                       x86_64               1.13-1.el7                                   base                  1.1 M
 lm_sensors-libs                    x86_64               3.4.0-6.20160601gitf9185e5.el7               base                   42 k
 ncurses-libs                       i686                 5.9-14.20130511.el7_4                        base                  316 k
 nss-softokn-freebl                 i686                 3.36.0-5.el7_5                               base                  211 k
 readline                           i686                 6.2-10.el7                                   base                  189 k
 xorg-x11-proto-devel               noarch               2018.4-1.el7                                 base                  280 k

Transaction Summary
==================================================================================================================================
Install  28 Packages (+16 Dependent packages)

Total download size: 25 M
Installed size: 75 M
Downloading packages:
    ...省略过程
Complete!
[root@centosbase ~]# 

查看是否都已经安装了
[root@centosbase ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
binutils-2.27-34.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.i686
gcc-4.8.5-36.el7_6.1.x86_64
gcc-c++-4.8.5-36.el7_6.1.x86_64
glibc-2.17-260.el7_6.4.x86_64
glibc-2.17-260.el7_6.4.i686
glibc-devel-2.17-260.el7_6.4.x86_64
glibc-devel-2.17-260.el7_6.4.i686
ksh-20120801-139.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-0.3.109-13.el7.i686
libaio-devel-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.i686
libgcc-4.8.5-36.el7_6.1.x86_64
libgcc-4.8.5-36.el7_6.1.i686
libstdc++-4.8.5-36.el7_6.1.x86_64
libstdc++-4.8.5-36.el7_6.1.i686
libstdc++-devel-4.8.5-36.el7_6.1.x86_64
libstdc++-devel-4.8.5-36.el7_6.1.i686
libXi-1.7.9-1.el7.x86_64
libXi-1.7.9-1.el7.i686
libXtst-1.2.3-1.el7.i686
libXtst-1.2.3-1.el7.x86_64
make-3.82-23.el7.x86_64
sysstat-10.1.5-17.el7.x86_64
unixODBC-2.3.1-11.el7.x86_64
unixODBC-2.3.1-11.el7.i686
unixODBC-devel-2.3.1-11.el7.x86_64
unixODBC-devel-2.3.1-11.el7.i686
[root@centosbase ~]# 

配置用户组

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
passwd oracle //设置密码

id oracle
[root@centosbase ~]# /usr/sbin/groupadd oinstall
[root@centosbase ~]# /usr/sbin/groupadd dba
[root@centosbase ~]# /usr/sbin/useradd -g oinstall -G dba oracle
[root@centosbase ~]# passwd oracle
Changing password for user oracle.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@centosbase ~]# id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
[root@centosbase ~]# 

配置内核参数

vi /etc/sysctl.conf
末尾添加

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
生效
/sbin/sysctl -p

[root@centosbase ~]# vi /etc/sysctl.conf
[root@centosbase ~]# 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).

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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@centosbase ~]# 
[root@centosbase ~]# /sbin/sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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

修改用户权限(任选其一)

方法一:(推荐)
    vi /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

[root@centosbase ~]# vi /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

# End of file

方法二:
    vi /etc/pam.d/login
    末尾添加:
        session required /lib64/security/pam_limits.so
        session required pam_limits.so
[root@centosbase ~]# vi /etc/pam.d/login
[root@centosbase ~]# cat /etc/pam.d/login 
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth       substack     system-auth
auth       include      postlogin
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
session    optional     pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    include      postlogin
-session   optional     pam_ck_connector.so

session required /lib/security/pam_limits.so
session required pam_limits.so
[root@centosbase ~]# 

配置 /etc/profile

vi /etc/profile
末尾添加:
    if [ $USER = "oracle" ]; then
       if [ $SHELL = "/bin/ksh" ]; then
           ulimit -p 16384
           ulimit -n 65536
        else
           ulimit -u 16384 -n 65536
       fi
    fi
生效:
    source /etc/profile
[root@centosbase ~]# vi /etc/profile
if [ $USER = "oracle" ]; then
   if [ $SHELL = "/bin/ksh" ]; then
       ulimit -p 16384
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
   fi
fi
[root@centosbase ~]# source /etc/profile

创建安装目录

mkdir -p /u01/app/
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app/
[root@centosbase ~]# mkdir -p /u01/app/
[root@centosbase ~]# chown -R oracle:oinstall /u01/app/
[root@centosbase ~]# chmod -R 775 /u01/app/

/etc/oraInst.loc

vi /etc/oraInst.loc
添加:
    inventory_loc=/u01/app/oraInventory
    inst_group=oinstall
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
[root@centosbase ~]# vi /etc/oraInst.loc
[root@centosbase ~]# cat /etc/oraInst.loc 
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
[root@centosbase ~]# chown oracle:oinstall /etc/oraInst.loc
[root@centosbase ~]# chmod 664 /etc/oraInst.loc
[root@centosbase ~]# 

切换Oracle用户

配置环境变量,之后会根据实际安装路径配置 ORACLE_HOME

vim ~/.bash_profile
添加:

export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
export ORACLE_HOME= O R A C L E B A S E / p r o d u c t / 11.2.0 / d b 1 P A T H = ORACLE_BASE/product/11.2.0/db_1 PATH= ORACLEBASE/product/11.2.0/db1PATH=PATH:$ORACLE_HOME/bin

[oracle@oracle ~]$ vi ~/.bash_profile
[oracle@oracle ~]$ 
[oracle@oracle ~]$ cat ~/.bash_profile 
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi
# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
PATH=$PATH:$ORACLE_HOME/bin
export PATH
[oracle@oracle ~]$ source ~/.bash_profile

升级软件包

ftp 上传 oracle安装包
解压安装包
[root@centosbase oracle]# pwd
/home/oracle
[root@centosbase oracle]# ll
total 2295592
drwxr-xr-x. 8 root root        128 Aug 20  2009 database
-rw-r--r--. 1 root root 1239269270 Apr 26 11:44 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 root root 1111416131 Apr 26 13:04 linux.x64_11gR2_database_2of2.zip
[root@centosbase oracle]# 
[root@centosbase oracle]# unzip linux.x64_11gR2_database_1of2.zip 
[root@centosbase oracle]# unzip linux.x64_11gR2_database_2of2.zip 

切换到 oracle 用户 执行安装命令(大概执行15分钟)

当前窗口打印安装日志
附上oracle软件静默安装的参数含义如下:
-silent       表示以静默方式安装,不会有任何提示
-force        表示允许安装到一个非空目录
-noconfig     表示不运行配置助手netca
-responseFile 表示使用哪个响应文件,必需使用绝对路径
oracle.install.responseFileVersion  响应文件模板的版本,该参数不要更改
oracle.install.option               安装模式选项,本例只安装oracle软件,该参数不要更改
DECLINE_SECURITY_UPDATES            是否需要在线安全更新,设置为false,该参数不要更改
UNIX_GROUP_NAME oracle              用户用于安装软件的组名
INVENTORY_LOCATION                  oracle 产品清单目录
SELECTED_LANGUAGES                  oracle 运行语言环境,一般包括引文和简繁体中文
ORACLE_HOME                         oracle安装目录
ORACLE_BASE                         oracle基础目录
oracle.install.db.InstallEdition    安装版本类型,一般是企业版
oracle.install.db.isCustomInstall   是否定制安装,默认Partitioning,OLAP,RAT都选上。根据自己的需要选择组件。
oracle.install.db.customComponents  定制安装组件列表:除了以上默认的,可加上Label Security和Database Vault
oracle.install.db.DBA_GROUP         oracle 用户用于授予osdba权限的组名
oracle.install.db.OPER_GROUP        oracle 用户用于授予osoper权限的组名
/home/oracle/database/runInstaller -silent -debug -force \
FROM_LOCATION=/home/oracle/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 \
ORACLE_HOME_NAME="OracleDB11g" \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=dba \
DECLINE_SECURITY_UPDATES=true
通过 top 查看java的进程表示 安装过程在进行中

[root@oracle ~]# top
top - 12:34:53 up 17 min,  2 users,  load average: 0.05, 0.09, 0.07
Tasks: 106 total,   1 running, 105 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.0 us,  0.8 sy,  0.0 ni, 98.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1863248 total,   823300 free,   203688 used,   836260 buff/cache
KiB Swap:  3145724 total,  3145724 free,        0 used.  1474556 avail Mem 

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                     
 17144 oracle    20   0 1557636 119828  20472 S   2.3  6.4   0:05.74 java                                                        
     9 root      20   0       0      0      0 S   0.3  0.0   0:01.20 rcu_sched                                                   
    52 root      20   0       0      0      0 S   0.3  0.0   0:04.90 kworker/0:2                                                 
 16409 root      20   0  161472   6052   4664 S   0.3  0.3   0:00.25 sshd  
 
安装完成之后按照提示执行脚本root.sh (root用户执行)
[root@centosbase ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh
Check /u01/app/oracle/product/11.2.0/db_1/install/root_oracle_2019-04-27_15-46-58.log for the output of root script
[root@centosbase ~]# 

到此oracle安装成功

实例db配置 (半个小时)

复制配置文件
    cp /home/oracle/database/response/dbca.rsp /home/oracle/etc/
编辑配置文件(oracle要有权限)
    vi /home/oracle/etc/dbca.rsp
切换到oracle用户执行 (半个小时)
    dbca -silent -responseFile /home/oracle/etc/dbca.rsp
[root@oracle oracle]# vi /home/oracle/etc/dbca.rsp
[root@oracle oracle]# cat /home/oracle/etc/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION ="/u01/app/oracle/oradata"
STORAGETYPE=FS
CHARACTERSET = "AL32UTF8"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"
TOTALMEMORY =8192
[root@oracle oracle]# 

[oracle@oracle ~]$ dbca -silent -responseFile /home/oracle/etc/dbca.rsp
Creating and starting Oracle instance
1% complete
3% complete
Creating database files
4% complete
7% complete
Creating data dictionary views
8% complete
9% complete
10% complete
11% complete
12% complete
13% complete
14% complete
16% complete
17% complete
18% complete
19% complete
Adding Oracle JVM
25% complete
30% complete
36% complete
38% complete
Adding Oracle Text
40% complete
41% complete
Adding Oracle XML DB
43% complete
44% complete
45% complete
49% complete
Adding Oracle Multimedia
50% complete
60% complete
Adding Oracle OLAP
61% complete
62% complete
63% complete
64% complete
Adding Oracle Spatial
65% complete
66% complete
67% complete
71% complete
Adding Enterprise Manager Repository
73% complete
75% complete
Adding Oracle Application Express
78% complete
82% complete
Adding Oracle Warehouse Builder
86% complete
90% complete
Completing Database Creation
91% complete
92% complete
93% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@oracle ~]$ 

启动停止数据库

启动
	1.# su - oracle		//切换到 oracle 用户且切换到它的环境
	2.$ lsnrctl status	//查看监听及数据库状态
	3.$ lsnrctl start		//启动监听
	4.$ sqlplus / as sysdba		//以 DBA 身份进入 sqlplus
	5.SQL> startup	//启动 db
停止
	1.# su - oracle		//切换到 oracle 用户且切换到它的环境
	2.$ lsnrctl stop		//停止监听
	3.$ sqlplus / as sysdba		//以 DBA 身份进入 sqlplus
	4.SQL> SHUTDOWN IMMEDIATE		//关闭 db
[root@oracle ~]# su - oracle
Last login: Sat Apr 27 16:35:30 AKDT 2019 on pts/1
[oracle@oracle ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-APR-2019 17:57:34

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                27-APR-2019 17:58:15
Uptime                    0 days 0 hr. 1 min. 26 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Apr 27 18:01:12 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initdbsrv2.or..." - rest of line ignored.
    --下面有解决方法
SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size		    2215064 bytes
Variable Size		  163578728 bytes
Database Buffers	  360710144 bytes
Redo Buffers		    7958528 bytes
Database mounted.
Database opened.
SQL> 

启动实例错误解决:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initdbsrv2.or…" - rest of line ignored.

ORA-01078: failure in processing system parameters
[oracle@oracle ~]$ cd /u01/app/oracle/admin/orcl/pfile/     --orcl 是实例名称
[oracle@oracle pfile]$ ll
total 4
-rw-r----- 1 oracle oinstall 2039 Apr 27 16:59 init.ora.3272019173039
[oracle@oracle pfile]$ cp init.ora.3272019173039 /u01/app/oracle/product/11.2.0/db_1/dbs/
[oracle@oracle pfile]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/
[oracle@oracle dbs]$ ll
total 36
-rw-rw----  1 oracle oinstall 1544 Apr 27 16:58 hc_DBUA1.dat
-rw-rw----  1 oracle oinstall 1544 Apr 27 17:31 hc_orcl.dat
-rw-r-----  1 oracle oinstall   91 Apr 27 16:56 initDBUA0.ora
-rw-r--r--. 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r-----  1 oracle oinstall 2039 Apr 27 18:12 init.ora.3272019173039
-rw-r-----  1 oracle oinstall   24 Apr 27 17:00 lkORCL
-rw-r-----  1 oracle oinstall 1536 Apr 27 16:56 orapwDBUA0
-rw-r-----  1 oracle oinstall 1536 Apr 27 16:59 orapworcl
-rw-r-----  1 oracle oinstall 2560 Apr 27 17:31 spfileorcl.ora
[oracle@oracle dbs]$ mv init.ora.3272019173039 initdbsrv2.ora  --必须修改为提示名称
[oracle@oracle dbs]$ 

错误一:
[FATAL] [INS-10008] Session initialization failed
CAUSE: An unexpected error occured while initializing the session.
ACTION: Contact Oracle Support Services or refer logs
SUMMARY:
-
解决:
文件安装FROM_LOCATION=/home/oracle/database/stage/products.xml 位置错误

错误二:
[main] [ 2019-04-27 14:44:03.171 AKDT ] [OFSUtil.doGetACFSActiveVersion:189] m_cmdtool.execute failed for nodename, localnode
[FATAL] [INS-32035] Unable to create a new central inventory at the specified location.
CAUSE: The central inventory location provided is not empty.
ACTION: Please provide another location for the inventory, or clean up the current location.
A log of this session is currently saved as: /tmp/OraInstall2019-04-27_02-39-59PM/installActions2019-04-27_02-39-59PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.

解决:
    vi /etc/oraInst.loc
    添加:
    inventory_loc=/u01/app/oraInventory
    inst_group=oinstall
[root@oracle ~]# vi /etc/oraInst.loc
[root@oracle ~]# cat /etc/oraInst.loc 
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
[root@oracle ~]# chown oracle:oinstall /etc/oraInst.loc
[root@oracle ~]# chmod 664 /etc/oraInst.loc
[root@oracle ~]# 

问题三:启动时报错
Message 3511 not found; No message file for product=network, facility=TNSTNS-03505:

解决:ORACLE_HOME 路径找不到,可以重新设置为安装的路径

问题四:启动实例错误(没有创建文件)
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/db_1/dbs/initdbsrv2.ora’
SQL>
解决:将cd /u01/app/oracle/admin/orcl/pfile/文件下的init.ora.xxxxxxxx 复制到提示目录下 并命名为 提示名称

[oracle@oracle ~]$ cd /u01/app/oracle/admin/orcl/pfile/     --orcl 是实例名称
[oracle@oracle pfile]$ ll
total 4
-rw-r----- 1 oracle oinstall 2039 Apr 27 16:59 init.ora.3272019173039
[oracle@oracle pfile]$ cp init.ora.3272019173039 /u01/app/oracle/product/11.2.0/db_1/dbs/
[oracle@oracle pfile]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/
[oracle@oracle dbs]$ ll
total 36
-rw-rw----  1 oracle oinstall 1544 Apr 27 16:58 hc_DBUA1.dat
-rw-rw----  1 oracle oinstall 1544 Apr 27 17:31 hc_orcl.dat
-rw-r-----  1 oracle oinstall   91 Apr 27 16:56 initDBUA0.ora
-rw-r--r--. 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r-----  1 oracle oinstall 2039 Apr 27 18:12 init.ora.3272019173039
-rw-r-----  1 oracle oinstall   24 Apr 27 17:00 lkORCL
-rw-r-----  1 oracle oinstall 1536 Apr 27 16:56 orapwDBUA0
-rw-r-----  1 oracle oinstall 1536 Apr 27 16:59 orapworcl
-rw-r-----  1 oracle oinstall 2560 Apr 27 17:31 spfileorcl.ora
[oracle@oracle dbs]$ mv init.ora.3272019173039 initdbsrv2.ora  --必须修改为提示名称
[oracle@oracle dbs]$ 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值