Chinaunix首页 | 论坛 | 博客
  • 博客访问: 508765
  • 博文数量: 213
  • 博客积分: 7027
  • 博客等级: 少将
  • 技术积分: 1974
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-24 08:51
文章分类

全部博文(213)

文章存档

2007年(213)

我的朋友

分类: Oracle

2007-09-07 16:27:29

           
          Centos5上安装Oracle 10g

1. 需要的软件包:

binutils
compat-db
control-center
gcc
gcc-c++
glibc
glibc-common
gnome-libs
libstdc++
libstdc++-devel
make
pdksh (ftp://ftp.pbone.net/mirror/ftp.centos.org/4.5/os/i386/CentOS/RPMS/pdksh-5.2.14-30.3.i386.rpm)
sysstat
xscreensaver (ftp://ftp.is.co.za/mirror/centos/4.5/updates/i386/RPMS/xscreensaver-4.18-5.rhel4.14.i386.rpm)
libstdc++.so.5

2.建用户和组

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

3.建目录结构
su - oracle
mkdir db_home //作为建oracle实例用的目录
mkdir oracle10g //oracle安装目录


4.设置内核参数

vim /etc/sysctl.conf
增加:

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144


5. 调整oracle使用者的环境限制

vim /etc/security/limits.conf
增加:

* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

vim /etc/pam.d/login
增加:

session required /lib/security/pam_limits.so
session required pam_limits.so

vim /etc/profile
增加:

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

6.检查/tmp空间,至少400M
df /tmp

7.设置环境变量

su - oracle
vim .bash_profile
增加:

# oracle 10g
umask 022
export ORACLE_BASE=/home/oracle/oracle10g
export ORACLE_SID=dbtest
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8

生效环境变量:
. .bash_profile 或者 source .bash_profile

8.安装oracle

如果通过远程安装oracle,需要在oracle用户下运行vncserver,或者在root运行:
su - oracle -c "vncserver"
如果在本地安装,则需要通过oracle用户登陆X-windows.

先解压安装文件包,安装时忽略版本检查:
./runInstaller -ignoreSysPreReqs

安装是需要更改的为:
指定合适的数据库字符集,如: Simplified Chinese ZHS16CGB231280
指定数据库的目录为: /home/oracle/db_home
其他的根据需要来更改。

在root用户环境下执行安装程序给出的脚本
/home/oracle/oracle10g/oraInventory/orainstRoot.sh
/home/oracle/oracle10g/product/10.2.0/db_1/root.sh

安装后显示:
The following J2EE Applications have been deployed and are accessible at the URLs listed below.

iSQL*Plus URL:


iSQL*Plus DBA URL:
/dba

Enterprise Manager 10g Database Control URL:


9. 建立oracle启动脚本
修改/etc/oratab ,把所有的 instance 的重启动标志设置成 'Y',如:
dbtest:/home/oracle/database/product/10.2.0/db_1:Y
建立一个启动脚本 /etc/init.d/runora,如下所示:
ORACLE_HOME=/home/oracle/database/product/10.2.0/db_1/
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
;;
'stop')
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut
;;
'restart')
$0 stop
$0 start
;;
esac

设置开机自动运行
chmod 750 /etc/init.d/runora
ln -s /etc/init.d/runora /etc/rc0.d/K10runora
ln -s /etc/init.d/runora /etc/rc3.d/S99runora
chkconfig --add runora
chkconfig --level 345 runora on





阅读(499) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~