来zhi:http://gouzh.blog.51cto.com/310672/63851/
主要是需要找这三个安装包不太好找
一、准备工作
1.1
下载所需要的补丁
p2617419_220_GENERIC.zip
、
p3238244_9204_LINUX.zip
、
p4198954_40_linux.zip
三个补丁,其中
p4198954_40_linux.zip
是在安装
Oracle
之前就要安装的补丁,
p2617419_220_GENERIC.zip
、
p3238244_9204_LINUX.zip
是在
Oracle
安装过程中需要安装的补丁。
1.2
安装
p4198954_40_linux.zip
补丁
unzip p4198954_40_linux.zip
里面包含有
compat-libcwait-2.1-1.i386.rpm
和
compat-oracle-rhel4-1.0-5.i386.rpm
两个文件。使用如下命令安装补丁:
rpm -ihv compat-oracle-rhel4-1.0-5.i386.rpm
rpm -ihv compat-libcwait-2.1-1.i386.rpm
1.3
下载Oracle 9i
安装文件并解压
Oracle
官方网站下载
Oracle 9.2.0.4 for i386
的安装包具有如下三个文件
ship_9204_linux_disk1.cpio.gz
ship_9204_linux_disk2.cpio.gz
ship_9204_linux_disk3.cpio.gz
使用如下命令解压:
zcat ship_9204_linux_disk1.cpio.gz | cpio -idmv &&zcat ship_9204_linux_disk2.cpio.gz | cpio -idmv && zcat ship_9204_linux_disk3.cpio.gz | cpio -idmv
,解压后生成
Disk1
、
Disk2
、
Disk3
三个目录。
二、创建Oracle
用户和创建安装目录
2.1
创建用户组
groupadd oinstall
groupadd dba
groupadd oper
2.2
创建oracle
用户并设置密码
useradd -u 550 -d /home/oracle -g oinstall -G dba -m oracle
passwd oracle
设置密码
2.3
创建安装目录
mkdir /opt/oracle (
应用程序目录
)
mkdir /opt/oradata
(数据存放目录)
chown -R oracle:oinstall /opt/oracle /opt/oradata
(修改目录所有者)
chmod 775 /opt/oracle /opt/oradata (
修改文件夹权限
)
三、设置环境变量系统参数
3.1
设置环境变量
/etc/profile
和
/home/oracle/.bash_profile
文件
增加如下内容
export LD_ASSUME_KERNEL=2.4.19
export ORACLE_SID=oradb
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.zhs16gbk
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
运行
source .bash_profile
和
source /etc/profile
是环境变量生效
3.2
设置系统参数
/etc/sysctl.conf
文件增加如下内容
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
#kernel.shmmax = 2147483648
此值为
2G
,一般跟你的内存的一半进行设置。
运行
/sbin/sysctl -p
使系统参数生效。
四、安装Oracle9i
<!--[if !supportLists]-->
1、 <!--[endif]-->
Disk1/
目录下运行
./runInstaller
命令启动安装界面。
<!--[if !supportLists]-->
2、 <!--[endif]-->
安装的时候输入
oinstall
的
Unix group
<!--[if !supportLists]-->
3、 <!--[endif]-->
以
root
身份登录在
/tmp
目录下运行
./orainstRoot.sh
<!--[if !supportLists]-->
4、 <!--[endif]-->
安装过程中会在
88%
和
98
%位置出现错误,选择忽略跳过
<!--[if !supportLists]-->
5、 <!--[endif]-->
Copy
文件后提示运行
./root.sh
先不运行,先把
p2617419_220_GENERIC.zip
、
p3238244_9204_LINUX.zip
打上去,打
Agent
的补丁方法如下:
su - oracle
$ cp p2617419_220_GENERIC.zip /tmp
$ cd /tmp
$ unzip p2617419_220_GENERIC.zip
$ export PATH=$PATH:/tmp/OPatch
$ export PATH=$PATH:/sbin # the patch needs “fuser” which is located in /sbin
$ chmod 777 /tmp/OPatch/opatch
$ unzip p3238244_9204_LINUX.zip
$ cd 3238244
$ opatch apply
<!--[if !supportLists]-->
6、 <!--[endif]-->
打完
Agent
补丁后,再运行
./root.sh
<!--[if !supportLists]-->
7、 <!--[endif]-->
安装进程进入创建数据库和启动服务配置监听及
Agent
等服务。
<!--[if !supportLists]-->
8、 <!--[endif]-->
最后提示安装完成。
五、创建Oracle
自启动脚本
touch /etc/init.d/oradb
创建文件
chmod 755 /etc/init.d/oradb
修改文件可执行
/etc/initd/oradb
的文件内容如下:
#
# oracle This shell script takes care of starting and stopping
# the MySQL subsystem (mysqld).
#
# chkconfig: - 90 10
# description: Oracle database server.
# processname: oracle
ORA_HOME=/opt/oracle
ORA_OWNER=oracle
prog="Oracle"
# Source function library.
. /etc/rc.d/init.d/functions
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
start(){
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart >/dev/null 2>&1 &
ret=$?
if [ $ret -eq 0 ]; then
action $"Starting $prog: " /bin/true
else
action $"Starting $prog: " /bin/false
fi
[ $ret -eq 0 ] && touch /var/lock/subsys/oracled
return $ret
}
stop(){
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"Stopping $prog: " /bin/true
else
action $"Stopping $prog: " /bin/false
fi
[ $ret -eq 0 ] && rm -f /var/lock/subsys/oracled
return $ret
}
restart(){
stop
start
}
# See how we were called.
case "$1" in<p align="left"></p>
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
chkconfig --add oradb
(把
oradb
脚本添加到服务里面)
chkconfig oradb on (
把
oradb
脚本设置为自动启动
)