规划:
安装文件存放在/tmp目录下,目录层次自拟
数据库安装在/orain目录下,目录层次自拟
数据库数据文件存放在/oracle目录下,目录层次自拟
#代表在root用户下操作
$代表在oralce用户下操作
1、下载安装包
机器是HP-UX Itanium的,找对应的文件进行下载,下载链接为:
http://www.oracle.com/technetwork/database /enterprise-edition/downloads/index.html,我下载的版本是:Oracle Database 11g Release 1 (11.1.0.6.0) for HP-UX Itanium 。
这里做个说明,down下来后进行解压,找到数据库的doc,看快速安装指导,那个里面会讲安装所需的硬件及相关环境。现在服务器自然是硬盘大,内存大,这些硬件条件大概看下就可以,但是版本却是一个很重要的问题,因为我刚开始下载的是:Oracle Database 10g Release 2 (10.2.0.1.0) for HP-UX Itanium,这个版本的只能安装在主机版本是11.23的机器上,而我目前的操作系统版本却是11.31,所以导致第一次安装进行不下去。
安装环境的信息:
查看内存
# /usr/contrib/bin/machinfo | grep -i Memory
Memory: 130938 MB (127.87 GB)
查看交换空间
# /usr/sbin/swapinfo -a
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 33554432 0 33554432 0% 0 - 1 /dev/vg00/lvol2
reserve – 6346976 -6346976
memory 127534260 12958204 114576056 10%
查看打算用做安装文件存放的空间
# bdf /tmp
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol6 10485760 6210272 4242480 59% /tmp
查看软件包
# /usr/sbin/swlist -l bundle | more
……
查看补丁包
# /usr/sbin/swlist -l patch | more
……
查看内核参数
# /usr/sbin/kcweb -F
查看主机操作系统版本
# uname -a
HP-UX ynsap02 B.11.31 U ia64 0629614917 unlimited-user license
#
2、建立数据库用户及相应的组
—————————————————-
建立组
# groupadd -g 501 oinstall
# groupadd -g 502 dba
# groupadd -g 503 oper
# groupadd -g 504 asmadmin
# groupadd -g 505 asmdba
# groupadd -g 506 asmoper
#
建立oracle用户
#/usr/sbin/useradd -u 501 -d /home/oracle -g oinstall -G dba,oper,asmadmin,asmdba,asmoper oracle
查看建立后的情况
#id oracle
uid=501(oracle) gid=501(oinstall) groups=502(dba),503(oper),504(asmadmin),505(asmdba),506(asmoper)
3、修改oracle用户的环境变量
指定ORACLE_HOME为/orain/oracle/product/10.2/db_1
数据文件另外要指定在/oracle目录下,这个将会在建立数据库时指定。
#su – oracle
$cd
$ ls -al
total 112
drwxr-xr-x 3 oracle 107 8192 Mar 2 18:55 .
drwxr-xr-x 9 root root 8192 Mar 1 18:50 ..
-r–r–r– 1 oracle 107 832 Mar 1 16:33 .cshrc
-r–r–r– 1 oracle 107 347 Mar 1 16:33 .exrc
-r–r–r– 1 oracle 107 334 Mar 1 16:33 .login
-rw-r–r– 1 oracle 107 1173 Mar 2 16:56 .profile
-rw——- 1 oracle 107 5084 Mar 2 19:59 .sh_history
drwxr-x— 5 oracle oinstall 96 Mar 2 18:55 .sw
修改.profile文件增加如下内容
$ vi .profile
#——————————————————–
export ORACLE_BASE=/orain/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/usr/local/lib:/usr/lib:/lib
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_DATE_FORMAT=”yyyy-mm-dd hh24:mi:ss”
export EDITOR=vi
export ORACLE_SID=oss15
#———————————————————-
$exit
4、准备安装文件,安装文件打算放在/tmp/hpia64_11gR2_database
#cd /tmp
#mkdir hpia64_11gR2_database
在win7上解压hpia64_11gR2_database_1of2.zip和hpia64_11gR2_database_2of2.zip,右键选择时都解压到当前目录,最后会生成一个database目录,将这个目录整个用ftp工具上传到hp主机/tmp /hpia64_11gR2_database目录。
修改安装文件所在目录的用户及可执行权限:
#chown -R oracle:oinstall /tmp/hpia64_11gR2_database
#chmod -R 775 /tmp/hpia64_11gR2_database
如果服务器支持unzip命令可以直接上传zip文件,然后使用以下命令进行解压:
unzip hpia64_11gR2_database_1of2.zip -d /tmp/hpia64_11gR2_database
unzip hpia64_11gR2_database_2of2.zip -d /tmp/hpia64_11gR2_database
5、安装数据库
安装时需要使用一个response文件,oracle已经给了模板,可以通过修改模板达到我们所需要的安装特性。
这里模板的路径是:/tmp/hpia64_11gR2_database/database/response
修改响应模板文件
#su – oracle
$vi db_install.rsp
#———————————————————————————————
以下参数不要更改
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
#以下参数根据实际情况更改,一般也无需更改
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/orain/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/orain/oracle/product/11.2/db_1
ORACLE_BASE=/orain/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.customComponents=oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
#———————————————————————————–
安装开始:
$ ./runInstaller -silent -ignorePrereq -force -noconfig -responseFile /tmp/hpia64_11gR2_database/db_install.rsp
Starting Oracle Universal Installer…
Checking Temp space: must be greater than 415 MB. Actual 4211 MB Passed
Checking swap space: must be greater than 150 MB. Actual 32768 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-03-02_04-58-19PM. Please wait …$ You can find the log of this install session at:
/orain/oracle/oraInventory/logs/installActions2011-03-02_04-58-19PM.log
# The following configuration scripts need to be executed as the “root” user.
#!/bin/sh
#Root scripts to run
/orain/oracle/product/11.2/db_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
Successfully Setup Software.
在此安装过程中遇到过两个问题:
错误一
$ ./runInstaller -silent -force -noconfig -responseFile /tmp/hpia64_11gR2_database/db_install.rsp
Starting Oracle Universal Installer…
Checking Temp space: must be greater than 415 MB. Actual 4347 MB Passed
Checking swap space: must be greater than 150 MB. Actual 32768 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-03-02_04-46-11PM. Please wait …$ [SEVERE] – Email Address Not Specified
此错误是因为安装模板中少修改了一个参数导致,需要将下面的参数的值修改为true:
DECLINE_SECURITY_UPDATES=true
错误二
$ [FATAL] [INS-13013] Target environment do not meet some mandatory requirements.
CAUSE: Some of the mandatory prerequisites are not met. See logs for details. /orain/oracle/oraInventory/logs/installActions2011-03-02_04-49-41PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /orain/oracle/oraInventory/logs/installActions2011-03-02_04-49-41PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
这个错误在网上查到说在安装命令中加入选项-ignorePrereq可以解决,但问题的根本原因没有找到。
执行脚本建立oratab,dbhome,oraenv,coraenv文件:
# ./root.sh
Check /orain/oracle/product/11.2/db_1/install/root_ynsap02_2011-03-02_17-16-04.log for the output of root script
# more /orain/oracle/product/11.2/db_1/install/root_ynsap02_2011-03-02_17-16-04.log
Running Oracle 11g root.sh script…
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /orain/oracle/product/11.2/db_1
Creating /etc/oratab file…
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.
# more /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ‘:’, is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, ‘#’, are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:
:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , “Y”, or should not,
# “N”, be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
6、静默配置监听
通过response文件运行netca, 生成sqlnet.ora和listener.ora文件, 位于$ORACLE_HOME/network/admin目录下
#su – oracle
$ ./netca /silent /responsefile /tmp/hpia64_11gR2_database/database/response/netca.rsp
Parsing command line arguments:
Parameter “silent” = true
Parameter “responsefile” = /tmp/hpia64_11gR2_database/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/orain/oracle/product/11.2/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
$ ls -l $ORACLE_HOME/network/admin/*.ora
-rw-r–r– 1 oracle oinstall 362 Mar 2 17:26 /orain/oracle/product/11.2/db_1/network/admin/listener.ora
-rw-r–r– 1 oracle oinstall 213 Mar 2 17:26 /orain/oracle/product/11.2/db_1/network/admin/sqlnet.ora
查看监听状态:
$ lsnrctl status
LSNRCTL for HPUX: Version 11.2.0.1.0 – Production on 02-MAR-2011 17:27:32
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for HPUX: Version 11.2.0.1.0 – Production
Start Date 02-MAR-2011 17:26:47
Uptime 0 days 0 hr. 0 min. 46 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /orain/oracle/product/11.2/db_1/network/admin/listener.ora
Listener Log File /orain/oracle/diag/tnslsnr/ynsap02/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ynsap02)(PORT=1521)))
The listener supports no services
The command completed successfully
到此数据库安装成功。收起