天天看點

RedHat As 5.5 安裝 Oracle 10g資料庫

一、安裝環境

system : redhat as 5.5

oracle version : oracle 10g

二、準備安裝

1.修改/etc/redhat-release内容為

redhat-4

2.建立oracle相關的使用者及目錄

将使用者切換到root帳号,進行登入

# su -

建立oracle相關的使用者組,使用者

# groupadd oinstall

# groupadd dba

# useradd oracle -g oinstall -g dba

修改oracle使用者的密碼

#passwd oracle

3.建立安裝oracle相關的目錄,并進行相應的授權操作

# mkdir -p /opt/oracle/oracle10g

# chown -r oracle:oinstall /opt/oracle

# chmod -r 755 /opt/oracle

4.修改安裝oracle的相關參數

使用編輯器修改/etc/sysctl.conf檔案的相關參數

kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 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.wmen_max=262144  

運作下面的指令應用以上os參數

# /sbin/sysctl -p

5.添加以下行到/etc/security/limits.conf檔案中

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

6.如果/etc/pam.d/login檔案中沒有以下行,則添加以下内容:

session    required     /lib/security/pam_limits.so

7.修改/etc/selinux/config檔案來關閉linux防火牆,確定selinux設定如下:

selinux=disabled

檢查是否具備以下安裝包:

make-3.79.1  

gcc-3.2.3-34  

glibc-2.3.2-95.20  

compat-db-4.0.14-5  

compat-gcc-7.3-2.96.128  

compat-gcc-c++-7.3-2.96.128  

compat-libstdc++-7.3-2.96.128  

compat-libstdc++-devel-7.3-2.96.128  

libxp   

openmotif21-2.1.30-8  

setarch-1.3-1  

查詢所需安裝包是否完整(缺啥補啥)

rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel libxp  

用以下指令安裝以下包:

rpm -uvh [包名稱] 或:yum install [包名稱]

5.使用oracle使用者登入進行登入

修改主目錄下的.bash_prifile

在檔案的末尾添加如下内容

export oracle_base=/opt/oracle export oracle_home=$oracle_base/oracle10g export oracle_sid=wenin819 export path=$path:$oracle_home/bin export ld_library_path=$oracle_home/lib:/usr/lib

6.将oracle使用者的環境變量立刻生效

$ source  ~/.bash_profile

三、安裝oracle10g資料庫

1.解壓oracle10g安裝壓縮包,進行授權操作

$ unzip 10201_database_linux32.zip

或64位 $ $ zcat 10201_database_linux_x86_64.cpio.gz | cpio -idmv

如果擔心安裝界面中文亂碼設定環境變量(使用英文環境安裝)

export lang=c  

2.進入該目錄執行安裝操作

$ cd database

$ ./runinstall

1.   選擇安裝方式,選擇進階安裝 2.  選擇安裝目錄 3.   選擇安裝類型, 在選擇安裝類型時,選擇産品語言,把中文選上,不選的話,資料庫預設為支援的語言隻有英文。 4.   安裝詳細路徑 5.   軟體要求檢查 6.   配置選項 一般選擇“建立資料庫(c)” 7.   資料庫配置 一般選擇“一般用途(g)” 8.   資料庫配置詳情,字元集根據實際情況選擇,可以選擇al32utf8/zhs16gbk,這樣可以支援中文 9.   資料庫管理選項 一般選擇“使用database control管理資料庫” 10.  資料庫檔案存儲選項 一般選擇“檔案系統” 11.  備份和恢複選項 一般選擇“不啟用自動備份” 12.  設定密碼 根據個人情況設定密碼 14.  配置assistants 15.  資料庫配置助手 16.  密碼管理 17.  運作腳本, 必須在root使用者下運作。 18.  結束安裝

3.切換到root賬戶下,執行root.sh檔案

# cd /opt/oracle/oracle10g

# ./root.sh

4.安裝成功後,修改/etc/oratab檔案

設定每個執行個體的重新開機标志為“y”

     wenin819:/opt/oracle/oracle10g:y

補充:需要oracle使用者運作orca指令,進行相關的配置

