oracle9i 在fedora上的安装

经过几天的尝试,终于在fedora5上成功安装了oracle9.2.0.4。 在网上搜了篇文章,原文地址: http://ivan.kartik.sk/oracle/install_ora9_fedora.html,我这个基础上加了些文字(中文):

 

Installation of Oracle 9i (R2) on Fedora Core Linux 2, 3, 4, 5 and 6

 

 

安装步骤:

This paper covers following steps:

  • Pre-Instalation Tasks

  • Download & Install

  • Post-Instalation Tasks

  • Checking for success

  • Script of startup/shutdown oracle

Pre-Instalation Tasks

1. Create oracle User Account
Login as root and create te user oracle which belongs to dba group.

su -
# groupadd dba
# useradd -g dba oracle


2. Setting System parameters
Edit the /etc/sysctl.conf and add following lines:

kernel.sem = 250 32000 100 128
kernel.shmmax = 2147483648
kernel.shmmni = 128
kernel.shmall = 2097152
kernel.msgmnb = 65536
kernel.msgmni = 2878
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

Note: You need execute "sysctl -p" or reboot system to apply above settings.

Edit the /etc/security/limits.conf file and add following lines:

* - nproc 16384
* - nofile 16384


3. Setting Oracle Enviroment
Edit the /home/oracle/.bash_profile file and add following lines:

Settings for Fedora Core 2,3,4 only. For Fedora Core 5 and 6 use the next settings.

## Settings for Fedora Core 2,3,4 only

ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/920
ORACLE_SID=MY_ORACLE
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_ASSUME_KERNEL=2.4.1
THREADS_FLAG=native
ORACLE_OEM_JAVARUNTIME=/opt/jre1.3.1_19
PATH=$PATH:$ORACLE_HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH LD_ASSUME_KERNEL THREADS_FLAG ORACLE_OEM_JAVARUNTIME PATH


Settings for Fedora Core 5 and 6 only. For Fedora Core 2,3,4 use the above settings. Note setting of LD_ASSUME_KERNEL will cause incorrect functionality of FC5 and FC6.

## Settings for Fedora Core 5,6 only

ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/920
ORACLE_SID=MY_ORACLE
LD_LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_OEM_JAVARUNTIME=/opt/jre1.3.1_19
PATH=$PATH:$ORACLE_HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH ORACLE_OEM_JAVARUNTIME PATH


Save the .bash_profile and execute following commands for load new enviroment:

cd /home/oracle
. .bash_profile


4. Create base directory for Oracle

Login as root and create base directory for Oracle ($ORACLE_BASE).

su -
# cd /opt
# mkdir oracle
# chown oracle:dba oracle

Download & Install

1. Download and install required .rpm packages

(1)Some additional packages are required for succesful instalation of Oracle software. To check whether required packages are installed on your operating system use following command:

rpm -q gcc glibc-headers glibc-kernheaders glibc-devel compat-libstdc++ cpp compat-gcc

Note: You don't need glibc-kernheaders installed on FC6 as this package is not shipped with FC6.
If some package is not installed download it from http://download.fedora.redhat.com/pub/fedora/linux/core


(2)
This step is required for Fedora Core 3 and 4 only. Fedora Core 3 is shipped with compat-gcc-8.3.3.4. Fedora Core 4 is shipped with compat-gcc-32-3.2.3. These package are GCC 3.x compiler which are not useful for succesful inatallation. Check whether compat-gcc-8.3.3.4 or compat-gcc-32-3.2.3 is installed. If so then uninstall it using folowing command:

rpm -e compat-gcc

Download the compat-gcc-7.3-2.96.126.i386.rpm package from Core 2 location or from here.

(3)Install the required packages using the rpm command
(Note version of packages may change in newer release, so versions for all packages (except compat-gcc package) used in next command are just for example.):

# rpm -ivh gcc-3.4.2-6.fc3.i386.rpm /
glibc-headers-2.3.3-74.i386.rpm /
glibc-kernheaders-2.4-9.1.87.i386.rpm /
glibc-devel-2.3.3-74.i386.rpm /
compat-libstdc++-3.4.2-6.fc3.i386.rpm /
cpp-3.4.2-6.fc3.i386.rpm /
compat-gcc-7.3-2.96.126.i386.rpm

注意:如果compat-gcc没有安装,不管FC的版本,请用compat-gcc-7.3-2.96.126.i386.rpm,可以从core 2下载。这些包安装好以后可通过‘rpm –qa |grep compat-’来检查是否安装。

(4)
For Fedora Core 4, 5 and 6 only:Install the required additional packages using the rpm command:

# rpm -ivh compat-libgcc-296-2.96-___.rpm /
compat-libstdc++-33-3.2.3-___.rpm /
compat-libstdc++-296-2.96-___.rpm

注意:如果OSFC5FC5./bash程序有问题。从FC4下载bash软件包并强制安装,不然安装到第二步Linking Oracle Net Required Support files的时候会停在18%不继续。

rpm -ivh bash-3.0-31.i386.rpm --force


(5)If all required packages were installed succesfuly then login as root and switch the GCC3 compiler binary with GCC2 compiler binary as following:

su -
# cd /usr/bin
# mv ./gcc ./gcc3
# mv ./gcc296 ./gcc


2. Download the Java Runtime Enviroment (j2re-1_3_1_19-linux-i586.bin) from http://java.sun.com/products/archive/j2se/1.3.1_19/index.html . Keep in mind you need to download j2re1.3.1_11 or higher
(Note: Install JRE 1.3.1_1x version only).

Login as root and make the the file executable and then execute it. When the JRE is exracted move the "jre1.3.1_19" di rectory to "/opt" directory.

# chmod +x j2re-1_3_1_19-linux-i586.bin
# ./j2re-1_3_1_19-linux-i586.bin
# mv jre1.3.1_19 /opt/

