RedHat 5.3上安装Oracle 10.2.0.1
1、系统环境:
RedHat 5.3
内存16G
交换分区8G
2、必须安装如下包,版本可不一样
gcc-3.2.3-2
make-3.79
binutils-2.11
openmotif-2.2.2-16
setarch-1.3-1
compat-gcc-7.3-2.96.122
compat-gcc-c++-7.3-2.96.122
compat-libstdc++-7.3-2.96.122
compat-libstdc++-devel-7.3-2.96.122
compat-db-4.0.14.5
3、设置系统内核参数
[root@database ~]# more /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
4、运行下面命令使设置生效
[root@database ~]# /sbin/sysctl -p
5、编辑limits.conf,login,config这3个文件
[root@database ~]#vi /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
[root@database ~]#vi /etc/pam.d/login
session required /lib/security/pam_limits.so
[root@database ~]#vi /etc/selinux/config
SELINUX=disabled
6、建立用户和组
[root@database ~]#groupadd oinstall
[root@database ~]#groupadd dba
[root@database ~]#groupadd oper
[root@database ~]#useradd -g oinstall -G dba oracle
[root@database ~]#passwd oracle
7、创建相应目录
[root@database ~]#mkdir -p /oracle/product/10.2.0/db_1
[root@database ~]#chown -R oracle:oinstall /oracle
[root@database ~]#chmod -R 775 /oracle
8、编辑/etc/redhat-release
[root@database ~]#vi /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
改成
vi /etc/redhat-release
Red Hat Enterprise Linux Server release 4.3 (Tikanga)
9、以oracle登陆建立相应的环境变量
su - oracle
[oracle@database ~]$vi ~/.bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_HOME
ORACLE_SID=orcl
export ORACLE_SID
ORACLE_TERM=xterm
export ORACLE_TERM
PATH=/usr/sbin:$PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export CLASSPATH
#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
export DISPLAY=172.16.10.50:0.0
export LANG=en_US.utf8
export LANGUAGE=en_US.utf8
export NLS_LANG="Simplified Chinese_China.UTF8"
export LC_ALL=en_US.utf8
10、安装
[oracle@database install]$ unzip 10201_database_linux32.zip
[oracle@database install]$ cd database/
[oracle@database database]$ ls
doc install response runInstaller stage welcome.html
[oracle@database database]$ ./runInstaller
同时在自己本机上打开Xmanger输入ORACLE数据库服务器的IP地址本例子为172.16.26.222
安装过程
Select Installation Method
Specify Inventory Directory and Credentials
Select Installation Type
Specify Home Details
Product-Specific Prerequisite Checks
Select Configuration Option
Select Database Configuration
Specify Database Configuration Options
Select Database Management Option
Specify Database Storage Option
Specify Backup and Recovery Options
Specify Database Schema Passwords
Summary
Install
Configuration Assistants
Database Configuration Assistant
Database Configuration Assistant Password Management
Execute Configuration Scripts
End Of Installation
11、安装结束后修改
[root@database ~]#vi /etc/redhat-release
内容为
Red Hat Enterprise Linux Server release 5 (Tikanga)
12、编辑listener.ora和tnsnames.ora两个文件,编辑后如下
[oracle@database admin]$ more listener.ora
# listener.ora Network Configuration File: /oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.26.222)(PORT = 1521))
)
)
[oracle@database admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.26.222)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
13、设置开机启动
[root@database ~]#vi /etc/oratab
orcl:/u01/app/oracle/product/10.2.0/db_1:Y
14、编写启动脚本
[oracle@database init.d]$ more oracle
#!/bin/bash
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut
#
# set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME
ORACLE_HOME=/oracle/product/10.2.0/db_1
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Not find dbstart,can not start Oracle "
exit
fi
case "$1" in
'start')
# Start the Oracle databses:
echo "Oracle Starting..."
su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart &
echo "Oracle started Succeed"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
;;
'stop')
#Stop the Oracle database;
echo "Oracle Shutdowning ..."
su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut &
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop &"
;;
* ) echo $1;;
esac
[oracle@database init.d]$ chmod +x oracle
15、手动测试该脚本可用
[root@database init.d]# ps -ef|grep ora
root 5717 1 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
root 6426 6395 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
oracle 10723 1 0 09:04 ? 00:00:00 /oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle 10731 1 0 09:05 ? 00:00:00 ora_pmon_orcl
oracle 10733 1 0 09:05 ? 00:00:00 ora_psp0_orcl
oracle 10735 1 0 09:05 ? 00:00:00 ora_mman_orcl
oracle 10737 1 0 09:05 ? 00:00:00 ora_dbw0_orcl
oracle 10739 1 0 09:05 ? 00:00:00 ora_lgwr_orcl
oracle 10741 1 0 09:05 ? 00:00:00 ora_ckpt_orcl
oracle 10743 1 0 09:05 ? 00:00:00 ora_smon_orcl
oracle 10745 1 0 09:05 ? 00:00:00 ora_reco_orcl
oracle 10747 1 0 09:05 ? 00:00:00 ora_cjq0_orcl
oracle 10749 1 0 09:05 ? 00:00:00 ora_mmon_orcl
oracle 10751 1 0 09:05 ? 00:00:00 ora_mmnl_orcl
oracle 10753 1 0 09:05 ? 00:00:00 ora_d000_orcl
oracle 10755 1 0 09:05 ? 00:00:00 ora_s000_orcl
oracle 10775 1 0 09:05 ? 00:00:00 ora_qmnc_orcl
oracle 10795 1 0 09:05 ? 00:00:00 ora_q000_orcl
oracle 10825 1 0 09:05 ? 00:00:00 ora_q001_orcl
oracle 10844 1 0 09:07 ? 00:00:00 oracleorcl (LOCAL=NO)
oracle 10848 1 0 09:08 ? 00:00:00 oracleorcl (LOCAL=NO)
oracle 10944 1 0 09:28 ? 00:00:00 ora_j000_orcl
root 10948 10796 0 09:28 pts/1 00:00:00 grep ora
[root@database init.d]# ./oracle stop
Oracle Shutdowning ...
[root@database init.d]#
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 15-10鏈?2009 09:28:56
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
[root@database init.d]# ps -ef|grep ora
root 5717 1 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
root 6426 6395 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
root 11104 10796 0 09:30 pts/1 00:00:00 grep ora
[root@database init.d]# ./oracle start
Oracle Starting...
Oracle started Succeed
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 15-10鏈?2009 09:30:34
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.26.222)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 15-10鏈?2009 09:30:34
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.26.222)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[root@database init.d]# Processing Database instance "orcl": log file /oracle/product/10.2.0/db_1/startup.log
[root@database init.d]# ps -ef|grep ora
root 5717 1 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
root 6426 6395 0 Oct14 ? 00:00:01 hald-addon-storage: polling /dev/scd0
oracle 11165 1 0 09:30 ? 00:00:00 /oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle 11227 1 0 09:30 ? 00:00:00 ora_pmon_orcl
oracle 11229 1 0 09:30 ? 00:00:00 ora_psp0_orcl
oracle 11231 1 1 09:30 ? 00:00:00 ora_mman_orcl
oracle 11233 1 0 09:30 ? 00:00:00 ora_dbw0_orcl
oracle 11235 1 0 09:30 ? 00:00:00 ora_lgwr_orcl
oracle 11237 1 0 09:30 ? 00:00:00 ora_ckpt_orcl
oracle 11239 1 0 09:30 ? 00:00:00 ora_smon_orcl
oracle 11241 1 0 09:30 ? 00:00:00 ora_reco_orcl
oracle 11243 1 0 09:30 ? 00:00:00 ora_cjq0_orcl
oracle 11245 1 2 09:30 ? 00:00:00 ora_mmon_orcl
oracle 11247 1 0 09:30 ? 00:00:00 ora_mmnl_orcl
oracle 11249 1 0 09:30 ? 00:00:00 ora_d000_orcl
oracle 11251 1 0 09:30 ? 00:00:00 ora_s000_orcl
oracle 11259 1 0 09:30 ? 00:00:00 ora_qmnc_orcl
oracle 11261 1 2 09:30 ? 00:00:00 ora_j000_orcl
oracle 11267 1 0 09:30 ? 00:00:00 oracleorcl (LOCAL=NO)
oracle 11269 1 0 09:30 ? 00:00:00 ora_q000_orcl
root 11271 10796 0 09:30 pts/1 00:00:00 grep ora
16、若要设置成开机自启动,则做如下操作
[root@localhost rc5.d]# ln -s /etc/init.d/oracle S90oracle
[root@localhost rc5.d]# ln -s /etc/init.d/oracle K01oracle
17、查看建立的链接情况
[root@localhost rc5.d]# ls -l *oracle*
lrwxrwxrwx 1 root root 18 Aug 12 09:51 K01oracle -> /etc/init.d/oracle
lrwxrwxrwx 1 root root 18 Aug 12 09:51 S90oracle -> /etc/init.d/oracle