在Oracle (CentOS) Linux 5.5 (x32/x64)上安装Oracle 10g r2
[日期:2011-02-04] 来源:CSDN 作者:flexitime
1.安装rpm包
nano /v.sh
将下面内容复制进去
对于 x64位版
#!/bin/bash
rpm -Uvh kernel-headers-2.6.18-194.el5.x86_64.rpm
rpm -Uvh glibc-headers-2.5-49.x86_64.rpm
rpm -Uvh glibc-devel-2.5-49.i386.rpm
rpm -Uvh glibc-devel-2.5-49.x86_64.rpm
rpm -Uvh libgomp-4.4.0-6.el5.x86_64.rpm
rpm -Uvh compat-gcc-34-3.4.6-4.x86_64.rpm
rpm -Uvh libstdc++-devel-4.1.2-48.el5.x86_64.rpm
rpm -Uvh gcc-4.1.2-48.el5.x86_64.rpm
rpm -Uvh gcc-c++-4.1.2-48.el5.x86_64.rpm
rpm -Uvh make-3.81-3.el5.x86_64.rpm
rpm -Uvh libXp-1.0.0-8.1.el5.x86_64.rpm
rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm
rpm -Uvh openmotif-2.3.1-2.el5_4.1.x86_64.rpm
rpm -Uvh setarch-2.0-1.1.x86_64.rpm
rpm -Uvh compat-db-4.2.52-5.1.x86_64.rpm
rpm -Uvh compat-gcc-34-3.4.6-4.x86_64.rpm
rpm -Uvh compat-gcc-34-c++-3.4.6-4.x86_64.rpm
rpm -Uvh compat-libstdc++-33-3.2.3-61.x86_64.rpm
rpm -Uvh libXau-devel-1.0.1-3.1.x86_64.rpm
rpm -Uvh libXau-devel-1.0.1-3.1.i386.rpm
rpm -Uvh libXp-devel-1.0.0-8.1.el5.x86_64.rpm
rpm -Uvh libXp-devel-1.0.0-8.1.el5.i386.rpm
对于 x32版本
#!/bin/bash
rpm -Uvh kernel-headers-2.6.18-194.el5.i386.rpm
rpm -Uvh glibc-headers-2.5-49.i386.rpm
rpm -Uvh glibc-devel-2.5-49.i386.rpm
rpm -Uvh libgomp-4.4.0-6.el5.i386.rpm
rpm -Uvh compat-gcc-34-3.4.6-4.i386.rpm
rpm -Uvh libstdc++-devel-4.1.2-48.el5.i386.rpm
rpm -Uvh gcc-4.1.2-48.el5.i386.rpm
rpm -Uvh gcc-c++-4.1.2-48.el5.i386.rpm
rpm -Uvh make-3.81-3.el5.i386.rpm
rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm
rpm -Uvh openmotif-2.3.1-2.el5_4.1.i386.rpm
rpm -Uvh setarch-2.0-1.1.i386.rpm
rpm -Uvh compat-db-4.2.52-5.1.i386.rpm
rpm -Uvh compat-gcc-34-3.4.6-4.i386.rpm
rpm -Uvh compat-gcc-34-c++-3.4.6-4.i386.rpm
rpm -Uvh compat-libstdc++-33-3.2.3-61.i386.rpm
rpm -Uvh libXau-devel-1.0.1-3.1.i386.rpm
rpm -Uvh libXp-devel-1.0.0-8.1.el5.i386.rpm
存盘,
转到安装 dvd的rpm目录下(Centos是Centos 目录, Oralce Linux是 Server目录),执行
bash /v.sh
2.调整内核参数
nano /etc/sysctl.conf
#将原来的# kernel.shmmax和kernel.shmall这两行参数屏蔽
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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
/sbin/sysctl –p --重新加载
nano /etc/security/limits.conf --加入以下四行代码
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
nano /etc/pam.d/login --加入下面一行代码
session required /lib/security/pam_limits.so
3.增加用户及组
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
4.创建安装Oracle的文件夹,并设置其相应权限给Oracle用户。
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
chmod 775 /u01
5.伪装操作系统版本,使安装Oracle时,通过操作系统验证。
cp /etc/RedHat-release /etc/redhat-release.bak
nano /etc/RedHat-release
替换为如下代码:
RedHat-4
在Oracle (CentOS) Linux 5.5 (x32/x64)上安装Oracle 10g r2
[日期:2011-02-04] 来源:CSDN 作者:flexitime
6. 设置Oracle环境变量(可根据你的需要作适当更改)
nano /home/oracle/.bash_profile --加入内容如下
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/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; export 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
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
7.将安装包文件复制到/u01/中
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv < 10201_database_linux_x86_64.cpio
rm 10201_database_linux_x86_64.cpio
cd /
chown -R oracle.oinstall /u01
8.以oracle身份登录图形界面进行安装
cd /u01/database
./runInstaller
安装完成后,以root用户执行
cd /u01/app/oracle/oraInventory/
./orainstRoot.sh
cd /u01/app/oracle/product/10.2.0/db_1/
./root.sh
9.修复乱码问题,
如果启动 em( server ip_address:1158/em)出现乱码,那么按照以下方法修复
在网上下载zysong.ttf
修改java环境设置
cd $ORACLE_HOME/jdk/jre/lib
mv font.properties font.properties.bak
cp font.properties.zh_CN.RedHat font.properties
cd $ORACLE_HOME/jre/1.4.2/lib
mv font.properties font.properties.bak
cp font.properties.zh_CN.RedHat font.properties
复制新的字体文件
mkdir -p /usr/share/fonts/zh_CN/TrueType/
cp ~/zysong.ttf /usr/share/fonts/zh_CN/TrueType/
清空缓存
rm $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs/*.gif
10.将Oracle改成自启动
1.编辑 /u01/app/oracle/product/10.2.0/db_1/bin/dbstart
查找:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
应该是在78行,将其改为:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
2.编辑 /etc/oratab
最下一行
orcl:/u01/app/oracle/product/10.2.0/db_1:N
改为
orcl:/u01/app/oracle/product/10.2.0/db_1:Y
3.新建一个文件 nano /etc/init.d/oracledb
#!/bin/bash
#
# oracledb This Starts/Stops the Oracle Server
# chkconfig: 345 99 10
# description: script for the Oracle Instance, Listener
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
export ORACLE_OWNR=oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
echo "Oracle Script init.d"
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
------------------备注说明 ---------------------------------
# chkconfig: 345 99 10
指出3,4,5级别启动这个服务,99是在相应的/etc/rc.d/rcN.d(N为前面指定的
级别,这里是345)目录下生成的链接文件的序号(启动优先级别)S99oradbstart,
10为在除前面指出的级别对应的/etc/rc.d/rcN.d(N为除345之外的级别)目录生成的
链接文件的序号(服务停止的优先级别)K10oradbstart
撤销服务的话:chkconfig --del oracledb
4.增加启动项
chmod +x /etc/rc.d/init.d/oracledb
/sbin/chkconfig --add oracledb
/sbin/chkconfig --list |grep oracle