[Oracle]静默安装11g Database软件

博客首页 » Oracle静默安装11g Database软件

发布于 23 Aug 2014 07:42
标签 blog
Oracle静默安装11g Database软件

静默安装oracle 11g
http://blog.csdn.net/junshi66/article/details/38085183

停止防火墙,selinux
chkconfig iptables off
service iptables stop
vim /etc/selinux/config 修改SELINUX=disabled ,重启后生效
setenforce 0 ,不需要重启,立即生效,只限于当次

检查rpm包
rpm -q —queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat numactl unixODBC unixODBC-devel | grep "not installed" | grep -v grep | awk '{print "yum install -y " $2 }'

vi /etc/sysctl.conf

cat » /etc/sysctl.conf «EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 -p

vim /etc/security/limits.conf

cat » /etc/security/limits.conf «EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF

vi /etc/pam.d/login

cat » /etc/pam.d/login «EOF
session required pam_limits.so
EOF

session required /lib/security/pam_limits.so -32bit
session required /lib64/security/pam_limits.so -
64bit

vi /etc/profile

cat » /etc/profile «EOF
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF

找到ulimit –S –c 0 > /dev/null 2>&1
改成
ulimit -S -c unlimited > /dev/null 2>&1

vi /etc/csh.login

cat » /etc/csh.login «EOF
if( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
passwd oracle

mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app/

su - oracle
vim .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=demo
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_BASE ORACLE_SID ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME/bin

或者 参考:
vim demo.env
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=demo
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PS1=$LOGNAME@‘hostname`:’$PWD>'
export SQLPATH=$ORACLE_HOME/sqlplus/admin:/home/oracle/admin/sql
alias ohome="cd $ORACLE_HOME"
alias taf="tail -f /u01/app/oracle/diag/rdbms/demo/demo/trace/alert_demo.log"
ulimit -u 16384 -n 63536 #linux
esc="033["
echo " "
echo " "
echo -e "${esc}31;1m${esc}0m"
echo -e "${esc}31;1m
*This is PRODUCT , Please be careful of your operation!*${esc}0m"
echo -e "${esc}31;1m
${esc}0m"
echo " "
echo " "

安装
1 此步骤很重要,如果忽略 ,最终会提示inventory 文件目录非空 导致静默安装失败
vim /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

因为11.2的静默安装需要提供MOS的username,password 所以静默安装 11.2.0.1 采用 debug模式安装 ,如果有异常则更容易发现错误原因。
./runInstaller -silent -noconfig -ignorePrereq -responseFile /home/oracle/db.rsp —-会报错

cd $ORACLESOFT_mount/database
./runInstaller -silent -debug -force FROM_LOCATION=/mnt/hgfs/database/stage/products.xml oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 ORACLE_HOME_NAME="Oracle111" ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=false oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true

运行到
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run

/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration 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

另打开一个终端 运行root.sh
最好先运行/u01/app/oraInventory/orainstRoot.sh
[root@test6 ~]# . /u01/app/oraInventory/orainstRoot.sh
[root@test6 ~]# . /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_test6_2014-07-24_14-38-43.log for the output of root script

查看/u01/app/oracle/product/11.2.0/dbhome_1/install/root_test6_2014-07-24_14-38-43.log日志
[root@test6 ~]# cat /u01/app/oracle/product/11.2.0/dbhome_1/install/root_test6_2014-07-24_14-38-43.log

Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

至此软件安装成功

直接编辑监听文件 不使用netca建立listener.ora
cat listener.ora

  1. listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  2. Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test6)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /u01/app/oracle

grep -Ev '^(#|$)' urfile
静默安装db
安装完成oracle软件之后还没创建db,我们可以继续使用静默方式创建数据库。
cd /mnt/hgfs/database/response
[oracle@test6 response]$ grep -Ev '^(#|$)' dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl11g.us.oracle.com"
SID = "orcl11g"
TEMPLATENAME = "General_Purpose.dbc"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"

grep -Ev '^(#|$)' dbca.rsp » /home/oracle/dbca.rsp

cd /home/oracle
[oracle@test6 ~]$ vim dbca.rsp

[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "demo"
SID = "demo"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION ="/u01/app/oracle/oradata"
STORAGETYPE=FS
CHARACTERSET = "AL32UTF8"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"
TOTALMEMORY =8192

运行:
dbca -silent -responseFile /home/oracle/dbca.rsp
[oracle@test6 admin]$ dbca -silent -responseFile /home/oracle/dbca.rsp
sh: /bin/ksh: No such file or directory
sh: /bin/ksh: No such file or directory
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

tnsname.ora
DEMO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test6)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = demo)
)
)

**参考
http://blog.itpub.net/22664653/viewspace-1062585/
附上oracle软件静默安装的参数含义如下:
-silent 表示以静默方式安装,不会有任何提示
-force 表示允许安装到一个非空目录
-noconfig 表示不运行配置助手netca
-responseFile 表示使用哪个响应文件,必需使用绝对路径
oracle.install.responseFileVersion 响应文件模板的版本,该参数不要更改
oracle.install.option 安装模式选项,本例只安装oracle软件,该参数不要更改
DECLINE_SECURITY_UPDATES 是否需要在线安全更新,设置为false,该参数不要更改
UNIX_GROUP_NAME oracle 用户用于安装软件的组名
INVENTORY_LOCATION oracle 产品清单目录
SELECTED_LANGUAGES oracle 运行语言环境,一般包括引文和简繁体中文
ORACLE_HOME oracle安装目录
ORACLE_BASE oracle基础目录
oracle.install.db.InstallEdition 安装版本类型,一般是企业版
oracle.install.db.isCustomInstall 是否定制安装,默认Partitioning,OLAP,RAT都选上。根据自己的需要选择组件。
oracle.install.db.customComponents 定制安装组件列表:除了以上默认的,可加上Label Security和Database Vault
oracle.install.db.DBA_GROUP oracle 用户用于授予osdba权限的组名
oracle.install.db.OPER_GROUP oracle 用户用于授予osoper权限的组名

问题一 相信这个问题也是很多人也会遇到
[FATAL] [INS-32035] Unable to create a new central inventory at the specified location.
CAUSE: The central inventory location provided is not empty.
ACTION: Please provide another location for the inventory, or clean up the current location.
解决方法:
使用root vim /etc/oraInst.doc 加入
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

问题二
[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.
解决方法:
如提示所言 Inventory 目录安装在了$ORACLE_BASE 目录下了,所以调整Inventory 目录不在$ORACLE_BASE 目录下,即可解决问题。

问题三
lsnrctl start

LSNRCTL for Linux:Version 11.2.0.1.0 - Production on 24-JUL-2014 15:43:14

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

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

TNSLSNR for Linux:Version 11.2.0.1.0 - Production
System parameter file is/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to/u01/app/oracle/diag/tnslsnr/test6/listener/alert/log.xml
Error listening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test6)(PORT=1521)))

这是因为 没有在hosts文件中解析主机名造成的。
oraInventory 存放Oracle软件安装的目录信息,Oralce的安装和升级都需要用到这个目录,删除或丢失oraInventory目录的内容就会导致安装/升级失败。
Oracle官方文档对oraInventory的说明:
All Oracle software installations rely on this directory.
Ensure that you back it up regularly.
Do not delete this directory unless you have completely removed
all Oracle software from the system.
oraInventory 目录的位置是由oraInst.loc 文件决定的:
/etc/oraInst.loc (AIX and Linux Platform)
/var/opt/oracle/OraInst.loc (Solaris and HP-UX platform)


本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用,仅有一个特殊要求,请用链接方式注明文章引用出处及作者。请协助维护作者合法权益。


系列文章

文章列表

  • Oracle静默安装11g Database软件

这篇文章对你有帮助吗,投个票吧?

rating: 0+x

留下你的评论

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License