oralce-非图形化安装.doc
64 位 redhat 5.2 slient 安装 oracle 11.1.06 前几天需要安装一个客户端 在网上找了找资料,装完后形成如下文档,其中额外解决了几个关键的 问题 上菜~~~ 确认下是什么系统 [root@naruto etc]# cat /proc/version Linux version 2.6.18-93.el5.custom (root@rh52_test) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Wed Jun 18 16:15:54 CST 2008 [root@naruto etc]# uname -a Linux naruto 2.6.18-93.el5.custom #1 SMP Wed Jun 18 16:15:54 CST 2008 x86_64 x86_64 x86_64 GNU/Linux 检查系统必要包是否被安装 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-2.5 libaio libaio-devel libgcc libstdc++ libstdc++-devel \ make sysstat Ex: # 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-2.5 libaio libaio-devel libgcc libstdc++ libstdc++-devel \ make sysstat binutils-2.17.50.0.6-2.el5 (x86_64) compat-libstdc++-33-3.2.3-61 (i386) compat-libstdc++-33-3.2.3-61 (x86_64) elfutils-libelf-0.125-3.el5 (x86_64) elfutils-libelf-devel-0.125-3.el5 (x86_64) gcc-4.1.1-52.el5 (x86_64) gcc-c++-4.1.1-52.el5 (x86_64) glibc-2.5-12 (i686) glibc-2.5-12 (x86_64) glibc-common-2.5-12 (x86_64) glibc-devel-2.5-12 (x86_64) glibc-devel-2.5-12 (i386) libaio-0.3.106-3.2 (x86_64) libaio-0.3.106-3.2 (i386) libaio-devel-0.3.106-3.2 (x86_64) libgcc-4.1.1-52.el5 (x86_64) libgcc-4.1.1-52.el5 (i386) libstdc++-4.1.1-52.el5 (x86_64) libstdc++-4.1.1-52.el5 (i386) libstdc++-devel-4.1.1-52.el5 (x86_64) make-3.81-1.1 (x86_64) sysstat-7.0.0-3.el5 (x86_64) 如果已经全部装好了,则显示如上, 我在检查这里的时候,发现有 3 个包没有安装 elfutils-libelf-devel-0.125-3.el5(x86_64) libaio-devel-0.3.106-3.2(x86_64) sysstat-7.0.0-3.el5(x86_64) 找了三个包过来安装 rpm -ivh libaio-devel-0.3.106-3.2(x86_64) rpm -ivh sysstat-7.0.0-3.el5(x86_64) 安装都还顺利 rpm -ivh elfutils-libelf-devel-0.125-3.el5(x86_64)的时候提示安装失败,需要前置包,弄了 好久还是这样提示 最后直接用 rpm -ivh -force elfutils-libelf-devel-0.125-3.el5(x86_64) 强 制安装 要求内存不小于 1G,在内存小于 2G,SWAP 应该是内存的 1.5 倍,内存 2 到 8G,SWAP 和 内存相同大 小即可,内存超过 8G,SWAP 是 内存的 0.75 倍。 由于 11g 对 于共享内存要求变大,因此系统共享内存应该大于 512*进程数,如果共享内存不足的话, 会造成 ORA-845 或 ORA-1078 错误。 要求临时表空间不少于 200M,安装目录应大于 4G。 检查检查 [root@naruto ~]#grep MemTotal /proc/meminfo MemTotal: 16444136 kB [root@naruto ~]# grep SwapTotal /proc/meminfo SwapTotal: 2096440 kB 这里的时候发现 swap 空间过少 需要将 SWAP 空间变大 1.查看系统 Swap 空间使用 [root@naruto usr]# free total used free shared buffers cached Mem: 16444136 8083200 8360936 0 159096 7626248 -/+ buffers/cache: 297856 16146280 Swap: 2096440 0 2096440 2.在空间合适处创建 swap 文件 [root@naruto usr]cd /usr [root@naruto usr]# mkdir swap [root@naruto usr]# cd swap [root@naruto swap]# dd if=/dev/zero of=swapfile bs=1024 count=10000 10000+0 records in 10000+0 records out root@naruto swap]# dd if=/dev/zero of=swapfile bs=1024 count=100000 100000+0 records in 100000+0 records out 102400000 bytes (102 MB) copied, 0.752257 seconds, 136 MB/s [root@naruto swap]# dd if=/dev/zero of=swapfile bs=1024 count=1000000 1000000+0 records in 1000000+0 records out 1024000000 bytes (1.0 GB) copied, 3.47728 seconds, 294 MB/s [root@naruto swap]# dd if=/dev/zero of=swapfile bs=1024 count=7000000 7000000+0 records in 7000000+0 records out 7168000000 bytes (7.2 GB) copied, 25.0713 seconds, 286 MB/s [root@naruto swap]# mkswap swapfile Setting up swapspace version 1, size = 7167995 kB 3.激活 swap 文件 [root@naruto swap]# swapon swapfile [root@naruto swap]# free total used free shared buffers cached Mem: 16444136 7738108 8706028 0 166256 7277316 -/+ buffers/cache: 294536 16149600 Swap: 9096432 0 9096432 OK swap 成功 增加到 9G 下面继续为安装做准备 [root@naruto ~]# groupadd oinstall [root@naruto ~]# groupadd dba [root@naruto ~]# groupadd asadmin [root@naruto ~]# useradd -g oinstall -G dba,asadmin oracle [root@naruto ~]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@naruto ~]# id nobody uid=99(nobody) gid=99(nobody) groups=99(nobody) context=root:system_r:unconfined_t:SystemLow-SystemHigh .-------------------------------------------------------------------------------- 建立 oinstall、dba 和 asadmin 组。创建好用户后,检查 nobody 用户是否存在。不存在的话,建立 该用户。 检测并修改系统的核心参数,编辑/etc/sysctl.conf 文件,添加下面的配置,保存后重启系统。注 意,如果系统默认的配置比这里给出 的值大,不要修改原有配置。 fs.file-max = 512 * PROCESSES kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144 配置 oracle 用 户的环境变量和 shell 限制,编辑/etc/security/limits.conf, 添加下面的内容: oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 编辑/etc/pam.d/login 文 件,添加下面的内容: session required /lib/security/pam_limits.so session required pam_limits.so 编辑 oracle 用 户目录下的.bash_rc 文件,添加下列环境变量: umask 022 if [ $USER = “oracle“ ]; then if [ $SHELL = “/bin/ksh“ ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi 编辑 oracle 用户下环境变量 [oracle@naruto ~]$ vi .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export TMP=/tmp export TMPDIR=/tmp export ORACLE_BASE=/home/data/oracle export ORACLE_SID=ora11g64 export ORACLE_HOME=/home/data/oracle/product/11.1 export PATH=$HOME/bin:$PATH:$/home/data/oracle/product/11.1/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export CLASSPATH=$ORACLE_HOME/JRE export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib [oracle@naruto ~]$ 最后建立安装 Oracle 所需的目录结构。 [root@naruto ~]# mkdir -p /data/oracle/product/11.1 [root@naruto ~]# chown -R oracle.oinstall /data .-------------------------------------------------------------------------------- 准备工作做完了下面开始进行 Silent 方式的安装。 首先设置 oraInst.loc 文件: PHP code:------------------------------------------------------------------------------- - [root@naruto ~]# ls -l /etc/oraInst.loc -rw-rw-r-- 1 oracle dba 61 Oct 19 17:25 /etc/oraInst.loc [root@naruto ~]# more /etc/oraInst.loc inventory_loc=/data/oracle/oraInventory inst_group=oinstall .-------------------------------------------------------------------------------- 确保/etc/oraInst.loc 中 包含上面的信息,且 Oracle 包含访问权限。 根据希望安装的数据库类型选择 Silent 的 response_file 文件的类似, 比如: enterprise.rsp、standard.rsp 还 是 custom.rsp。 这里选择 enterpise.rsp 类 型,安装盘中的 database/response 目录下对应的 response 文件拷贝出 来,根据文件里面的提示对输入值进行修改。 比如这个例子中对如下的参数进行设置: UNIX_GROUP_NAME=“oinstall“ FROM_LOCATION=“/data/database/stage/products.xml“ ORACLE_BASE=“/data/oracle“ ORACLE_HOME=“/data/oracle/product/11.1“ ORACLE_HOME_NAME=“ORADBHOME11“ SHOW_ROOTSH_CONFIRMATION=false RESTART_SYSTEM=false RESTART_REMOTE_SYSTEM=false COMPONENT_LANGUAGES={“zh_CN“} s_nameForDBAGrp=“dba“ s_nameForOPERGrp=“oinstall“ s_nameForASMGrp=“asadmin“ n_configurationOption=3 s_ASMSYSPassword=“asm“ s_ASMSYSPasswordAgain=“asm“ 注意,所有的字符串需要放在双引号中,注意大小 写。数字和布尔变量直接写就可以。 由于这里没有选择建立数据库而只安装软件,因此没 有设置数据库相关的配置参数。 [oracle@naruto data]$ chmod 700 enterprise.rsp .-------------------------------------------------------------------------------- 下面可以开始 SILENT 安装了: 注意,响应文件需要使用绝对路径。 PHP code:------------------------------------------------------------------------------- - [oracle@naruto database]$ ./runInstaller -silent -noconfig -responseFile /data/database/enterprise.rsp Starting Oracle Universal Installer. Checking Temp space: must be greater than 120 MB. Actual 8886 MB Passed Checking swap space: must be greater than 150 MB. Actual 8189 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-10-19_06-40-04PM. Please wait .[oracle@enterprice64 database]$ Oracle Universal Installer, Version 11.1.0.6.0 Production Copyright (C) 1999, 2007, Oracle. All rights reserved. You can find the log of this install session at: /data/oracle/oraInventory/logs/installActions2007-10-19_06-40-04PM.log 100% Done. Loading Product Information 100% Done. Starting execution of Prerequisites. Total No of checks: 14 Performing check for CertifiedVersions Checking operating system requirements . Expected result: One of enterprise-4,enterprise-5,redhat-4,redhat-5,SuSE-10,asianux- 2,asianux-3 Actual Result: enterprise-5 Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for Packages Checking operating system package requirements . Checking for make-3.81; found make-1:3.81-1.1-x86_64. Passed Checking for binutils-2.17.50.0.6; found binutils-2.17.50.0.6-2.el5-x86_64. Passed Checking for gcc-4.1.1; found gcc-4.1.1-52.el5-x86_64. Passed . . . Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for Kernel Checking kernel parameters Checking for semmsl=250; found semmsl=250. Passed . . . Checking for wmem_max=262144; found wmem_max=262144. Passed Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for GLIBC Checking Recommended glibc version Expected result: ATLEAST=2.5-12 Actual Result: 2.5-12 Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for TotalMemory Checking physical memory requirements . Expected result: 922MB Actual Result: 7984MB Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for SwapSpace Checking available swap space requirements . Expected result: 7984MB Actual Result: 8189MB Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for DetectIfDHCPAssignedIP Checking Network Configuration requirements . Check complete. The overall result of this check is: Not executed Check complete: Not executed Recommendation: Oracle supports installations on systems with DHCP-assigned public IP addresses. However, the primary network interface on the system should be configured with a static IP address in order for the Oracle Software to function properly. See the Installation Guide for more details on installing the software on systems configured with DHCP. ======================================================== Performing check for CheckPathForOtherOracleHomes Checking PATH environment variable. Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for CheckTempDiskSpace Checking for sufficient diskspace in TEMP location. Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for CheckLdLibraryPath Checking LD_LIBRARY_PATH environment variable. Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for OracleBase Validating ORACLE_BASE location (if set) . Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for OracleHomeSpace Checking Oracle Home path for spaces. Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for DetectAnyInvalidASMHome Checking for proper system clean-up Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== Performing check for CompatibilityChecks_DB Checking for Oracle Home incompatibilities Actual Result: NEW_HOME Check complete. The overall result of this check is: Passed Check complete: Passed ======================================================== PrereqChecks complete Analyzing dependencies . 100% Done. ----------------------------------------------------------------------------- Summary Global Settings Source: /data/database/stage/products.xml Oracle Base: /data/oracle Oracle Home: /data/oracle/product/11.1 (ORADBHOME11) Installation Type: Enterprise Edition Product Languages Simplified Chinese English Space Requirements / Required 226MB (only as temporary space) : Available 8.56GB /data/ Required 3.63GB : Available 181.86GB New Installations (126 products) Oracle Database 11g 11.1.0.6.0 Enterprise Edition Options 11.1.0.6.0 Oracle Partitioning 11.1.0.6.0 . . . Oracle Universal Installer 11.1.0.6.0 Oracle One-Off Patch Installer 11.1.0.6.0 Installer SDK Component 11.1.0.6.0 Sun JDK 1.5.0.11.0 ----------------------------------------------------------------------------- Installation in progress (Fri Oct 19 18:40:20 CST 2007) . 6% Done. . 12% Done. . 19% Done. . 25% Done. . 31% Done. . 38% Done. . 44% Done. . 50% Done. . 57% Done. . 63% Done. . 69% Done. . 76% Done. . 81% Done. Install successful Linking in progress (Fri Oct 19 18:42:27 CST 2007) 81% Done. Link successful Setup in progress (Fri Oct 19 18:43:33 CST 2007) . 100% Done. Setup successful End of install phases.(Fri Oct 19 18:43:36 CST 2007) WARNING: The following configuration scripts need to be executed as the root user. #!/bin/sh #Root script to run /data/oracle/product/11.1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as root 3. Run the scripts The installation of Oracle Database 11g was successful. Please check /data/oracle/oraInventory/logs/silentInstall2007-10-19_06-40-04PM.log for more details. .-------------------------------------------------------------------------------- 最后使用 root 执 行一下$ORACLE_HOME/root.sh 脚本就可以了。 不过这里 Oracle 存 在一个 bug,在 root.sh 脚本中,自 动将 OUI_SILENT 参数设置为 TRUE, 而后 的检查中,如果发现这个值为 TRUE,那么这个脚本运行会自动退出了。这 里需要 vi 进去手工将 其修改为 FALSE, 然后使用 root 执行: [oracle@naruto 11.1]# ./root.sh Running Oracle 11g root.sh script. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /data/oracle/product/11.1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The file dbhome already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying dbhome to /usr/local/bin . The file oraenv already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying oraenv to /usr/local/bin . The file coraenv already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying coraenv to /us