HP-UX 安装oracle11g过程
规划:
安装文件存放在/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:<N|Y>: # # 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
|
到此数据库安装成功。
7、静默建库
修改响应模板文件:
$ cd /tmp/hpia64_11gR2_database/database/response/
$ vi dbca.rsp
#--------------------------------------------------------------------
#以下参数不要更改
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
#以下参数必须设置
[CREATEDATABASE]
GDBNAME = "ORCL.LK"
TEMPLATENAME = "General_Purpose.dbc"
#以下参数不设置则使用默认值,建议设置
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "5120"
#这个是指定数据文件要存放在哪个目录
DATAFILEDESTINATION =/oracle
#--------------------------------------------------------------------
开始建库:
$ ./dbca -silent -responseFile /tmp/hpia64_11gR2_database/database/response/dbca.rsp
Enter SYS user password:
Enter SYSTEM user password:
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 Look at the log file "/orain/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log" for further details.
|
$ tail -100f /orain/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log
Copying database files DBCA_PROGRESS : 1% DBCA_PROGRESS : 3% DBCA_PROGRESS : 11% DBCA_PROGRESS : 18% DBCA_PROGRESS : 26% DBCA_PROGRESS : 37% Creating and starting Oracle instance DBCA_PROGRESS : 40% DBCA_PROGRESS : 45% DBCA_PROGRESS : 50% DBCA_PROGRESS : 55% DBCA_PROGRESS : 56% DBCA_PROGRESS : 60% DBCA_PROGRESS : 62% Completing Database Creation DBCA_PROGRESS : 66% DBCA_PROGRESS : 70% DBCA_PROGRESS : 73% DBCA_PROGRESS : 85% DBCA_PROGRESS : 96% DBCA_PROGRESS : 100% Database creation complete. For details check the logfiles at: /orain/oracle/cfgtoollogs/dbca/orcl11g. Database Information: Global Database Name:orcl11g.us.oracle.com System Identifier(SID):oss15
|
建库后实例检查:
$ ps -ef | grep ora_ | grep -v grep | wc -l
21
$ ps -ef | grep ora_ | grep -v grep
oracle 28981 1 0 19:00:48 ? 0:00 ora_mman_oss15 oracle 28975 1 0 19:00:47 ? 0:00 ora_dbrm_oss15 oracle 28983 1 0 19:00:48 ? 0:00 ora_dbw0_oss15 oracle 28995 1 0 19:00:48 ? 0:00 ora_mmnl_oss15 oracle 29057 1 0 19:00:55 ? 0:00 ora_cjq0_oss15 oracle 28967 1 0 19:00:47 ? 0:00 ora_pmon_oss15 oracle 28979 1 0 19:00:47 ? 0:00 ora_dia0_oss15 oracle 28969 1 0 19:00:47 ? 0:00 ora_vktm_oss15 oracle 28991 1 0 19:00:48 ? 0:00 ora_reco_oss15 oracle 28993 1 0 19:00:48 ? 0:00 ora_mmon_oss15 oracle 28973 1 0 19:00:47 ? 0:00 ora_diag_oss15 oracle 29041 1 0 19:00:54 ? 0:00 ora_qmnc_oss15 oracle 28971 1 0 19:00:47 ? 0:00 ora_gen0_oss15 oracle 29075 1 0 19:01:04 ? 0:00 ora_q000_oss15 oracle 28999 1 0 19:00:48 ? 0:00 ora_s000_oss15 oracle 28977 1 0 19:00:47 ? 0:00 ora_psp0_oss15 oracle 28987 1 0 19:00:48 ? 0:00 ora_ckpt_oss15 oracle 28997 1 0 19:00:48 ? 0:00 ora_d000_oss15 oracle 29077 1 0 19:01:04 ? 0:00 ora_q001_oss15 oracle 28989 1 0 19:00:48 ? 0:00 ora_smon_oss15 oracle 28985 1 0 19:00:48 ? 0:00 ora_lgwr_oss15
|
再次查看监听状态:
$ lsnrctl status
LSNRCTL for HPUX: Version 11.2.0.1.0 - Production on 02-MAR-2011 19:04:16
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 1 hr. 37 min. 30 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))) Services Summary... Service "orcl11g.us.oracle.com" has 1 instance(s). Instance "oss15", status READY, has 1 handler(s) for this service... Service "oss15XDB.us.oracle.com" has 1 instance(s). Instance "oss15", status READY, has 1 handler(s) for this service... The command completed successfully
|
改为归档模式并重启:
$ sqlplus / as sysdba;
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 2 19:09:49 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 5344731136 bytes
Fixed Size 2179216 bytes
Variable Size 2801799024 bytes
Database Buffers 2533359616 bytes
Redo Buffers 7393280 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> execute utl_recomp.recomp_serial();
PL/SQL procedure successfully completed.
SQL> alter system archive log current;
System altered.
默认安装的数据库用户:
SQL> set lines 256 pages 500;
SQL> select USER_ID,USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE from dba_users order by 1;
USER_ID USERNAME ACCOUNT_STATUS DEFAULT_TABLESPACE
------------------------------------------------------------------------------------------
0 SYS OPEN SYSTEM
5 SYSTEM OPEN SYSTEM
9 OUTLN EXPIRED & LOCKED SYSTEM
14 DIP EXPIRED & LOCKED USERS
21 ORACLE_OCM EXPIRED & LOCKED USERS
30 DBSNMP EXPIRED & LOCKED SYSAUX
31 APPQOSSYS EXPIRED & LOCKED SYSAUX
32 WMSYS EXPIRED & LOCKED SYSAUX
42 EXFSYS EXPIRED & LOCKED SYSAUX
43 CTXSYS EXPIRED & LOCKED SYSAUX
45 XDB EXPIRED & LOCKED SYSAUX
46 ANONYMOUS EXPIRED & LOCKED SYSAUX
53 ORDSYS EXPIRED & LOCKED SYSAUX
54 ORDDATA EXPIRED & LOCKED SYSAUX
55 ORDPLUGINS EXPIRED & LOCKED SYSAUX
56 SI_INFORMTN_SCHEMA EXPIRED & LOCKED SYSAUX
57 MDSYS EXPIRED & LOCKED SYSAUX
61 OLAPSYS EXPIRED & LOCKED SYSAUX
65 MDDATA EXPIRED & LOCKED USERS
67 SPATIAL_WFS_ADMIN_USR EXPIRED & LOCKED USERS
70 SPATIAL_CSW_ADMIN_USR EXPIRED & LOCKED USERS
72 SYSMAN EXPIRED & LOCKED SYSAUX
74 MGMT_VIEW EXPIRED & LOCKED SYSTEM
75 FLOWS_FILES EXPIRED & LOCKED SYSAUX
76 APEX_PUBLIC_USER EXPIRED & LOCKED USERS
78 APEX_030200 EXPIRED & LOCKED SYSAUX
79 OWBSYS EXPIRED & LOCKED SYSAUX
83 OWBSYS_AUDIT EXPIRED & LOCKED SYSAUX
84 SCOTT EXPIRED & LOCKED USERS
2147483638 XS$NULL EXPIRED & LOCKED USERS
30 rows selected.
默认安装的组件:
SQL>
SQL>col COMP_ID format a8
SQL>col COMP_NAME format a35
SQL>
SQL>col VERSION format a12
SQL>
SQL>col schema format a12
SQL>
SQL>col OTHER_SCHEMAS format a45
SQL> select comp_id,comp_name,version,schema,other_schemas from dba_registry order by 1;
COMP_ID COMP_NAME VERSION SCHEMA OTHER_SCHEMAS
-------- ----------------------------------- ------------ ------------ ---------------------------------------------
AMD OLAP Catalog 11.2.0.1.0 OLAPSYS
APEX Oracle Application Express 3.2.1.00.10 APEX_030200 FLOWS_FILES
APS OLAP Analytic Workspace 11.2.0.1.0 SYS
CATALOG Oracle Database Catalog Views 11.2.0.1.0 SYS
CATJAVA Oracle Database Java Packages 11.2.0.1.0 SYS
CATPROC Oracle Database Packages and Types 11.2.0.1.0 SYS APPQOSSYS,DBSNMP,DIP,ORACLE_OCM,OUTLN,SYSTEM
CONTEXT Oracle Text 11.2.0.1.0 CTXSYS
EM Oracle Enterprise Manager 11.2.0.1.0 SYSMAN
EXF Oracle Expression Filter 11.2.0.1.0 EXFSYS
JAVAVM JServer JAVA Virtual Machine 11.2.0.1.0 SYS
ORDIM Oracle Multimedia 11.2.0.1.0 ORDSYS MDSYS,ORDDATA,ORDPLUGINS,SI_INFORMTN_SCHEMA
OWB OWB 11.2.0.1.0 OWBSYS
OWM Oracle Workspace Manager 11.2.0.1.0 WMSYS
RUL Oracle Rules Manager 11.2.0.1.0 EXFSYS
SDO Spatial 11.2.0.1.0 MDSYS
XDB Oracle XML Database 11.2.0.1.0 XDB ANONYMOUS,XS$NULL
XML Oracle XDK 11.2.0.1.0 SYS
XOQ Oracle OLAP API 11.2.0.1.0 SYS
18 rows selected.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
---end---
这个过程都是参考这位高人的文档:
http://hi.baidu.com/edeed/home