學習的進度有點慢,終於在虛擬機器上Red Hat Enterprise Linux 5.5系統下安裝Oracle 11g R2版本資料庫成功了,在這裡把安裝的經驗和大家分享一下!當然,水平有限,請各路大蝦們多包涵,多指教!!
我用的軟體版本是linux_11gR2_database_32bit,可以到oracle官網上下載。
之前查過oracle的官方安裝文檔,上面有介紹,對一些硬體環境和軟體包等的要求。這裡暫時羅列我這次用到的相關資訊。希望對大家有所協助。
Oracle 11g R2資料庫安裝硬體設定要求:
最小記憶體 1 GB of RAM
虛擬記憶體容量
Available RAM Swap SpaceRequired
Between 1 GB and 2 GB 1.5times the size of RAM
Between 2 GB and 16 GB Equal to the size of RAM
More than 16 GB 16 GB
硬碟空間要求
Installation Type Requirement for Software Files (GB)
Enterprise Edition 3.95
Standard Edition 3.88
Oracle 11g R2資料庫支援的作業系統
Oracle Database 11g Release 2 (11.2) forLinux x86:
Asianux 2.0
Asianux 3.0
Oracle Enterprise Linux 4.0 Update 7 orlater
Oracle Enterprise Linux 5.0
Red Hat Enterprise Linux 4.0 Update 7 orlater
Red Hat Enterprise Linux 5.0
SUSE Linux Enterprise Server 10.0
SUSELinux Enterprise Server 11.0
需要的軟體包支援:
這裡只列出Asianux 3, Oracle Enterprise Linux 5.0, and Red Hat Enterprise Linux5.0等系統對軟體包的要求系統是否安裝過這些包。
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
numactl-devel-0.9.8.x86_64
sysstat-7.0.2
unixODBC-2.2.11 (32-bit) or later
unixODBC-devel-2.2.11 (64-bit) or later
unixODBC-2.2.11 (64-bit) or later
下面開始正式的安裝過程:
1、安裝前準備工作、軟體包檢查、配置環境變數
將oralce的安裝包上傳到主機上,推薦一個工具SSH Secure Shell Client,很好用。如下我上傳到了root使用者的案頭上並解壓:
[root@oraclehost ~]# ls
linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip
[root@oraclehost ~]# unzip linux_11gR2_database_1of2.zip
[root@oraclehost ~]# unzip linux_11gR2_database_2of2.zip
[root@oraclehost ~]# ls
database linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip
1.1 檢查所需軟體包是否已安裝
根據上面所羅列的在rhel5下安裝oracle所需的軟體包,一一檢查是否已安裝,命令為:
rpm–qa | grep package_name
如果已安裝,命令輸出會列印出已安裝的軟體包的名稱;如果沒有輸出,則證明此包沒有安裝,可從RedHat的安裝盤或者鏡像中擷取,然後使用如下命令安裝:
rpm -ivh package_name
1.2 建立oracle使用者
根據oracle官方文檔所述,需要建立oinstall、dba、oper(可選)使用者組和oralce使用者,下面是我的建立過程,不過我並沒有建立oper組:
[root@oraclehost ~]#/usr/sbin/groupadd oinstall
[root@oraclehost ~]#/usr/sbin/groupadd dba
[root@oraclehost ~]#/usr/sbin/useradd -g oinstall -G dbaoracle
[root@oraclehost ~]#passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@oraclehost ~]#
1.3 修改系統相關參數
1.3.1 修改核心參數
修改 /etc/sysctl.conf檔案,加上如下參數
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
配置完後,執行下面命令將參數寫入核心應用
[root@oraclehost ~]#/sbin/sysctl -p
1.3.2 修改使用者的限制和驗證等設定檔
修改 /etc/security/limits.conf檔案,加上下面的參數
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改使用者驗證選項
修改/etc/pam.d/login檔案加上如下參數
session required pam_limits.so
修改/etc/profile檔案加入如下參數:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
1.3.3 設定oracle的安裝路徑配置
[root@oraclehost ~]# mkdir -p /u01/
[root@oraclehost ~]# mv /root/Desktop/database /u01/
[root@oraclehost ~]# chown -R oracle:oinstall /u01/
[root@oraclehost ~]# chmod -R 775 /u01
1.3.4 修改環境變數
切換到oracle使用者,修改使用者bash shell
[root@oraclehost ~]# su - oracle
[oracle@oraclehost ~]$ vi .bash_profile
增加如下內容:
export ORACLE_BASE=/u01/app
export ORACLE_HOME=$ORACLE_BASE/oracle
export ORACLE_SID=dmb2 //*資料庫的SID,根據自己的需要和習慣命名*
exportPATH=$ORACLE_HOME/bin:$PATH:$HOME/bib
至此系統內容配置和準備工作都已經做完了,必要的話可以重啟一下系統,因為改變了很多的系統配置。
2、執行圖形介面安裝(使用oracle使用者)
[root@oraclehost ~]# su - oracle
[oracle@oraclehost ~]$ cd /u01/database/
[oracle@oraclehost ~]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than80 MB. Actual 27515 MB Passed
Checking swap space: must be greater than150 MB. Actual 4094 MB Passed
Checking monitor: must be configured todisplay at least 256 colors. Actual16777216 Passed
Preparingto launch Oracle Universal Installer from /tmp/OraInstall2013-07-17_07-18-53PM.Please wait ...
可以不填寫,彈出提示框,直接點擊yes。
選擇install datebase software only,直接安裝軟體,稍後建庫。下一步
選擇安裝server類型,選single,如果需要叢集則安裝另外一種
選擇語種,
選擇要安裝的軟體版本,這裡我選擇的是企業版,下一步
選擇軟體安裝路徑,之前在環境變數中已經設定過,這裡軟體自動檢測到,預設即可,單擊下一步
選擇oracle所需使用者組,自動檢測到,預設即可。
然後軟體安裝程式開始檢測硬體環境,所需軟體包等配置是否正確,如:
檢測結果如,實體記憶體和交換分區大小都達不到要求,我是在虛擬機器中安裝的,雖然記憶體設定的1G,實際上確實差了點,所以檢測失敗,不過這個不影響安裝,勾選ignore all ,下一步即可
下面是配置總攬,如無錯誤,點擊finish,開始安裝。
快安裝完畢會提示以root使用者的身份執行兩個指令碼,orainstRoot.sh和root.sh。具體路徑根據你開始設定的路徑而定,安裝程式會提示。下面是我安裝過程中,執行指令碼的過程:
[root@oraclehost database]#/u01/oraInventory/orainstRoot.sh
Changing permissions of /u01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions forworld.
Changing groupname of /u01/oraInventory tooinstall.
The execution of the script is complete.
[root@oraclehost database]#/u01/app/oracle/root.sh
Running Oracle 11g root.sh script...
The following environment variables are setas:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle
Enter the full pathname of the local bindirectory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratabfile as needed by
Database Configuration Assistant when adatabase is created
Finished running generic part of root.sh script.
Now product-specific root actions will beperformed.
Finished product-specific root actions.
至此,oracle 11g安裝完畢。
接下來,還有很重要的工作,就是建庫和監聽以及建立oracle與監聽的自啟動。這些內容將在下篇文章中分享給大家,如有興趣,請繼續關注! 見