Redhat6 安裝 Oracle 10g 資料庫

來源:互聯網
上載者:User

0、安裝前的設定

0.1 軟體安裝在什麼位置?安裝在 /home/oracle/database 下面
0.2 資料放在什麼位置?資料放在/home/oracle/database/MTDBdata
0.3 資料庫名稱叫什麼? 資料名 mtyxdb
0.4 需要的字元集是什嗎?ZHS16GBK
0.5 是否歸檔,歸檔到什麼位置?  /home/oracle/database/MTArchiveData

1、安裝環境測試(作業系統在安裝時要把全部的開發環境安裝上)

rpm -q binutils control-center gcc gcc-c++ glibc glibc-common  libstdc++ libstdc++-devel make libaio

PS:如果沒有裝好,也可以使用ISO檔案作為安裝源,重新安裝。

2、vim /etc/sysconfig/i18n

LANG="en_US.UTF-8" # 不顯示中文介面,避免亂碼

3、 vim /etc/redhat-release

內容修改前 Red Hat Enterprise Linux Server release 6.3 (Santiago)
內容修改後 Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

4、vim /etc/sysctl.conf 檔案最後添加如下內容

# for Oracle
kernel.shmmni = 4096
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

5、vim /etc/security/limits.conf 檔案最後添加如下內容

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

PS:執行這個命令 #sysctl -p 使得上述修改參數生效

6、vim /etc/pam.d/login 檔案最後添加如下內容

session    required     /lib/security/pam_limits.so
session    required     pam_limts.so

7、建立使用者和組
      oracle 安裝需要兩個 unix 使用者組和一個運行時的 oracle 使用者。

#groupadd oinstall
#groupadd dba

#useradd -m -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle

{-g表示使用者所屬組、-G表示使用者所屬附加組、-d表示使用者主目錄、-s表示使用者預設shell類型、oracle表示使用者名稱,-m參數表示自動建立此使用者的主目錄,為避免麻煩,請勿手動建立此目錄、-p 表示使用者密碼}

PS:使用者密碼 passwd 一般設定為 oracle

8、進入 /home/oracle 目錄,vim .bash_profile,在檔案開頭添加如下內容

export ORACLE_BASE=/home/oracle/database # 資料庫安裝路徑
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=mtyxdb # 資料庫SID
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$PATH:$ORACLE_HOME/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
#export NLS_LANG=american
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
export umask=022
export LANG=en_US
export NLS_LANG=American_america.ZHS16GBK
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
     else
     ulimit -u 16384 -n 65536
  fi
fi

9、vim /etc/selinux/config 設定 SELINUX 為不可用

SELINUX=disabled

10、vim /etc/hosts 添加本機IP與hostname對應條目

11、在 root 下執行 xhost + 命令,以顯示swing圖形介面

12、開始安裝 

以oracle使用者身份執行安裝程式,./runInstaller

ps:這個錯誤 /home/oracle/database/product/10.2.0/db_1/sysman/lib/snmccolm.o: could not read symbols: File in wrong format
可以忽略,看起來是10.2.0.1安裝介質的BUG,那個snmccolm.o是IA32架構的。可以忽略,安裝完成後打10.2.0.3補丁即可解決。

13、安裝補丁(和安裝新系統一樣的過程)

以oracle使用者身份執行patch中Disk1中的安裝程式,./runInstaller

14、關閉和開啟Oracle資料庫

關閉
#su - oracle
$lsnrctl stop
$sqlplus '/as sysdba'
sql>shutdown immediate

啟動
#su - oracle
$lsnrctl start
$sqlplus '/as sysdba'

sql>startup

15、其他關閉和開啟Oracle資料庫的方法

