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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章