注意:作这一步的目的是oracle9i自带的jre有问题,一定要重新下载,不然在安装的过程中会出错。


3. Download the Oracle 9i (9.2.0.4) software from Oracle website.
Extract the files using following command:

gunzip ship_9204_linux_disk1.cpio.gz
gunzip ship_9204_linux_disk2.cpio.gz
gunzip ship_9204_linux_disk3.cpio.gz

cpio -idmv < ship_9204_linux_disk1.cpio
cpio -idmv < ship_9204_linux_disk2.cpio
cpio -idmv < ship_9204_linux_disk3.cpio


When all archives were extracted you've got three directories Disk1, Disk2 and Disk3.
Edit the Disk1/install/linux/oraparam.ini and modify JRE_LOCATION variable and set path to our JRE installation from Step 2.

JRE_LOCATION=/opt/jre1.3.1_19

4. Start the Oracle software installation process.
如果你不用光盘安装(即安装程序在硬盘里面。我的情况是用PC机联机操作服务器),请开启X服务,启动X服务后执行./runInstaller程序后服务器屏幕上会出现跟光盘安装一样的图形界面。启动X服务的步骤(2)

1root用户登录,运行大写X即可。(如果提示需要删除文件/tmp/.X0-lock,先删除/tmp/.X0-lock):

#X

2)以oracle用户登录,运行如下命令:

#export DISPLAY=:0

 

在运行runInstaller之前先让oracle用户的环境变量生效:

#source /home/oracle/.bash_profile


Now the system is prepared for Oracle software installation. To start the installation process execute the following commands:

cd Disk1
./runInstaller


When network configuration assistant and database configuration assistant has failed during st artup then do following steps:

cd /opt/oracle/920
rm JRE
ln -s /opt/jre1.3.1_19 JRE
su -
# cd /opt/oracle/920/JRE/bin
# ln -s java jre
# cd i386/native_threads
# ln -s java jre

 

 

 

Post-Instalation Tasks

1. Switch back the GCC binaries

su -
# cd /usr/bin
# mv ./gcc ./gcc296
# mv ./gcc3 ./gcc


2. Change of JRE path in Oracle Universal Installer

Edit the $ORACLE_BASE/oui/oraparam.ini file and modify the value of JRE_LOCATION to /opt/jre1.3.1_19

3. (Optional) You may consider to use rlwrap for comfortable work with sqlplus. RPM package for Fedora Core (x86) distribution you can download
here.

su -
# rpm -ivh rlwrap-0.24.fedora.i386.rpm
# exit
echo "alias sqlplus='rlwrap sqlplus'" >> /home/oracle/.bash_profile
. /home/oracle/.bash_profile

 

Checking for success

1. 创建数据库

oracle用户登录,在bin目录下执行./dbca,然后按照图形界面的步骤创建好数据库。

 

注意:

1)建立新DB时会出现两个错误,这是Oracle bug

1>ORA-29807: specified operator does not exist
   
可以忽略掉,安装完成后,在$ORACLE_HOME/rdbms/admin 目录下运 utlrp.sql ,用于修补ORA-29807 错误。

2>ORA-01430: column being added already exists in table, 可以忽略掉。

 

2)请把数据库的全局变量名、SID、密码等记下来。

 

2. 启动监听器程序lsnrctl

# ./lsnctrl start

(可通过./lsnctrl status查看lsnctrl的启动情况)

如果启动出错,查看 $oraclehome/network/admin/ 下面是否有listener.oratnsnames.ora,

listener.ora是服务器端的监听器配置文件;
tnsnames.ora
是客户端的连接到数据库服务器用的名称解析文件;

如果没有用netca图形化工具生成,或手动编辑,如:

 

 

listener.ora

LISTENER =

  (ADDRESS_LIST=

       (ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521))

      # (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))

)

 

# SID_LIST_<lsnr>

#   List of services the listener knows about and can connect

#   clients to.  There is no default.  See the Net8 Administrator's

#   Guide for more information.

#

 SID_LIST_LISTENER=

   (SID_LIST=

       (SID_DESC=

                       #BEQUEATH CONFIG

          (GLOBAL_DBNAME=xms)   #数据库全局名

          (SID_NAME=xms)

          (ORACLE_HOME=/opt/oracle/920)

          

        )

)

 

tnsnames.ora

# TNSNAMES.ORA Network Configuration File: /opt/oracle/920/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

XMS =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = xms)

    )

  )

 

 

3. 启动数据库

# sqlplus  /" as sysdba"

SQL>startup

 

4. 检验创建的数据库是否存在

SQL>select name from v$database;

 

 

 

Script of startup/shutdown oracle

dbstart.sh--------------------------------------------------------------------------------------

echo "begin to start oracle..."

lsnrctl start

sqlplus /nolog <<EOF

connect /as sysdba

startup

exit

EOF

echo "oracle have started..."

 

 

dbstop.sh--------------------------------------------------------------------------------------

echo "begin to stop oracle..."

lsnrctl stop

sqlplus /nolog <<EOF

connect /as sysdba

shutdown immediate

exit

EOF

echo "oracle have stopped..."

 

/etc/rc.d/rc3.d/下建立文件S99ORACLE9204

内容为:

#!/bin/sh

su - oracle -c "/oracle/dbstart.sh"

 

修改其属性为755

chmod 755 S99ORACLE9204

 

并将S99COMPUTE 复制到/etc/rc.d/rc5.d/

 

 

 

附录:关于数据库删除重新安装的问题:

  ORACLE安装目录删除及/etc/ora*.*删除就行了

#rm –f  /etc/ora*.*

 

发布了18 篇原创文章 · 获赞 5 · 访问量 4万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章