阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6.9下Oracle 11gR2 静默安装单实例(待优化版)

216次阅读
没有评论

共计 28137 个字符,预计需要花费 71 分钟才能阅读完成。

测试环境:CentOS 6.9 X64 mini 版

Oracle 版本:11g r2

Oracle 软件包:db_112040_Linux-x86-64_1of7.zip;db_112040_Linux-x86-64_2of7.zip

静默安装的应答原文件路径:/home/soft/database/response

一、环境准备

环境初始化脚本:来源于网上做了个小修改

功能:实现环境的修改和补丁的补全

#!/bin/bash
# oracle 11g R2 for linux 安装辅助脚本
# Redkey
# version 1.3
# date 2017.10.19
# 定义常量
SYSCTL=/etc/sysctl.conf
LIMITS=/etc/security/limits.conf
PAM=/etc/pam.d/login
PROFILE=/etc/profile
BASH_PROFILE=/home/oracle/.bash_profile
# 循环变量
i=1
# 定义显示颜色
# 颜色定义 信息 (33 黄色) 警示 (31 红色) 过程 (36 浅蓝)
# 判断执行用户是否 root
isroot()
{
if [$USER != “root”];then
echo -e “\n\e[1;31m the user must be root,and now you user is $USER,please su to root. \e[0m”
exit4
else
echo -e “\n\e[1;36m check root … OK! \e[0m”
fi
}
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh compat-db control-center libstdc++ libstdc++-devel xscreensaver openmotif21 ksh* compat-libcap* zip unzip
# 挂在光盘到 /mnt/cdrom 目录下
#mount_cdrom()
#{
#echo -e “\n\e[1;31m please insert RHEL to CDROM,press any key …\e[0m”
#read -n 1
#if [-d /mnt/cdrom];then
# mount -t auto -o ro /dev/cdrom /mnt/cdrom
#else
# mkdir -p /mnt/cdrom
# mount -t auto -o ro /dev/cdrom /mnt/cdrom
#fi
#if [$? -eq 0];then
# echo -e “\n\e[1;36m CDROM mount on /mnt/cdrom … OK! \e[0m”
#fi
#}
# 设置 yum 本地光盘源
#yum_repo()
#{
# rm -rf /etc/yum.repos.d/* && cat <<EOF >> /etc/yum.repos.d/Server.repo
#[Server]
#name=MyRPM
#baseurl=file:///mnt/cdrom/Server
#enabled=1
#gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-RedHat-release
#EOF
#if [$? -eq 0];then
#echo -e “\n\e[1;36m /etc/yum.repos.d/Server.repo … OK! \e[0m”
#fi
#}
# 添加 oracle 用户,添加 oracle 用户所属组 oinstall 及附加组 dba
ouseradd()
{
if [[`grep “oracle” /etc/passwd` != “”]];then
userdel -r oracle
fi
if [[`grep “oinstall” /etc/group` = “”]];then
groupadd oinstall
fi
if [[`grep “dba” /etc/group` = “”]];then
groupadd dba
fi
useradd oracle -g oinstall -G dba && echo $1 |passwd oracle –stdin
if [$? -eq 0];then
echo -e “\n\e[1;36m oracle’s password updated successfully — OK! \e[0m”
else
echo -e “\n\e[1;31m oracle’s password set faild. — NO!\e[0m”
fi
}
# 检查 oracle 所需软件包并安装
packagecheck()
{
for package in binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat
do
rpm -q $package 2> /dev/null
if [$? != 0];then
yum -y install $package
echo -e “\n\e[1;36m $package is already installed … OK! \e[0m”
fi
done
}
# 安装桌面套件 X Window System / Desktop
#xdesk()
#{
# yum -y groupinstall “X Window System” “Desktop”
#}
# 设置内核参数

kernelset()
{
cp $SYSCTL{,.bak} && cat <<EOF >>$SYSCTL
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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 = 1048575
EOF
if [$? -eq 0];then
echo -e “\n\e[1;36m kernel parameters updated successfully — OK! \e[0m”
fi
sysctl -p
}
# 设置 oracle 资源限制
oralimit()
{
cp $LIMITS{,.bak} && cat <<EOF >> $LIMITS
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
if [$? -eq 0];then
echo -e “\n\e[1;36m $LIMITS updated successfully … OK! \e[0m”
fi
}
# 设置 login 文件
setlogin()
{
cp $PAM{,.bak} && cat <<EOF >>$PAM
session required pam_limits.so
EOF
if [$? -eq 0];then
echo -e “\n\e[1;36m $PAM updated successfully … OK! \e[0m”
fi
}
# 设置 profile 文件
setprofile()
{
cp $PROFILE{,.bak} && cat <<EOF >>$PROFILE
if [$USER = “oracle”];then
if [$SHELL = “/bin/ksh”];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
if [$? -eq 0];then
echo -e “\n\e[1;36m $PROFILE updated successfully … OK! \e[0m”
fi
}
# 设置 oracle 的 profile 文件
setbash_profile()
{
cp $BASH_PROFILE{,.bak} && cat <<EOF >> $BASH_PROFILE
umask 022
ORACLE_BASE=/home/oracle/app
ORACLE_HOME=/home/oracle/app/product/11.2.0/db_1
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin/:$PATH
LANG=en_US.UTF-8
stty erase ^H
export ORACLE_BASE ORACLE_HOME ORACLE_SID
EOF
if [$? -eq 0];then
echo -e “\n\e[1;36m $BASH_PROFILE updated successfully … OK! \e[0m”
fi
. $BASH_PROFILE
}
# 系统环境检查
oscheck()
{
# 查看内存大小是否大于 1G
echo -e “\n check MEM Size …”
if [`cat /proc/meminfo | grep MemTotal | awk ‘{print $2}’` -lt 1048576 ];then
echo -e “\n\e[1;33m Memory Small \e[0m”
exit 1
else
echo -e “\n\e[1;36m Memory checked PASS \e[0m”
fi
# 查看 tmp 空间大小
echo -e “\n check tmpfs Size …”
cp /etc/fstab{,.bak}
while true;do
if [`df | awk ‘/tmpfs/ {print $2}’` -lt 1048576 ];then
echo -e “\n\e[1;33m tmpfs Smaill \e[0m”
sed -i ‘/tmpfs/s/defaults/defaults,size=1G/’ /etc/fstab && mount -o remount /dev/shm
if [$? != 0];then
i=i+1
if [$i -eq 3];then
echo -e “\n\e[1;31m set tmpfs faild. \e[0m”
exit 3
fi
else
echo -e “\n\e[1;36 tmpfs updated successfully. \e[0m”
break
fi
else
echo -e “\n\e[1;36m tmpfs checked PASS \e[0m”
break
fi
done
}
# 停止防火墙 IPTABLES
service iptables stop
chkconfig iptables off
# 关闭 SELINUX
cp /etc/selinux/config{,.bak} && sed -i ‘/SELINUX/s/enforcing/disabled/;/SELINUX/s/permissive/disabled/’ /etc/selinux/config
setenforce 0
# 执行以上函数
isroot
oscheck
packagecheck
xdesk
kernelset
oralimit
setlogin
setprofile
echo -e “\n\e[1;33m please input oracle’s user passwd: \e[0m”
read oraclepw
ouseradd $oraclepw
setbash_profile
echo -e “\n\e[1;33m please input oracle install PATH(default /home/oracle/app) \e[0m”
read oraclepath
if [-z $oraclepath];then
oraclepath=/home/oracle/app
fi
echo -e “\n\e[1;33m please input oracle_sid (default orcl) \e[0m”
read orasid
if [-z orasid];then
orasid=orcl
fi
setbash_profile $oraclepath $orasid
mkdir -p $oraclepath && chown -R oracle:oinstall $oraclepath && chmod -R 755 $oraclepath && mkdir -p /home/oracle/app/oraInventory && chown -R oracle:oinstall /home/oracle/
unset i
echo -e “\n\e[1;35m Oracle install pre-setting finish! && please run oracle installer as user oracle \e[0m”

1、首先复制上面的文本进行创建脚本文件并授可执行权限, 并执行脚本

[root@oracle ~]vim oracleinstall.sh  复制脚本粘贴进来

[root@oracle ~]chmod +x  oracleinstall.sh  &&  ./oracleinstall.sh

2、执行脚本需要输入 oracle 用户密码,其它的两个可以保持默认

3、然后切换到 oracle 账户

[root@oracle ~] su – oracel

4、新建一个 soft 文件夹

[oracle@oracle ~]mkdir soft

切换到目录

我实际上是建在 home 目下面的

需要在 root 用户下授于 oracle:orinstall 的权限

[root@oracle ~]chown -R oracle:oinstall /home/soft

[root@oracle ~]cd /home/soft/

4、上传并解压 db_112040_Linux-x86-64_1of7.zip;db_112040_Linux-x86-64_2of7.zip

推荐使用 rz 上传命令 (在初始化脚本时已安装)

解压命令:unzip  db_112040_Linux-x86-64_1of7.zip && unzip db_112040_Linux-x86-64_2of7.zip

二、安装数据库软件

静默安装脚本内容:

####################################################################
## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values.    ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
####################################################################

#——————————————————————————
# Do not change the following system generated value.
#——————————————————————————
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

#——————————————————————————
# Specify the installation option.
# It can be one of the following:
# – INSTALL_DB_SWONLY
# – INSTALL_DB_AND_CONFIG
# – UPGRADE_DB
#——————————————————————————-
oracle.install.option=INSTALL_DB_SWONLY

#——————————————————————————-
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#——————————————————————————-
ORACLE_HOSTNAME=oracle

#——————————————————————————-
# Specify the Unix group to be set for the inventory directory.
#——————————————————————————-
UNIX_GROUP_NAME=oinstall

#——————————————————————————-
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#——————————————————————————-
INVENTORY_LOCATION=/home/oracle/app/oraInventory

#——————————————————————————-
# Specify the languages in which the components will be installed.
#
# en : English ja : Japanese
# fr : French ko : Korean
# ar : Arabic es : Latin American Spanish
# bn : Bengali lv : Latvian
# pt_BR: Brazilian Portuguese lt : Lithuanian
# bg : Bulgarian ms : Malay
# fr_CA: Canadian French es_MX: Mexican Spanish
# ca : Catalan no : Norwegian
# hr : Croatian pl : Polish
# cs : Czech pt : Portuguese
# da : Danish ro : Romanian
# nl : Dutch ru : Russian
# ar_EG: Egyptian zh_CN: Simplified Chinese
# en_GB: English (Great Britain) sk : Slovak
# et : Estonian sl : Slovenian
# fi : Finnish es_ES: Spanish
# de : German sv : Swedish
# el : Greek th : Thai
# iw : Hebrew zh_TW: Traditional Chinese
# hu : Hungarian tr : Turkish
# is : Icelandic uk : Ukrainian
# in : Indonesian vi : Vietnamese
# it : Italian
#
# all_langs : All languages
#
# Specify value as the following to select any of the languages.
# Example : SELECTED_LANGUAGES=en,fr,ja
#
# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs
#——————————————————————————
SELECTED_LANGUAGES=en,zh_CN

#——————————————————————————
# Specify the complete path of the Oracle Home.
#——————————————————————————
ORACLE_HOME=/home/oracle/app/product/11.2.0/db_1

#——————————————————————————
# Specify the complete path of the Oracle Base.
#——————————————————————————
ORACLE_BASE=/home/oracle/app

#——————————————————————————
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# – EE : Enterprise Edition
# – SE : Standard Edition
# – SEONE : Standard Edition One
# – PE : Personal Edition (WINDOWS ONLY)
#——————————————————————————
oracle.install.db.InstallEdition=EE

#——————————————————————————
# This variable is used to enable or disable custom install and is considered
# only if InstallEdition is EE.
#
# true : Components mentioned as part of ‘optionalComponents’ property
# are considered for install.
# false : Value for ‘optionalComponents’ is not considered.
#——————————————————————————
oracle.install.db.EEOptionsSelection=true

#——————————————————————————
# This variable is considered only if ‘EEOptionsSelection’ is set to true.
#
# Description: List of Enterprise Edition Options you would like to enable.
#
# The following choices are available. You may specify any
# combination of these choices. The components you choose should
# be specified in the form “internal-component-name:version”
# Below is a list of components you may specify to enable.
#
# oracle.oraolap:11.2.0.4.0 – Oracle OLAP
# oracle.rdbms.dm:11.2.0.4.0 – Oracle Data Mining
# oracle.rdbms.dv:11.2.0.4.0 – Oracle Database Vault
# oracle.rdbms.lbac:11.2.0.4.0 – Oracle Label Security
# oracle.rdbms.partitioning:11.2.0.4.0 – Oracle Partitioning
# oracle.rdbms.rat:11.2.0.4.0 – Oracle Real Application Testing
#——————————————————————————
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0

###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# —————————————— #
# Provide values for the OS groups to which OSDBA and OSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #   
# group “dba”, then that will be used unless specified otherwise below.    #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
###############################################################################

#——————————————————————————
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#——————————————————————————
oracle.install.db.DBA_GROUP=dba

#——————————————————————————
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
# The value to be specified for OSOPER group is optional.
#——————————————————————————
oracle.install.db.OPER_GROUP=oinstall

#——————————————————————————
# Specify the cluster node names selected during the installation.
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#——————————————————————————
oracle.install.db.CLUSTER_NODES=

#——————————————————————————
# This variable is used to enable or disable RAC One Node install.
#
# – true : Value of RAC One Node service name is used.
# – false : Value of RAC One Node service name is not used.
#
# If left blank, it will be assumed to be false
#——————————————————————————
oracle.install.db.isRACOneInstall=

#——————————————————————————
# Specify the name for RAC One Node Service.
#——————————————————————————
oracle.install.db.racOneServiceName=

#——————————————————————————
# Specify the type of database to create.
# It can be one of the following:
# – GENERAL_PURPOSE/TRANSACTION_PROCESSING
# – DATA_WAREHOUSE
#——————————————————————————
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#——————————————————————————
# Specify the Starter Database Global Database Name.
#——————————————————————————
oracle.install.db.config.starterdb.globalDBName=orcl

#——————————————————————————
# Specify the Starter Database SID.
#——————————————————————————
oracle.install.db.config.starterdb.SID=orcl

#——————————————————————————
# Specify the Starter Database character set.
#
# It can be one of the following:
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#——————————————————————————
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#——————————————————————————
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#——————————————————————————
oracle.install.db.config.starterdb.memoryOption=true

#——————————————————————————
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#——————————————————————————
oracle.install.db.config.starterdb.memoryLimit=

#——————————————————————————
# This variable controls whether to load Example Schemas onto
# the starter database or not.
#——————————————————————————
oracle.install.db.config.starterdb.installExampleSchemas=false

#——————————————————————————
# This variable includes enabling audit settings, configuring password profiles
# and revoking some grants to public. These settings are provided by default.
# These settings may also be disabled.
#——————————————————————————
oracle.install.db.config.starterdb.enableSecuritySettings=true

###############################################################################
# #
# Passwords can be supplied for the following four schemas in the    #
# starter database: #
# SYS #
# SYSTEM #
# SYSMAN (used by Enterprise Manager) #
# DBSNMP (used by Enterprise Manager) #
# #
# Same password can be used for all accounts (not recommended) #
# or different passwords for each account can be provided (recommended) #
# #
###############################################################################

#——————————————————————————
# This variable holds the password that is to be used for all schemas in the
# starter database.
#——————————————————————————-
oracle.install.db.config.starterdb.password.ALL=111111

#——————————————————————————-
# Specify the SYS password for the starter database.
#——————————————————————————-
oracle.install.db.config.starterdb.password.SYS=

#——————————————————————————-
# Specify the SYSTEM password for the starter database.
#——————————————————————————-
oracle.install.db.config.starterdb.password.SYSTEM=

#——————————————————————————-
# Specify the SYSMAN password for the starter database.
#——————————————————————————-
oracle.install.db.config.starterdb.password.SYSMAN=

#——————————————————————————-
# Specify the DBSNMP password for the starter database.
#——————————————————————————-
oracle.install.db.config.starterdb.password.DBSNMP=

#——————————————————————————-
# Specify the management option to be selected for the starter database.
# It can be one of the following:
# – GRID_CONTROL
# – DB_CONTROL
#——————————————————————————-
oracle.install.db.config.starterdb.control=DB_CONTROL

#——————————————————————————-
# Specify the Management Service to use if Grid Control is selected to manage
# the database.
#——————————————————————————-
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

###############################################################################
# #
# SPECIFY BACKUP AND RECOVERY OPTIONS #
# ————————————    #
# Out-of-box backup and recovery options for the database can be mentioned #
# using the entries below.    #   
# #
###############################################################################

#——————————————————————————
# This variable is to be set to false if automated backup is not required. Else
# this can be set to true.
#——————————————————————————
oracle.install.db.config.starterdb.automatedBackup.enable=false

#——————————————————————————
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily to backup
# the database. This job will run as the operating system user that is
# specified in this variable.
#——————————————————————————
oracle.install.db.config.starterdb.automatedBackup.osuid=

#——————————————————————————-
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily to backup
# the database. This job will run as the operating system user specified by the
# above entry. The following entry stores the password for the above operating
# system user.
#——————————————————————————-
oracle.install.db.config.starterdb.automatedBackup.ospwd=

#——————————————————————————-
# Specify the type of storage to use for the database.
# It can be one of the following:
# – FILE_SYSTEM_STORAGE
# – ASM_STORAGE
#——————————————————————————
oracle.install.db.config.starterdb.storageType=

#——————————————————————————-
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#——————————————————————————-
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

#——————————————————————————-
# Specify the backup and recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#——————————————————————————-
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

#——————————————————————————-
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
#——————————————————————————-
oracle.install.db.config.asm.diskGroup=

#——————————————————————————-
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
#——————————————————————————-
oracle.install.db.config.asm.ASMSNMPPassword=

#——————————————————————————
# Specify the My Oracle Support Account Username.
#
# Example : MYORACLESUPPORT_USERNAME=abc@oracle.com
#——————————————————————————
MYORACLESUPPORT_USERNAME=

#——————————————————————————
# Specify the My Oracle Support Account Username password.
#
# Example : MYORACLESUPPORT_PASSWORD=password
#——————————————————————————
MYORACLESUPPORT_PASSWORD=

#——————————————————————————
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#——————————————————————————
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

#——————————————————————————
# Specify whether user doesn’t want to configure Security Updates.
# The value for this variable should be true if you don’t want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example : DECLINE_SECURITY_UPDATES=false
#——————————————————————————
DECLINE_SECURITY_UPDATES=true

#——————————————————————————
# Specify the Proxy server name. Length should be greater than zero.
#
# Example : PROXY_HOST=proxy.domain.com
#——————————————————————————
PROXY_HOST=

#——————————————————————————
# Specify the proxy port number. Should be Numeric and at least 2 chars.
#
# Example : PROXY_PORT=25
#——————————————————————————
PROXY_PORT=

#——————————————————————————
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_USER=username
#——————————————————————————
PROXY_USER=

#——————————————————————————
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_PWD=password
#——————————————————————————
PROXY_PWD=

#——————————————————————————
# Specify the proxy realm. This value is used if auto-updates option is selected.
#
# Example : PROXY_REALM=metalink
#——————————————————————————
PROXY_REALM=

#——————————————————————————
# Specify the Oracle Support Hub URL.
#
# Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#——————————————————————————
COLLECTOR_SUPPORTHUB_URL=

#——————————————————————————
# Specify the auto-updates option. It can be one of the following:
# – MYORACLESUPPORT_DOWNLOAD
# – OFFLINE_UPDATES
# – SKIP_UPDATES
#——————————————————————————
oracle.installer.autoupdates.option=
#——————————————————————————
# In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where
# the updates are to be downloaded.
# In case OFFLINE_UPDATES option is chosen, specify the location where the updates
# are present.
#——————————————————————————
oracle.installer.autoupdates.downloadUpdatesLoc=
#——————————————————————————
# Specify the My Oracle Support Account Username which has the patches download privileges
# to be used for software updates.
# Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com
#——————————————————————————
AUTOUPDATES_MYORACLESUPPORT_USERNAME=

#——————————————————————————
# Specify the My Oracle Support Account Username password which has the patches download privileges
# to be used for software updates.
#
# Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password
#——————————————————————————
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

在解压目录执行如下命令:

[oracle@oracle database]$./runInstaller -silent -responseFile /home/oracle/soft/database/response/db_install.rsp

出现警告可以不用管

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

可以另开窗口查看安装进度:

[oracle@oracle response]$tailf /home/oracle/app/oraInventory/logs/installActions2017-08-02_02-37-56AM.log

 安装到最后出会出现:

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

切换到 ROOT 账户执行两个脚本

[oracle@oracle response]$sh /home/oracle/app/oraInventory/orainstRoot.sh

[oracle@oracle response]$sh /home/oracle/app/product/11.2.0/db_1/root.sh

数据库安装完成

三、监听静默安装

[oracle@oracle response]$ netca /silent /responsefile /home/soft/database/response/netca.rsp

netca.rsp 脚本内容如下

Parsing command line arguments:
Parameter “silent” = true
Parameter “responsefile” = /home/soft/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/home/oracle/app/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0

[oracle@oracle response]$ vim /home/oracle/app/product/11.2.0/db_1/network/admin/listener.ora

修改前

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

查看监听状态:

[oracle@oracle response]$ lsnrctl status

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

停止监听

[oracle@oracle response]$ lsnrctl stop

[oracle@oracle response]$ lsnrctl start

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

四、静默创建数据库

数据库脚本

dbca_orcl.rsp 内容如下:

[GENERAL]
RESPONSEFILE_VERSION = “11.2.0”
OPERATION_TYPE = “createDatabase”
[CREATEDATABASE]
GDBNAME = “orcl”
SID = “orcl”
TEMPLATENAME = “General_Purpose.dbc”
STORAGETYPE=FS
DATAFILEDESTINATION =/home/oracle/app/oradata
#RECOVERYAREADESTINATION=/opt/app/flash_recovery_area

CHARACTERSET = “AL32UTF8”
NATIONALCHARACTERSET= “AL16UTF16”
LISTENERS=LISTENER
TOTALMEMORY = “700”
SYSPASSWORD = “111111”
SYSTEMPASSWORD = “111111”

[oracle@oracle response]$ dbca -silent  -responseFile ./dbca_orcl.rsp

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

 遇到的问题

ERROR:
ORA-12162: TNS:net service name is incorrectly specified

解决办法:

可能是初始化脚本有问题造成的,于是修改环境变量的 SID 值为 orcl

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

执行 sqlplus / as sysdba  成功

CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

用 sqldeveloper 连接

 CentOS 6.9 下 Oracle 11gR2 静默安装单实例(待优化版)

欢迎大家交流。

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-10/147824.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计28137字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中