oracle-11.2.0.4静默安装----RedHat7.5

Posted lczz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle-11.2.0.4静默安装----RedHat7.5相关的知识,希望对你有一定的参考价值。

1.配置/etc/hosts文件和关闭seliux和firewall防火墙

编辑/etc/hosts文件
[root@henry ~]# vim /etc/hosts
[root@henry ~]# cat /etc/hosts
192.168.10.50	henry

禁用selinux
[root@henry ~]# vim /etc/selinux/config 
[root@henry ~]# cat /etc/selinux/config
SELINUX=disabled

关闭防火墙
[root@henry ~]# systemctl stop firewalld
[root@henry ~]# systemctl disable firewalld

2. 检查安装数据库所需要的包

[root@henry ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgomp libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel numactl-devel perl-Env elfutils-libelf-devel | grep "not installed"

package compat-libstdc++-33 is not installed
package ksh is not installed
package libaio-devel is not installed
package sysstat is not installed
package unixODBC is not installed
package unixODBC-devel is not installed
package numactl-devel is not installed
package perl-Env is not installed
package elfutils-libelf-devel is not installed

[root@henry ~]# yum install -y ksh libaio-devel sysstat unixODBC unixODBC-devel numactl-devel perl-Env elfutils-libelf-devel

其中compat-libstdc++-33需手动下载上传安装
root@henry ~]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm 

3.创建用户和组

[root@henry ~]# groupadd oinstall
[root@henry ~]# groupadd dba
[root@henry ~]# useradd -g oinstall -G dba oracle
[root@henry ~]# passwd oracle

4. 系统参数配置

编辑/etc/sysctl.conf

[root@henry ~]# vim /etc/sysctl.conf  
[root@henry ~]# cat /etc/sysctl.conf 
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 4294967295
kernel.shmall = 268435456
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 = 1048586
[root@henry ~]# sysctl -p

编辑/etc/security/limits.conf

 [root@henry ~]# 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
oracle hard stack 32768 

编辑/etc/pam.d/login,新加一行

[root@henry ~]# cat /etc/pam.d/login
#ORACLE SETTING
session required pam_limits.so 

5.配置oracle用户环境变量

[root@henry ~]# cat /home/oracle/.bash_profile 
umask 022
export ORACLE_SID=PROD1
export ORACLE_BASE=/data/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export EDITOR=vim
export TNS_ADMIN=$ORACLE_HOME/network/admin
export SQLPATH=$ORACLE_HOME/sqlplus/admin
export NLS_LANG="AMERICAN_CHINA.ZHS16GBK"
alias sqlplus=‘rlwrap sqlplus‘
alias rman=‘rlwrap rman‘
alias asmcmd=‘rlwrap asmcmd‘

6. 创建安装目录 

u01是oracle安装目录
[root@henry ~]# mkdir /data/u01
soft是存放数据库软件的目录
[root@henry ~]# mkdir /data/soft
[root@henry ~]# chown -R  oracle:oinstall /data/u01/
[root@henry ~]# chown -R  oracle:oinstall /data/soft/

7. 重启系统,切换oracle用户安装软件

将数据库软件上传到/data/soft/目录下,解压安装包

[oracle@henry ~]$ cd /data/soft/
[oracle@henry soft]$ unzip p13390677_112040_Linux-x86-64_1of7.zip && unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@henry soft]$ ls
database  p13390677_112040_Linux-x86-64_1of7.zip  p13390677_112040_Linux-x86-64_2of7.zip

8. 编辑静默安装的应答文件db_install.rsp,此文件位于/data/soft/database/response/目录下

把应答文件模版db_install.rsp 复制到oracle用户家目录下
[oracle@henry soft]$ cd database/
[oracle@henry database]$ ls
install  readme.html  response  rpm  runInstaller  sshsetup  stage  welcome.html
[oracle@henry database]$ cd response/
[oracle@henry response]$ ls
dbca.rsp  db_install.rsp  netca.rsp
[oracle@henry response]$ cp db_install.rsp /home/oracle

编辑应答文件
[oracle@henry database]$ vim /home/oracle/db_install.rsp
#设置以下内容
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=henry
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/data/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true

9. 执行静默安装

