作業系統:Red Hat Enterprise Linux Server release 6.2 x86_64
Oracle版本:Oracle Database 11g Release 2
Oracle官方下載地址:
File1:http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
File2:http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
Oracle11gR2官方文檔地址:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#CEGHFFGG
使用到的工具:
SecureCRT
VNC-Viewer-5.1.1-Windows-64bit.exe(http://www.realvnc.com/download/viewer/)
伺服器IP:192.168.109.129
硬體要求:官方要求記憶體至少1GB,推薦2GB或更多。
官方給的實體記憶體和Swap交換空間的關係表:
Available RAM Swap Space Required
Between 1 GB and 2 GB 1.5 times the size of the RAM
Between 2 GB and 16 GB Equal to the size of the RAM
More than 16 GB 16 GB
檢查本機記憶體:
[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal: 1164632 kB
[root@localhost ~]# grep SwapTotal /proc/meminfo
SwapTotal: 2097144 kB
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 1137 1026 111 0 18 430
-/+ buffers/cache: 576 560
Swap: 2047 190 1857
查看本機系統架構:
[root@localhost ~]# uname -m
x86_64
磁碟空間要求:
官方要求/tmp空間至少要1GB
[root@localhost ~]# df -h /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 38G 14G 22G 39% /
檢查軟體環境:
支援的系統(只選取redhat):
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 6 (with the Oracle Unbreakable Enterprise Kernel for Linux)
核心要求:
· On Red Hat Enterprise Linux 6
2.6.32-71.el6.x86_64 or later
· On Red Hat Enterprise Linux 6with Unbreakable Enterprise Kernel
2.6.32-100.28.5.el6.x86_64 or later
查看本機核心版本:
[root@localhost ~]# uname -r
2.6.32-220.el6.x86_64
官方要求需要安裝的軟體包:
The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6 must be installed:
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
Oracle ODBC Driver:
On Oracle Linux 6 and Red Hat Enterprise Linux 6:
unixODBC-2.2.14-11.el6 (x86_64) or later
unixODBC-2.2.14-11.el6.i686 or later
unixODBC-devel-2.2.14-11.el6 (x86_64) or later
unixODBC-devel-2.2.14-11.el6.i686 or later
檢查並安裝所要求的軟體包:
由於所需安裝的包既有32位,又有64位,所以就一個個檢查安裝。
檢查使用rpm -q packgename (不看版本號碼)
安裝使用rpm -ivh packge_full_name
我這裡已經使用系統硬碟做好了本地yum源,由於使用rpm -ivh packge_full_name安裝時可能會存在依賴包,所以直接使用yum安裝的方式來安裝,如下:
系統掛在在/iso目錄下:
[root@localhost ~]# cd /iso/Packages/
[root@localhost Packages]# yum -y install binutils-2.20.51.0.2-5.28.el6.x86_64.rpm
這樣有依賴包便會自動安裝,已經裝了的話,直接跳過就ok,注意,務必一個個安裝,避免遺失包,後米安裝時報錯。
建立所需的使用者和組:
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -Gdba oracle
[root@localhost ~]# id oracle
uid=500(oracle) gid=500(oinstall)groups=500(oinstall),501(dba)
[root@localhost ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is toosimplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updatedsuccessfully.
配置核心參數:
官方要求的:
查看方法:
在/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 = 1048576
生效:
[root@localhost ~]# /sbin/sysctl -p
確認值被正確設定:
1
[root@localhost ~]# /sbin/sysctl -a
在oracle使用者下檢查設定Resource Limits
k3.png
To create the Oracle base directory:
Enter the following command to display information about all mounted file systems:
# df -k
This command displays information about all the file systems mounted on the system, including:
The physical device name
The total amount, used amount, and available amount of disk space
The mount point directory for that file system
From the display, identify either one or two file systems that meet the disk space requirements mentioned earlier in this section.
Note the name of the mount point directory for each file system that you identified.
Enter commands similar to the following to create the recommended subdirectories in the mount point directory that you identified and set the appropriate owner, group, and permissions on them:
# mkdir -p /mount_point/app/
# chown -R oracle:oinstall /mount_point/app/
# chmod -R 775 /mount_point/app/
For example:
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R 775 /u01/app/
[root@localhost ~]# vim /etc/security/limits.conf
添加以下:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
建立所需目錄:
[root@localhost ~]# mkdir -p /oracle/app
[root@localhost ~]# chown -Roracle:oinstall /oracle/app/
[root@localhost ~]# chmod -R 775/oracle/app/
配置oracle使用者的環境變數:
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vim .bash_profile
添加以下:(紅色部分):
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startupprograms
PATH=$PATH:$HOME/bina
ORACLE_BASE=/oracle/app/oracle
ORACLE_SID=orcl
export PATH ORACLE_BASEORACLE_SID
開始安裝:
上傳安裝檔案linux.x64_11gR2_database_1of2.zip和linux.x64_11gR2_database_2of2.zip至/目錄
使用root使用者解壓:
[root@localhost/]# unzip linux.x64_11gR2_database_1of2.zip
[root@localhost/]# unzip linux.x64_11gR2_database_2of2.zip
ok,安裝前工作完成,為確保所有設定都神效,最好重啟一下機器。
# reboot
重啟後,進入圖形介面,終端下執行:
[root@test~]# xhost +
[root@test~]# su - oracle
[oracle@test~]$ cd /database/
[oracle@testdatabase]$ ./runInstaller