本人在redhat 9安装Oracle 9i r2 的经历。
Redhat Enterprise Linux 3, Redhat 9 ,CentOS 3.x安装升级Oracle 9iR2
redhat.com发布redhat 9简写为rh9)后,不再开发redhat 10,11...,全面转向redhat enterprise linux(简写为rhel)的开发,和以往不同的是,新的rhel 3要求用户先购买lisence,redhat.com承诺保证产品的稳定性,安全性。rhel 3二进制代码不再提供下载,而是作为redhat 服务的一部分,但源代码依然是open。所以有了centos ,whitebox,dao 等等一批open source的企业版本,其中centos最为活跃。rh9为作rhel3基础和rhel3 ,centos是同气连枝的,软件包版本几乎是一致的。 安装方案:先安装基本数据库软件,然后升级,最后创建数据库。直接安装,在最后创建数据库时后出现agent错误,导致数据库失败,当然要安装成功,可以通过一些patch解决,这些patch,和方法都可以在www.itpub.net上找到。 oracle 9i是个大块头,建议预备5G以上分区,我/opt/分区为4.0G,在创建数据时,空间不够,所以将数据库文件放在/var/opt/oracle下面。
1.安装前的预备 1.1.调整系统参数(可选) 添加以下几行到 /etc/sysctl.conf末尾: kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.shmall = 2097152 kernel.sem = 250 32000 128 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000
添加以下几行到/etc/security/limits.conf末尾: oracle soft nofile 65536 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384
[hantsy@hantsy]$ sudo echo 250 32000 100 128 > /proc/sys/kernel/sem [hantsy@hantsy]$ sudo echo 536870912 > /proc/sys/kernel/shmmax [hantsy@hantsy]$ sudo echo 4096 > /proc/sys/kernel/shmmni [hantsy@hantsy]$ sudo echo 2097152 > /proc/sys/kernel/shmall [hantsy@hantsy]$ sudo echo 65536 > /proc/sys/fs/file-max [hantsy@hantsy]$ sudo echo 1024 65000 > /proc/sys/net/iv4ip_local_port_range
1.2 安装必要的软件 使用 apt或yum安装下面的软件,参见http://ayo.freshrpms.net. nss_db-compat-2.2-20.4 compat-libstdc++-7.3-2.96.128 compat-libgcj-devel-7.3-2.96.123 compat-slang-1.4.5-5 compat-gcc-c++-7.3-2.96.128 compat-libgcj-7.3-2.96.123 compat-libstdc++-devel-7.3-2.96.128 compat-gcc-7.3-2.96.128 compat-db-4.0.14-5.1 compat-pwdb-0.62-3 pdksh
调整gcc,将gcc改成2.96的gcc mv /usr/bin/gcc /usr/bin/gcc32 mv /usr/bin/g++ /usr/bin/g++32 ln -s /usr/bin/gcc296 /usr/bin/gcc ln -s /usr/bin/g++296 /usr/bin/g++
1.3 新建oracle用户和安装目录 [hantsy@hantsy]$sudo groupadd oinstall [hantsy@hantsy]$sudo groupadd dba [hantsy@hantsy]$sudo mkdir -p /opt/oracle/prodUCt/9.2 创建数据库目录,可选,假如安装目录空间足够大,不必另建。 [hantsy@hantsy]$sudo mkdir -p /var/opt/oracle [hantsy@hantsy]$sudo useradd -g oinstall -G dba -d /opt/oracle -uid 1001 oracle [hantsy@hantsy]$sudo passwd oracle [hantsy@hantsy]$sudo chown oracle.oinstall /var/opt/oracle [hantsy@hantsy]$sudo chown -R oracle.oinstall /opt/oracle 以oracle用户登录写入环境变量。
[hantsy@hantsy]$su - oracle PassWord: [oracle@oracle]$pwd /opt/oracle 使用你喜欢的编辑器编辑.bashrc [oracle@oracle]$ .bashrc # .bashrc
# User specific aliases and functions
# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
#set oracle enviroments eXPort LD_ASSUME_KERNEL=2.4.1 export THREADS_FLAG=native
export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/9.2 export ORACLE_SID=oralin export ORACLE_OWNER=oracle
#export NLS_LANG=AMERICAN_AMERICA.UTF8; export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
1.4 下载oracle安装文件,可以从http://mirrors.cn99.com上下载。 p3948480_9206_LINUX.zip ship_9204_linux_disk1.cpio.gz ship_9204_linux_disk2.cpio.gz ship_9204_linux_disk3.cpio.gz p3006854_9204_LINUX.zip 此patch可以从www.itpub.com上找到。
2.开始安装 2.1 打patch,解压安装文件。 [hantsy@hantsy]$sudo unzip p3006854_9204_LINUX.zip [hantsy@hantsy]$sudo cd 3006854 [hantsy@hantsy]$sudo sh rhel3_pre_install.sh 依次解压几个文件: [hantsy@hantsy]$sudo gunzip .cpio.gz [hantsy@hantsy]$sudo cpio -idmv < .cpio 得到Disk1,Disk2,Disk3三个目录。
2.2 开始安装,这时不要建新数据库。 [hantsy@hantsy]$sudo xhost + 切换到oracle用户。 [hantsy@hantsy]$su - oracle Password: [oracle@oracle]$cd /Disk1 [oracle@oracle]$./runInstaller& 启动安装程序,在选择安装类型时选择"Software Only",结束安装。
升级到9.2.0.6,执行此步骤之前请修改/etc/redhat-release,rhel 3不必修改,新的补丁安装程序和oracle 10的一样会检测系统。 确保其内容如下: Red Hat Enterprise Linux AS release 3 (Taroon)
进入9026安装程序目录, [oracle@oracle]$./runInstaller& 选择安装 "Oracle Universal Installer"。 安装完毕,重新启动安装程序。 选择安装 "Oracle9iR2 Patch Set"。
2.3 创建数据库 [oracle@oracle]$dbca & 启动数据库代理,填写必要的参数,创建数据。 也可以预先指定参数。 [oracle@oracle]$`dbca -createDatabase -templateName New_Database.dBT -gdbName oralin.localhost -datafileDestination /var/opt/oralce/oradata/ -sid oralin` & 假如不想启动图形,可以追加上-silent参数。
3 安装后的处理 3.1 创建启动服务程序 假如***没有***进行1.1步,可以从gurulabs(http://www.gurulabs.com/)下载rpm包。 wget -c http://www.gurulabs.com/files/oraclerun9i-1.4-1.noarch.rpm [hantsy@hantsy]$sudo rpm -ivh oraclerun9i-1.4-1.noarch.rpm 它提供了几个文件: [hantsy@hantsy]$sudo rpm -ql oraclerun9i /etc/init.d/oracle /etc/profile.d/oracle.csh /etc/profile.d/oracle.sh /etc/sysconfig/oracle /usr/share/doc/oraclerun9i-1.4/INSTALL
修改/etc/profile.d/oracle.sh,设置$ORACLE_HOME,$ORACLE_SID,$ORACLE_BASE。
export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/9.2 export ORACLE_SID=oralin
修改/etc/sysconfig/oracle,将START_ORALCE改成"yes"。 修改/etc/oratab,将N改成Y。
调整系统参数: [hantsy@hantsy]$sudo /etc/init.d/oracle tunekernel 启动数据库: [hantsy@hantsy]$sudo /etc/init.d/oracle start 关闭数据库: [hantsy@hantsy]$sudo /etc/init.d/oracle stop
假如执行了1.1步,自己手写一个shell(/etc/init.d/oracle)就行了,内容如下 #!/bin/sh # chkconfig: - 20 80 # # description: Oracle auto start-stop script. # 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. ORA_HOME=/opt/oracle/product/9.2 ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart] then echo "Oracle startup: cannot start" exit fi
case "" in 'start') # Start the Oracle databases # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl start su - $ORA_OWNER -c $ORA_HOME/bin/dbstart ;;
'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c $ORA_HOME/bin/dbshut su - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl stop ;;
esac
3.2 还原gcc的链接 [hantsy@hantsy]$sudo rm /usr/bin/gcc [hantsy@hantsy]$sudo rm /usr/bin/g++ [hantsy@hantsy]$sudo mv /usr/bin/g++32 /usr/bin/g++ [hantsy@hantsy]$sudo mv /usr/bin/gcc32 /usr/bin/gcc
参考资料: 1.http://www.itpub.net 2.中国oracle用户组 http://www.cnoug.org 3.Installing Oracle 9i R2 (9.2.0.1.0) on Red Hat 9 http://www.chinalinuxpub.com/read.htm?id=1331 4.Guru labs http://www.gurulabs.com/oracle-linux.Html 5.Oracle9i Release Notes Release 2 (9.2.0.4.0) for Linux x86 http://download-west.oracle.com/docs/html/B13670_03/toc.htm
|