#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba -d/oracle oracle ---------------创建oracle用户,默认家目录为oracle
#passwd oracle
#su - oracle
$vi .bash_profile
添加如下变量:
ORACLE_SID=orcl
ORACLE_BASE=/oracle/app/oracle
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID ORACLE_BASEORACLE_HOME PATH ----------------使这些变量成为环境变量
stth erase ^h ----------------这个是使回头进入到sqlplus后可以使用返回键
保存后执行下面命令使其生效
$source .bash_profile
$env | grep ORA-------------查看是否生效
# vi /etc/sysctl.conf
添加如下参数:(参考oracle官方安装文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm)
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
使生效
#sysctl -t
添加如下参数:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
(同样参考oracle官方安装文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm)
The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6must be installed:
binutils-2.20.51.0.2-5.11.el6(x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6(x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6(x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6(x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6(x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6(x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
其他软件所需包,不是必须的但建议一块安装
Oracle ODBC Drivers包:
On OracleLinux 6 and Red Hat Enterprise Linux 6:
安装命令:
#rpm -ivf *.rpm --force --nodeps ----------如果有些包安装不上就加上后边的两个参数进行强制安装
#rpm -evf *.rpm --nodeps -----------强制卸载rpm
#mkdir -p /u01/app/oracle
#chown -R oracle.oinstall /u01 ----修改文件的用户和属组
说明:
db_install.rsp文件在oracle安装文件中是自带的:/database/response下边有三个文件分别是
:db_install---数据库软件安装配置文件,如果使用这个需要手动配置,但是也可以使用图形界面安装一遍后保 存一个这样的配置文件共以后使用
:netca.rsp ---这个是配置监听的,可以直接使用
:dbca.rsp ---这个是创建database的,必须手动配置
db_install.rsp配置
执行命令:
命令:$./runInstaller-silent -noconfig -force -responseFile /oracle/install/db_install.rsp
参数:-silent---指oracle采用静默安装
-noconfig---指oracle安装过程中不创建database
-force---遇到非空目录也强制安装
-responseFile---指定应答文件路径(注意后边路径一定是绝对路径)
安装启动:
[oracle@oracle11database]$ ./runInstaller -silent -noconfig -force -responseFile/media/database/response/db_install.rsp
Starting OracleUniversal Installer...
Checking Temp space:must be greater than 120 MB. Actual15657 MB Passed
Checking swap space:must be greater than 150 MB. Actual4031 MB Passed
Preparing to launchOracle Universal Installer from /tmp/OraInstall2013-10-22_12-04-07PM. Pleasewait ...[oracle@oracle11 database]$ [WARNING] [INS-13014] Target environment donot meet some optional requirements.
CAUSE: Some of the optional prerequisitesare not met. See logs for details./tmp/OraInstall2013-10-22_12-04-07PM/installActions2013-10-22_12-04-07PM.log
ACTION: Identify the list of failedprerequisite checks from the log:/tmp/OraInstall2013-10-22_12-04-07PM/installActions2013-10-22_12-04-07PM.log.Then either from the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.
[WARNING][INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisitesare not met. See logs for details./tmp/OraInstall2013-10-22_12-04-07PM/installActions2013-10-22_12-04-07PM.log
ACTION: Identify the list of failedprerequisite checks from the log:/tmp/OraInstall2013-10-22_12-04-07PM/installActions2013-10-22_12-04-07PM.log.Then either from the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.
You can find the logof this install session at:
/u01/app/oraInventory/logs/installActions2013-10-22_12-04-07PM.log
------------------------------------------------------------------------
-----------
-----------半小时后出现下面,执行两条脚本后安装完成…
--------------------------------------------------------------------------
The followingconfiguration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute theconfiguration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit"Enter" key to continue
Successfully SetupSoftware.
The followingconfiguration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute theconfiguration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit"Enter" key to continue
Successfully SetupSoftware.
说明:
---上面这一步之前发生了个小插曲,由于在安装过程中按回车键会自动跳出且有prerequisite的warning,然后就修改了文件和目录最后导致安装失败,其实当时细心点会发现oracle的后台进程其实一直在运行的:
ps -ef|grep ora
[root@test /]# du -sh /u01
998M /u01
[root@test /]# du -sh /u01
1.7G /u01
[root@test /]# du -sh /u01
1.7G /u01
安装期间可以监控
[oracle@oracle11logs]$ tail -f installActions2013-10-22_12-04-07PM.log
可以ps -ef|grep oracle查看安装进程是否进行
配置netca.rsp -----保持默认即可
[oracle@oracle11 database]$ netca /silent /responsefile response/netca.rsp ----此处必须写绝对路径
Parsingcommand line arguments:
Parameter "silent" = true
Parameter "responsefile" =response/netca.rsp
Oracle NetConfiguration Assistant could not find the Response File at the given location.
Oracle NetServices configuration failed. The exitcode is 1
执行命令:
[oracle@oracle11database]$ netca /silent /responsefile /media/database/response/netca.rsp
Parsing command linearguments:
Parameter "silent" = true
Parameter "responsefile" =/media/database/response/netca.rsp
Done parsingcommand line arguments.
Oracle Net ServicesConfiguration:
Profileconfiguration complete.
Oracle Net ListenerStartup:
Running Listener Control:
/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctlstart LISTENER
Listener Control complete.
Listener started successfully.
Listenerconfiguration complete.
Oracle Net Services configurationsuccessful. The exit code is 0
成功!!!
成功运行后,在/u01/app/oracle/product/11.2.0/db_1/network/admin目录下生成sqlnet.ora和listener.ora两个文件。
通过netstat -tlnp 命令,看到
tcp 0 0 :::1521 :::* LISTEN 5477/tnslsnr
说明监听器已经在1521端口上开始工作了。
配置dbca.rsp
然后
执行命令:
[oracle@oracle11 database]$ dbca -silent -responsefile /media/database/response/dbca.rsp --绝对路径
Enter SYSTEM userpassword:
Copying databasefiles
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating andstarting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing DatabaseCreation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file"/u01/app/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log" for furtherdetails.
安装成功,比图形化界面快多了,大概需要10分钟.
查看进程:
ps -ef | grep ora_ | grep -v grep
静默安装Oracle时提示:"[SEVERE] - Email Address Not Specified"
静默安装Oracle时提示:"[SEVERE]- Email Address Not Specified"
系统环境:CentOS 6.3 x86_64 + Oracle 11gR2
解决办法:
修改responseFile文件,将DECLINE_SECURITY_UPDATES=的值设为true,如果为空系统会假设该值为false,DECLINE_SECURITY_UPDATES=的值默认为空。
$ ./runInstaller -silent -responseFile /home/oracle/database/db_install.rsp
备注:
1.-responseFile参数后是空格,然后直接跟路径(-responseFilepath),而不是-responseFile=/path