本次演示是在linux环境下静默安装oracle11gR2
环境: VM + rhel6.6+ oracle11gR2
Rhel6安装包: rhel-server-6.6-x86_64-dvd.iso
oracle11gR2安装包:p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
rhel6 安装包目录为: /u01/setup/rhel6Setup
oracle安装包目录为: /u01/setup/oracleSetup
一:安装linux
1)linux安装包
- Base System > Base
- Base System > Client management tools
- Base System > Compatibility libraries
- Base System > Hardware monitoring utilities
- Base System > Large Systems Performance
- Base System > Network file system client
- Base System > Performance Tools
- Base System > Perl Support
- Servers > Server Platform
- Servers > System administration tools
- Desktops > Desktop
- Desktops > Desktop Platform
- Desktops > Fonts
- Desktops > General Purpose Desktop
- Desktops > Graphical Administration Tools
- Desktops > Input Methods
- Desktops > X Window System
- Development > Additional Development
- Development > Development Tools
- Applications > Internet Browser
二:安装准备
1)修改 /etc/hosts文件
[root@localhost Server]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.110 localhost.localdomain localhost
2)修改防火墙设置
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
3)修改 /etc/selinux/config文件
SELINUX=disabled
4)指定本地yum源
对/etc/yum.repos.d/rhel-source.repo 进行修改
[root@localhost ~]# vi /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever -$basearch - Source
baseurl=file:///u01/setup/rhel6Setup/Server
enabled=1
gpgcheck=1
gpgkey=file:///u01/setup/rhel6Setup/RPM-GPG-KEY-redhat-release
5)添加内核参数 /etc/sysctl.conf
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576 --文件系统最大异步io
fs.file-max = 6815744 --文件系统中最大文件个数
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096 --最小共享内存大小 bytes
# semaphores: semmsl, semmns, semopm,semmni
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
修改完成后执行 /sbin/sysctl -p
6)添加 /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
7)添加oracle用户和组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
8)添加目录和权限
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
9)添加Oracle环境变量
切换oracle用户,并添加目录下的.bash_profile文件
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export TMP=/tmp
export TMPDIR=$TMP
umask 022
三:安装数据库软件
1)修改配置安装模板文件(db_install.rsp)
[root@localhost ~]# cd /u01/setup/oracleSetup/database/
[root@localhost database]# vi response/db_install.rsp
db_install.rsp 详解:blog.csdn.net/iw1210/article/details/38703071
2)安装数据库软件
切换到oracle用户
[root@localhost database]# su – oracle
[oracle@localhost ~]$ cd /u01/setup/oracleSetup/database/
安装数据库软件(这里演示正常安装情况;我安装时出现两个错误,参照附1、附2)
[oracle@localhost database]$ ./runInstaller-ignorePrereq -silent -responseFile/u01/setup/oracleSetup/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than120 MB. Actual 26709 MB Passed
Checking swap space: must be greater than150 MB. Actual 7999 MB Passed
Preparing to launch Oracle UniversalInstaller from /tmp/OraInstall2015-11-18_08-28-38AM. Please wait...[oracle@localhost database]$ [WARNING] [INS-32055] The Central Inventory islocated in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a locationoutside the Oracle base directory.
You can find the log of this installsession at:
/u01/app/oracle/oraInventory/logs/installActions2015-11-18_08-28-38AM.log
The installation of Oracle Database 11g wassuccessful.
Please check'/u01/app/oracle/oraInventory/logs/silentInstall2015-11-18_08-28-38AM.log' formore details.
As a root user, execute the followingscript(s):
1. /u01/app/oracle/oraInventory/orainstRoot.sh
2./u01/app/oracle/product/11.2.0/db_1/root.sh
Successfully Setup Software.
上述红字注解:
安装时间有点长,可以打开另一个终端,执行
#tail -100 f /u01/app/oracle/oraInventory/logs/installActions2015-11-18_08-28-38AM.log
跟踪查看安装日志,了解安装的进度。
安装最后要求,以root用户执行脚本:
[root@localhost ~]#/u01/app/oracle/oraInventory/orainstRoot.sh
[root@localhost ~]#/u01/app/oracle/product/11.2.0/db_1/root.sh
检查一下数据库软件
[oracle@localhost database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production onWed Nov 18 08:36:00 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
四:安装数据库
1)修改配置安装模板文件(dbca.rsp)
[root@localhost ~]# cd /u01/setup/oracleSetup/database/
[root@localhost database]# vi response/dbca.rsp
以下是几个重要的参数:
RESPONSEFILE_VERSION ="11.2.0" --不能更改OPERATION_TYPE = "createDatabase"
GDBNAME = "orcl" --全局数据库的名字=SID+主机域名
SID = "orcl" --对应的实例名字
TEMPLATENAME = "General_Purpose.dbc" --建库用的模板文件
SYSPASSWORD = "system" --SYS管理员密码
SYSTEMPASSWORD = "system" --SYSTEM管理员密码
DATAFILEDESTINATION = /u01/app/oracle/oradata --数据文件存放目录
RECOVERYAREADESTINATION=/u01/app/oracle/oradata_backup --恢复数据存放目录
CHARACTERSET = "ZHS16GBK" --字符集
TOTALMEMORY ="1200" --oracle内存1200MB
2)安装数据库
[oracle@localhost database]$ dbca -silent -responseFile /u01/setup/oracleSetup/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% 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.
检查数据库
[oracle@localhost database]$ ps -ef | grep ora_ | grep -v grep
oracle 7901 1 0 09:04 ? 00:00:00 ora_pmon_orcl
oracle 7903 1 0 09:04 ? 00:00:00 ora_psp0_orcl
oracle 7905 1 1 09:04 ? 00:00:01 ora_vktm_orcl
oracle 7909 1 0 09:04 ? 00:00:00 ora_gen0_orcl
oracle 7911 1 0 09:04 ? 00:00:00 ora_diag_orcl
oracle 7913 1 0 09:04 ? 00:00:00 ora_dbrm_orcl
oracle 7915 1 0 09:04 ? 00:00:00 ora_dia0_orcl
oracle 7917 1 0 09:04 ? 00:00:00 ora_mman_orcl
oracle 7919 1 0 09:04 ? 00:00:00 ora_dbw0_orcl
oracle 7921 1 0 09:04 ? 00:00:00 ora_lgwr_orcl
oracle 7923 1 0 09:04 ? 00:00:00 ora_ckpt_orcl
oracle 7925 1 0 09:04 ? 00:00:00 ora_smon_orcl
oracle 7927 1 0 09:04 ? 00:00:00 ora_reco_orcl
oracle 7929 1 0 09:04 ? 00:00:00 ora_mmon_orcl
oracle 7931 1 0 09:04 ? 00:00:00 ora_mmnl_orcl
oracle 7933 1 0 09:04 ? 00:00:00 ora_d000_orcl
oracle 7935 1 0 09:04 ? 00:00:00 ora_s000_orcl
oracle 7943 1 0 09:04 ? 00:00:00 ora_qmnc_orcl
oracle 7961 1 0 09:04 ? 00:00:00 ora_cjq0_orcl
oracle 7963 1 0 09:04 ? 00:00:00 ora_q000_orcl
oracle 7965 1 0 09:04 ? 00:00:00 ora_q001_orcl
五:配置监听
1)配置监听:netca.rsp
[oracle@localhost database]$ netca -silent -responsefile /u01/setup/oracleSetup/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" =/u01/setup/oracleSetup/database/response/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/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configurationsuccessful. The exit code is 0
2)查看监听状态
[oracle@localhost database]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 -Production on 18-NOV-2015 09:09:42
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: Version11.2.0.4.0 - Production
Start Date 18-NOV-2015 09:08:58
Uptime 0 days 0 hr. 0 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for thisservice...
Service "orclXDB" has 1instance(s).
Instance "orcl", status READY, has 1 handler(s) for thisservice...
The command completed successfully
附1(Email Address NotSpecified)
Starting Oracle Universal Installer...
Checking Temp space: must be greater than120 MB. Actual 26709 MB Passed
Checking swap space: must be greater than150 MB. Actual 7999 MB Passed
Preparing to launch Oracle UniversalInstaller from /tmp/OraInstall2015-11-17_10-18-38PM. Please wait ...$ [oracle@localhostdatabase] - Email Address Not Specified
解决方案:
在安装模板中将 DECLINE_SECURITY_UPDATES 参数的值改为true,即:
DECLINE_SECURITY_UPDATES=true // 参见上述的安装模板文件db_install.rsp
附2
[FATAL] [INS-13013] Target environment donot meet some mandatory requirements.
CAUSE: Some of the mandatory prerequisites are not met. See logs fordetails. /u01/app/oracle/oraInventory/logs/installActions2015-11-17_10-28-38PM.log
ACTION: Identify the list of failed prerequisite checks from thelog: /u01/app/oracle/oraInventory/logs/installActions2015-11-17_10-28-38PM.log.Then either from the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.
解决方案:
在安装命令中加入选项 -ignorePrereq 可以解决
在命令行中加入 -ignorePrereq 选项,再执行:
[oracle@localhost database]$ ./runInstaller -ignorePrereq -silent -responseFile /u01/setup/oracleSetup/database/response/db_install.rsp