一、准备工作:
1、修改主机名并重新登陆:
hostnamectl set-hostname ora11gr2
exit
2、挂载本地ISO并配置本地YUM源:
此步骤可加到下面的参数配置脚本中一起运行!这里先分开看一下本地yum源的配置过程,若服务器可连网,此步骤省略!
mount /dev/cdrom /mnt
cd /etc/yum.repos.d/
mkdir bak
mv *.repo ./bak/
> local.repo
cat >> local.repo << "EOF"
[LOCAL]
name=LOCAL
baseurl=file:///mnt/
gpgcheck=0
enabled=1
EOF
yum clean all
yum makecache
二、参数配置脚本:
此参数脚本可直接复制一键执行!
echo "--vi /etc/hosts--"
echo
cat >> /etc/hosts << "EOF"
192.168.97.82 ora11gr2
EOFecho "--turn off firewall--"
echo
systemctl stop firewalld
systemctl disable firewalldecho "--turn off selinux--"
echo
SELINUX=`grep ^SELINUX= /etc/selinux/config`
if [ $SELINUX != "SELINUX=disabled" ];thencp /etc/selinux/config /etc/selinux/config.baksed -i 's/^SELINUX=/#SELINUX=/g' /etc/selinux/configsed -i '$a SELINUX=disabled' /etc/selinux/config
elseecho "SELINUX is already disabled"
fi
setenforce 0yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.i686 libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686rpm -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-develgroupadd dba
groupadd oinstall
useradd oracle -g oinstall -G dba
echo 123456 | passwd --stdin oracle
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01echo "--vim /etc/sysctl.conf--"
echo
cat >> /etc/sysctl.conf << "EOF"
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 4294967296
#kernel.shmmax的值一般设为物理内存的一半,大于SGA_MAX_TARGET或MEMORY_MAX_TARGET的值
kernel.shmall = 2097152
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
EOF
sysctl -pecho "--vim /etc/security/limits.conf--"
echo
cat >> /etc/security/limits.conf << "EOF"
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOFecho "--vim /etc/pam.d/login--"
echo
cat >> /etc/pam.d/login << "EOF"
session required pam_limits.so
EOFecho "--vim /etc/profile--"
echo
cat >> /etc/profile << "EOF"
if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
source /etc/profilesu - oracle
cat >> .bash_profile << "EOF"
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG="en_US.UTF-8"
export NLS_LANG=american_AMERICA.AL32UTF8
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
EOFsource .bash_profile
三、静默安装:
1、上传软件到/tmp目录并解压:
su - oracle
cd /tmp/
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
2、参数准备:
此参数脚本可直接复制一键执行!
su - oracle
cd
mkdir etc
cp /tmp/database/response/* /home/oracle/etc/
ls etc/
exit
chmod 700 /home/oracle/etc/*.rspsu - oracle
echo "--vi /home/oracle/etc/db_install.rsp--"
echo
cat >> /home/oracle/etc/db_install.rsp << "EOF"
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=ora11gr2
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.memoryLimit=2048
oracle.install.db.config.starterdb.password.ALL=123456
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
EOF
3、静默安装Oracle软件:
cd /tmp/database
./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
安装过程如下:
[oracle@ora11gr2 database]$ ./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 39966 MB Passed
Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-04-10_04-06-44PM. Please wait ...[oracle@ora11gr2 database]$ [WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2019-04-10_04-06-44PM/installActions2019-04-10_04-06-44PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2019-04-10_04-06-44PM/installActions2019-04-10_04-06-44PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2019-04-10_04-06-44PM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2019-04-10_04-06-44PM.log' for more details.As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
根据提示运行以上两个脚本来完成安装!
4、配置监听:
netca /silent /responsefile /home/oracle/etc/netca.rsp过程如下:
--------------------------------------------------------------------------
Parsing command line arguments:Parameter "silent" = trueParameter "responsefile" = /home/oracle/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:Running Listener Control: /u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENERListener Control complete.Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
--------------------------------------------------------------------------
查看监听:
lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-APR-2019 16:34:44Copyright (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 10-APR-2019 16:33:05
Uptime 0 days 0 hr. 1 min. 40 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ora11gr2/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11gr2)(PORT=1521)))
The listener supports no services
The command completed successfully
5、静默安装数据库:
配置参数:
vi /home/oracle/etc/dbca.rsp修改以下参数:
-------------------------------------
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "AL32UTF8"
---------------------------------------
静默dbca建库:
dbca -silent -responseFile /home/oracle/etc/dbca.rsp
过程如下:
Enter SYS user password:
Enter SYSTEM user password:
注意:以上提示输入密码的地方有可能看不到字,全是空白,可能是显示问题,不要紧,只管输入两次密码!
密码正确后开始如下安装过程:
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
33% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% 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 "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
6、检测结果:
[oracle@ora11gr2 database]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-APR-2019 16:57:40
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 10-APR-2019 16:33:05
Uptime 0 days 0 hr. 24 min. 36 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ora11gr2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11gr2)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully[oracle@ora11gr2 database]$
[oracle@ora11gr2 database]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 10 16:58:48 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> select status from v$instance;
STATUS
------------
OPEN
至此,静默安装已全部完成!