[oracle@henry database]$ ./runInstaller -silent -responseFile /home/oracle/db_install.rsp -ignorePrereq
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 14307 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4095 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-10-28_02-28-55PM. Please wait ...[oracle@henry database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
 /data/u01/app/oracle/inventory/logs/installActions2019-10-28_02-28-55PM.log
The installation of Oracle Database 11g was successful.
Please check ‘/data/u01/app/oracle/inventory/logs/silentInstall2019-10-28_02-28-55PM.log‘ for more details.

As a root user, execute the following script(s):
	1. /data/u01/app/oracle/inventory/orainstRoot.sh
	2. /data/u01/app/oracle/product/11.2.0/dbhome_1/root.sh

Successfully Setup software.
另开个终端,使用root账户按顺序执行上面的两个脚本 [root@henry ~]# /data/u01/app/oracle/inventory/orainstRoot.sh Changing permissions of /data/u01/app/oracle/inventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /data/u01/app/oracle/inventory to oinstall. The execution of the script is complete. [root@henry ~]# /data/u01/app/oracle/product/11.2.0/dbhome_1/root.sh Check /data/u01/app/oracle/product/11.2.0/dbhome_1/install/root_henry_2019-10-28_14-36-30.log for the output of root script

10. 编辑静默建库应答文件dbca.rsp

复制建库应答文件dbca.rsp到oracle家目录下
[oracle@henry database]$ cp response/dbca.rsp /home/oracle/

[oracle@henry database]$ vim /home/oracle/dbca.rsp
GDBNAME = "PROD1"
SID = "PROD1"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
DATAFILEDESTINATION =/data/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/data/u01/app/oracle/fast_recovery_area
CHARACTERSET = "AL32UTF8"
DATABASETYPE = "OLTP"
TOTALMEMORY = "2048"

11.执行静默建库

[oracle@henry ~]$ dbca -silent -responseFile /home/oracle/dbca.rsp 
Copying database files
1% complete
3% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/data/u01/app/oracle/cfgtoollogs/dbca/PROD1/PROD1.log" for further details.

11. 上传并安装rlwrap包,root用户安装

安装readline-devel包
[root@henry ~]# yum install -y readline*

解压并安装rlwrap
[root@henry ~]# tar -zxvf 12-rlwrap-0.37.tar.gz
[root@henry ~]# cd rlwrap-0.37/
[root@henry rlwrap-0.37]# ls
aclocal.m4  AUTHORS  BUGS  ChangeLog  completions  config.h.in  configure  configure.ac  COPYING  doc  filters  INSTALL  Makefile.am  Makefile.in  NEWS  PLEA  README  src  test  TODO  tools
[root@henry rlwrap-0.37]# ./configure 
[root@henry rlwrap-0.37]# make&&make install

12. 配置监听,将配置监听的应答文件netca.rsp复制oracle用户的家目录下,不用做修改

[oracle@henry response]$ pwd
/data/soft/database/response
[oracle@henry response]$ cp netca.rsp /home/oracle/
[oracle@henry response]$ netca -silent -responseFile /home/oracle/netca.rsp 

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /home/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
    Running Listener Control: 
      /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
在/data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/目录下会新增listener.ora 和sqlnet.ora两个文件
[oracle@henry response]$ cd /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@henry admin]$ ls
listener.ora  samples  shrept.lst  sqlnet.ora

[oracle@henry admin]$ cat listener.ora 
# listener.ora Network Configuration File: /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =            ====>这个字符串就是监听名
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = henry)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /data/u01/app/oracle

这是个动态监听,监听创建后就已启动。启动,停止,查看监听状态。

查看监听状态 (lsnrctl status listen_name),因监听名是默认的LISTENER,所以可省略,若有多个监听,则需要指定监听名查看指定的监听状态
[oracle@henry ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-OCT-2019 09:57:37

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                29-OCT-2019 09:29:29
Uptime                    0 days 0 hr. 28 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /data/u01/app/oracle/diag/tnslsnr/henry/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=henry)(PORT=1521)))
Services Summary...
Service "PROD1" has 1 instance(s).
  Instance "PROD1", status READY, has 1 handler(s) for this service...
Service "PROD1XDB" has 1 instance(s).
  Instance "PROD1", status READY, has 1 handler(s) for this service...
The command completed successfully

停止监听(lsnrctl stop listen_name)
[oracle@henry ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-OCT-2019 10:00:10

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully

启动监听(lsnrctl start listen_name)
[oracle@henry ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-OCT-2019 10:00:46

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

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

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /data/u01/app/oracle/diag/tnslsnr/henry/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=henry)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                29-OCT-2019 10:00:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /data/u01/app/oracle/diag/tnslsnr/henry/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=henry)(PORT=1521)))
The listener supports no services
The command completed successfully

13. 登入数据库

[oracle@henry ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 29 10:13:50 2019

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

SQL> conn / as sysdba
Connected.
SQL> show user;
USER is "SYS"

SQL> show parameter db_name;

NAME				     TYPE		    VALUE
------------------------------------ ---------------------- ------------------------------
db_name 			     string		    PROD1

SQL> select status from v$instance;

STATUS
------------------------
OPEN

 

以上是关于oracle-11.2.0.4静默安装----RedHat7.5的主要内容,如果未能解决你的问题,请参考以下文章

oracle-11.2.0.4静默安装----RedHat7.5

oracle安装篇:centos7+oracle11.2.0.4+文件系统单实例

数据安全:校验Oracle 11.2.0.4安装软件的 SHA码 防范注入

OracleLinux6.5下Oracle11.2.0.4的安装

Oracle GoldenGate 12.3.0.1.4 安装配置 之02 (oracle 11.2.0.4实例创建)

centos7.4安装oracle11.2.0.4