15.1、在 Linux 系統下安裝完資料庫之後,會在$ORACLE_HOME/bin 下產生 dbstart 和 dbshut 指令碼,這兩個指令碼可以簡便地實現啟動和關閉資料庫。這兩個指令碼運行時會讀取/etc/oratab 檔案,在這個檔案裡指定了需要啟動和關閉的 SID(相應 SID 那行的最後一個字元是 Y 而不是 N)每次產生一個新的資料庫執行個體,都要在這裡作修改15.2、dbstart、dbshut 中的 listener_home的路徑要修改為ORACLE_HOME
15.3、這樣就可以簡單的使用 dbstart、dbshut 關閉和開啟Oracle資料庫
PS:======================================================================# Added for Oracle 10g RAC                 
--  64bit,  64G記憶體的server
kernel.shmall = 16777216
kernel.shmmax = 68719476736     
kernel.shmmni = 4096
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


# Added by tonywang for Oracle 10g RAC           --  64bit,   16G記憶體的server  
kernel.shmall = 4194304
kernel.shmmax = 10737418240
kernel.shmmni = 4096
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

 
# Added by DBA for Oracle DB                    --  32bit,   2~4 G記憶體的server
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
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
PS:======================================================================
/etc/security/limits.conf解釋及應用  

limits.conf的格式如下:

username|@groupname type resource limit

username|@groupname:設定需要被限制的使用者名稱,組名前面加@和使用者名稱區別。也可以用萬用字元*來做所有使用者的限制。

type:有 soft,hard 和 -,soft 指的是當前系統生效的設定值。hard 表明系統中所能設定的最大值。soft 的限制不能比har 限制高。用 - 就表明同時設定了 soft 和 hard 的值。

resource:
core - 限制核心檔案的大小
date - 最大資料大小
fsize - 最大檔案大小
memlock - 最大鎖定記憶體位址空間
nofile - 開啟檔案的最大數目
rss - 最大持久設定大小
stack - 最大棧大小
cpu - 以分鐘為單位的最多 CPU 時間
noproc - 進程的最大數目
as - 地址空間限制
maxlogins - 此使用者允許登入的最大數目

要使 limits.conf 檔案配置生效,必須要確保 pam_limits.so 檔案被加入到開機檔案中。查看 /etc/pam.d/login 檔案中有:
session required /lib/security/pam_limits.soPS:======================================================================

/etc/pam.d/login 

在這個檔案的後面加入 :     session    required   /lib64/security/pam_limits.so  

或著  session    required      pam_limits.so   

就可以防止本地登入一直回複到login狀態的情況 。

PS:======================================================================

安裝資料庫時出現 ORA-27125: unable to create shared memory segment

幫客戶解決一個Linux上資料庫無法啟動的問題。
客戶的Linux 5.6 x86-64環境,安裝資料庫後,啟動資料庫報錯:ORA-27125。Oracle文檔上關於ORA-27125錯誤的描述為:

查詢了一下,發現問題和linux上的hugetbl有關。

解決方案也很簡單,首先檢查oracle使用者的組資訊:

[oracle@yans1 ~]$ id oracle
uid=500(oracle) gid=502(oinstall) groups=502(oinstall),501(dba)
[oracle@yans1 ~]$ more /proc/sys/vm/hugetlb_shm_group
0

下面用root執行下面的命令,將dba組添加到系統核心中:

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

然後啟動資料庫,問題消失。 

PS:==========================================================

安裝patch升級oracle 10.2.0.1到10.2.0.4後,就遇到了啟動資料庫發生這樣的情況ORA-01092: ORACLE instance terminated. Disconnection forced解決方案如下:

原因是由於在完成升級版本後,資料字典的內容被修改了,需要使用catalog.sql和catproc.sql這兩個指令碼再運行一下把資料字典再更新一下。於是使用命令"startup upgrade"啟動資料庫,再運行catupgrd.sql這個指令碼,即運行"@$ORACLE_HOME/rdbms/admin/catupgrd.sql",這條語句會執行比較久的時間,執行了20分鐘左右。執行完成以後,關閉資料庫,再使用startup正常啟動資料庫,再運行一下"@$ORACLE_HOME/rdbms/admin/utlrp.sql"這個指令碼來重新編譯一下一些無效的對象。OK了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.