[oracle@localhost db_1]$ orca

(-c:5895): gtk-warning **: locale not supported by c library.         using the fallback 'c' locale. welcome to orca setup. select desired speech system: 1. emacspeak speech services 2. gnome speech services enter choice: 2 select desired voice: 1. kal_diphone 2. ked_diphone enter choice: 1 enable echo by word?  enter y or n: y enable key echo?  enter y or n: y enable alphanumeric and punctuation keys?  enter y or n: y enable modifier keys?  enter y or n: y enable locking keys?  enter y or n: y enable function keys?  enter y or n: y enable action keys?  enter y or n: y enable braille?  enter y or n: y enable braille monitor?  enter y or n: y accessibility support for gnome has just been enabled. you need to log out and log back in for the change to take effect. setup complete.  press return to continue. 

5.修改$oracle_home/bin/dbstart

$ cd $oracle_home

$ cd bin

使用vi 編輯器對dbstart檔案進行修改

$vi dbstart

将以下内容:

oracle_home_listner=/ade/vikrkuma_new/oracle

更改為:

oracle_home_listner=$oracle_home

6.測試oracle 10g 資料庫:

啟動oracle10g 資料庫sqlplus

$ sqlplus "/as sysdba" 

将出現如下連接配接資料庫資訊:

sql*plus: release 10.1.0.2.0 - production on 星期三 3月 24 16:23:27 2004 copyright (c) 1982, 2004, oracle. all rights reserved. 連接配接到: oracle database 10g enterprise edition release 10.1.0.2.0 - production with the partitioning, olap and data mining options sql>

表明登入資料庫系統成功,運作startup指令啟動資料庫。

sql> startup oracle instance started. total system global area 336356520 bytes fixed size 279720 bytes variable size 268435456 bytes database buffers 67108864 bytes redo buffers 532480 bytes database mounted. database opened.

表示資料庫正常啟動。

8. 關閉oracle10g 資料庫

$ sqlplus "/as sysdba" //以sysdba使用者登入資料庫

成功登入資料庫系統後,運作shudown指令關閉資料庫。

sql> shutdown immediate

9. 啟動oracle10g監聽程式

oracle的監聽程式主要是為用戶端的連接配接提供接口,在控制台視窗鍵入如下指令:

$ lsnrctl  

将出現如下監聽程式資訊:

lsnrctl for 32-bit windows: version 10.1.0.2.0 - production on 24-3月 -2004 16 :59:51 copyright (c) 1991, 2004, oracle. all rights reserved. 歡迎來到lsnrctl, 請鍵入"help"以獲得資訊。 lsnrctl>

表明登入監聽程式控制台成功,運作start指令啟動監聽程式。

lsnrctl> start  

将出現監聽程式的一系列啟動和配置情況資訊清單。

資訊行的最後一行是“the command completed successfully”字樣時,監聽程式啟動成功。

10. 關閉oracle10g監聽程式

運作stop指令關閉監聽程式。

lsnrctl> stop 

11.設定oracle自動啟動與關閉

建立oracled服務啟動腳本

在/etc/init.d目錄下建立檔案名稱為oracled的檔案

在oracled檔案中添加如下内容:

12.給檔案進行授權,添加服務,啟動服務

# cd /etc/init.d

# chmod 755 oracled

# chkconfig --add

oracled

# service oradb start

三、安裝是錯誤解決

ora-27125:

# id

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

# id oracle

uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

# more /proc/sys/vm/hugetlb_shm_group

# echo 500 >>/proc/sys/vm/hugetlb_shm_group

不過這樣設定重新開機後參數就丢失了,可以在/etc/sysctl.conf或/etc/sysctl.d/oracle.conf檔案裡面添加該參數

vm.hugetlb_shm_group=500 (500為oinstall的使用者組号)

之後運作指令

#sysctl -p

#sysctl -p /etc/sysctl.d/oracle.conf

可使該參數在核心記憶體中立即生效

四、 參見:https://www.oratoolkit.ch/knowledge/howto/installation/sesrv-10g-r2-on-rhel-6.0-x86_64.php