请参考这里
http://www.calis.edu.cn/calisnew/images1/neikan/6/3-2.htm
***********************************
基于RESPONSE FILE文件的ORACLE 10G安装
CALIS管理中心 马骁生
众所周知对于ORACLE软件的安装,大多数环境中我们通过Oracle Universal Installer (OUI)工具,能够简单方便的实现软件安装和数据库创建。但是在某些特殊的情况,如出现网络速度,防火墙,XSERVER等问题,我们不得不借助 ORACLE SILENT 安装模式。具体到CALIS的项目,虽然有红旗提供的Oracle安装向导(oranavi命令),可是有些时候我们发现部分老师在安装的时候还存在不少问题,针对这种情况,特此编写了以下脚本文件以满足部分老师的需求。
1 .试验环境要求描述
1.1 硬件环境:物理内存512M,硬盘空间:4G,虚拟内存:1G
1.2 操作系统:RedFlag 5.0
1.3 数据库:ORACLE 10.1.0.3.0
1.4 Oracle原始介质:光盘
1.5 安装目录:/u01
1.6 数据库创建为本地文件系统
2 .安装准备阶段,以root身份登录, 编辑如下文件
2.1创建用户和组
vi Create_user_and_group.sh
#!/bin/bash
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
echo password|passwd --stdin oracle
2.2创建目录并修改权限
vi create_directory.sh
#!/bin/bash
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/oradata
chown -R oracle
install /u01/app/oracle
chmod -R 775 /u01/app/oracle /u02/oradata
2.3修改系统参数文件
vi config_sysparameter.sh
#!/bin/bash
cp /etc/sysctl.conf /etc/sysctl.conf.bak
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
EOF
/sbin/sysctl ?p
2.4配置RedFlag 许可文件
vi config_release.sh
#!/bin/bash
mv /etc/redhat-release /etc/redhat-release.bak
cat >>/etc/redhat-release << EOF
Red Hat Enterprise Linux AS release 2.1 (Nahant Update 1)
EOF
2.5配置安全参数
vi config_secrity.sh
#!/bin/bash
cp /etc/security/limits.conf /etc/security/limits.conf.bak
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
2.6配置用户参数文件
vi oracle_bash_profile.sh
#!/bin/bash
cat >> /home/oracle/.bash_profile <<EOF
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1;export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=/u01/app/oracle/product/10.1.0/db_1/bin
PATH;export PATH
LD_LIBRARY_PATH=/u01/app/oracle/product/10.1.0/db_1/jdk/jre/lib/i386;export
D_LIBRARY_PATH LD_LIBRARY_PATH=$ORACLE_HOME
/jdk/jre/lib/i386/server
LD_LIBRARY_PATH;
export LD_LIBRARY_PATH
EOF
2.7配置oraInst.loc文件
vi config_orainst_loc.sh
#!/bin/bash
cat >> /etc/oraInst.loc << EOF
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
EOF
2.8编辑enterprise management response file
vi enterprise.sh
#!/bin/bash
cat >> /PATH/enterprise.rsp << EOF
RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME="oinstall"
#UNIX安装用户组
FROM_LOCATION="/mnt/cdrom/stage/products.xml"
#Oracle install location
FROM_LOCATION_CD_LABEL=<Value Unspecified>
ORACLE_HOME="/u01/app/oracle/product/10.1.0/db_1"
ORACLE_HOME_NAME="OUIHome1"
TOPLEVEL_COMPONENT={"oracle.server","10.1.0.3.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=flase
SHOW_CUSTOM_TREE_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=false
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_ROOTSH_CONFIRMATION=false
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=true
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=true
#NEXT_SESSION_RESPONSE=" "
DEINSTALL_LIST={"oracle.server","10.1.0.3.0"}
SHOW_DEINSTALL_CONFIRMATION=true
SHOW_DEINSTALL_PROGRESS=true
CLUSTER_NODES={}
ACCEPT_LICENSE_AGREEMENT=true
SELECTED_LANGUAGES={"en"}
INSTALL_TYPE="Enterprise Edition"
sl_superAdminPasswds="oracle"
#sys 用户密码为oracle
sl_migrateSIDDialogReturn={}
sl_dlgASMCfgSelectableDisks={}
s_superAdminSamePasswd="oracle"
#sys 用户确认密码
s_superAdminPasswdType="S"
s_loadExampleSchemas="Y"
s_globalDBName="orcl"
#Oracle database SID
s_dlgStarterDBConfigCreateStarterDB="Create a starter database"
s_dlgSIDMigrateSelection="N"
s_dlgRBORecoveryOptionSelected="File System"
s_dlgRBOEnableAutoBackups="Do not enable Automated backups"
s_dlgEMEmailNotificationSelected="N"
s_dlgASMCfgRedundancyValue="2 (Norm)"
s_dlgASMCfgRedundancySelected="Normal"
s_dlgASMCfgNewDisksSize="0"
s_dlgASMCfgExistingFreeSpace="0"
s_dlgASMCfgDiskGroupName="DATA"
s_dlgASMCfgDiskDiscoveryString=""
s_dlgASMCfgAdditionalSpaceNeeded=" MB"
s_dbRetChar="Unicode standard UTF-8 AL32UTF8"
sl_dlgASMDskGrpSelectedGroup={" "," "," "," "}
s_dlgStarterDBConfigOptionSelected="General Purpose"
s_dlgRBOUsername="oracle"
s_dlgEMOptionSelected="Use Database Control for Database Management"
s_dlgEMCentralAgentSelected="No Agents Found"
s_superAdminSamePasswdAgain="oracle"
s_dlgEMSMTPServer=""
s_dlgEMEmailAddress=""
s_DataorASMret="File System"
s_rawDeviceMapFileLocation=""
s_dlgRBOPassword=""
sl_dlgASMCfgDiskSelections={}
s_dlgRBORecoveryLocation="/u01/app/oracle/flash_recovery_area/"
sl_superAdminPasswdsAgain="oracle"
s_dbSid="orcl"
s_mountPoint="/u01/app/oracle/oradata/"
varDRDANETSEL=<Value Unspecified>
oracle.sysman.server:OPTIONAL_CONFIG_TOOLS="{}"
oracle.rdbms.sqlplus.isqlplus:OPTIONAL_CONFIG_TOOLS="{}"
oracle.networking.netca:OPTIONAL_CONFIG_TOOLS="{}"
oracle.options.ops.csscommon:OPTIONAL_CONFIG_TOOLS="{}"
oracle.assistants.dbma:OPTIONAL_CONFIG_TOOLS="{}"
b_createDBRet=true
s_nameForOPERGrp="dba"
s_nameForDBAGrp="dba"
EOF
chown oracle
install enterprise.rsp
chmod 700 enterprise.rsp
3. 安装
3.1修改以上脚本文件权限为744,依次执行,并生成enterprise.rsp
3.2切换到oracle用户,执行
/mnt/cdrom/runInstaller -silent -responseFile /path/enterprise.rsp
当提示The installation of Oracle Database 10g was successful.
3.3用root身份运行$ORACLE_HOME/root.sh
OK,数据库成功安装!
4. 注意事项
管道符前面不能有空格echo password|passwd --stdin oracle
ORACLE_HOME变量后面不能有’/’
ORACLE给各种产品提供了不同的应答文件,具体目录为/mnt/cdrom/response/*.rsp
本试验环境为RedFlag5.0+Oracle10.1.0.3.0,对于别的版本可能稍有不同,比如说RedFlag4.1就不用修改RedFlag 许可文件等
在创建数据库时,可能会遇到Oracle大内存问题,可参阅http://ctf.calis.edu.cn/phpBB2/viewtopic.php?t=197,本文不再赘述