共计 13505 个字符,预计需要花费 34 分钟才能阅读完成。
这里介绍在 Red Hat Enterprise Linux Server release 5.7 (Tikanga) 下安装 Oracle 11.2.0.1.0 的过程,本文仅仅是为了写这样安装指导文档而整理在此。仅供参考!
1:下载对应平台的 ORACLE 11g 安装介质
安装 ORACLE,首先要获取安装介质,大部分情况手头都有相关版本的安装介质。如果你手头没有安装介质,那么可以从下面链接获取对应平台的 ORACLE 安装介质。
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
强烈建议在安装 ORACLE 之前,先看一遍 Linux Installation Guides 文档,毕竟这是最权威、最全面的资料。这样可以避免你在安装过程中遇到各类奇奇怪怪的问题,下载链接如下所示:
http://docs.oracle.com/cd/E11882_01/nav/portal_11.htm
2:检查硬件配置是否满足要求
2.1:内存大小要求
官方文档中,要求物理内存至少需要 1G,推荐 2G 或以上配置,如果是服务器的话,配置肯定比这个高。查看系统内存配置,可以使用下面命令:
检查物理内存
[root@DB-Server ~]# grep MemTotal /proc/meminfo
MemTotal:
3968144 kB
[root@DB-Server ~]# free -m
total
used
free
shared
buffers
cached
Mem:
3875
710
3164
0
85
317
-/+ buffers/cache:
307
3567
Swap:
5887
0
5887
[root@DB-Server ~]#
Note: On Linux, the HugePages feature allocates non-swappable memory for large page tables using memory-mapped
les. If you enable HugePages, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap spacefi
Linux Swap 大小要求(这是一个指导值,最好根据 Linux 版本供应商的文档设置。如果不太清楚这些,尽量按照下面要求设置)
检查交换空间(Swap)大小(free 命令亦可)
[root@DB-Server ~]# grep SwapTotal /proc/meminfo
SwapTotal: 6029304 kB
Automatic Memory Management
从 Oracle Database 11g 开始,自动内存管理(Automatic Memory Management)要求更多的共享内存(/dev/shm)和文件描述符(
le descriptors),共享内存的大小应该只是比 MEMROY_MAX_TARGET 和 MEMROY_TARGET 大。fi
查看共享内存大小
[root@DB-Server ~]# df -h /dev/shm
Filesystem
Size
Used Avail Use% Mounted on
tmpfs
1.9G
927M 1012M
48% /dev/shm
[root@DB-Server ~]#
Starting with Oracle Database 11g, the Automatic Memory Management feature
requires more shared memory (/dev/shm)and
le descriptors. The size of the sharedfi
memory must be at least the greater of the MEMORY_MAX_TARGET and MEMORY_TARGET
parameters for each Oracle instance on the computer. If the MEMORY_MAX_TARGET
parameter or the MEMORY_TARGET parameter is set to a nonzero value, and an incorrect
size is assigned to the shared memory, it results in an ORA-00845 error at startup. On
Linux systems, if the operating system /dev/shm mount size is too small for the Oracle
system global area (SGA) and program global area (PGA), it results in an ORA-00845
error.
The number of
le descriptors for each Oracle instance must be at leastfi
512*PROCESSES. The limit of descriptors for each process must be at least 512. If
lefi
descriptors are not sized correctly, you see an ORA-27123 error from various Oracle
processes and potentially Linux Error EMFILE (Too many open
les)in non-Oraclefi
processes.
注意:MEMORY_MAX_TARGET and MEMORY_TARGET cannot be used when LOCK_SGA is enabled or with HugePages on Linux.
2.2:系统架构要求
检查系统架构是否符合软件安装要求。如果是 x86 的架构,肯定不能运行 64 位的 ORACLE 软件。检查系统架构使用下面命令:
[root@DB-Server ~]# uname -m
x86_64
2.3:磁盘空间要求
At least 1 GB of disk space in the /tmp directory
检查 /tmp 目录大小
#df -h /tmp
检查磁盘空间:
#df –h
3:Checking the Software Requirements
Red Hat Enterprise Linux 5 and Oracle Linux 5 on Linux x86 and Linux x86-64 require Update 2.
3.1: 操作系统要求
Oracle Database 11g Release 1 (11.1) 要求安装在下面版本的操作系统或后续版本中。安装 Oracle 数据库是必须检查目前操作系统版本是否支持。
■ Asianux Server 3 SP2
■ Asianux Server 4 SP3
■ Oracle Linux 4 Update 7
■ Oracle Linux 5 Update 2 (with Red Hat Compatible Kernel)
■ Oracle Linux 5 Update 5
■ Oracle Linux 6
■ Oracle Linux 6 (with Red Hat Compatible Kernel)
■ Oracle Linux 7
■ Oracle Linux 7 (with the Red Hat Compatible Kernel)
■ Red Hat Enterprise Linux 4 Update 7
■ Red Hat Enterprise Linux 5 Update 2
■ Red Hat Enterprise Linux 6
■ Red Hat Enterprise Linux 7
■ SUSE Linux Enterprise Server 10 SP2
■ SUSE Linux Enterprise Server 11
■ SUSE Linux Enterprise Server 12 SP1
■ NeoKylin Linux Advanced Server 6
3.2 操作系统内核要求
下面仅仅列举了部分内容,更多请见官方文档
■On Oracle Linux 4 and Red Hat Enterprise Linux 4
2.6.9 or later
■ On Oracle Linux 5 Update 2 with Red Hat Compatible Kernel
2.6.18 or later
■ On Oracle Linux 5 Update 5 with Red Hat Compatible Kernel
2.6.18 or later
■ On Oracle Linux 5 Update 5 with Unbreakable Enterprise Kernel
2.6.32-100.0.19 or later
■ On Oracle Linux 6
2.6.32-100.28.5.el6.x86_64
or later
■ On Oracle Linux 6 with Red Hat Compatible Kernel
2.6.32-71.el6.x86_64
or later
■ On Oracle Linux 7
3.8.13-33.el7uek.x86_64
or later
■ On Oracle Linux 7 with Red Hat Compatible Kernel
3.10.0-54.0.1.el7.x86_64
or later
■ On Red Hat Enterprise Linux 5 Update 2
2.6.18 or later
■ On Red Hat Enterprise Linux 5 Update 5
2.6.18 or later
■ On Red Hat Enterprise Linux 6
2.6.32-71.el6.x86_64
or later
■ On Red Hat Enterprise Linux 7
3.10.0-54.0.1.el7.x86_64
or later
■ On Asianux Server 3
2.6.18 or later
■ On Asianux Server 4
2.6.32-71.el6.x86_64
or later
查看操作系统内部版本,可以使用下面命令,如下所示,内部版本满足要求。
[root@DB-Server ~]# cat /proc/version
Linux version 2.6.18-274.el5
(mockbuild@x86-002.build.bos.RedHat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)) #1 SMP Fri Jul 8 17:36:59 EDT 2011
[root@DB-Server ~]# uname -r
2.6.18-274.el5
3.3:ORACLE 软件所要求或依赖的一些包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh
\
libaio \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat
[root@DB-Server ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
> compat-libstdc++-33 \
> elfutils-libelf \
> elfutils-libelf-devel \
> gcc \
> gcc-c++ \
> glibc \
> glibc-common \
> glibc-devel \
> glibc-headers \
> ksh
\
> libaio \
> libaio \
> libaio-devel \
> libgcc \
> libstdc++ \
> libstdc++-devel \
> make \
> sysstat
binutils-2.17.50.0.6-14.el5 (x86_64
)
compat-libstdc++-33-3.2.3-61 (x86_64
)
compat-libstdc++-33-3.2.3-61 (i386)
elfutils-libelf-0.137-3.el5 (x86_64
)
elfutils-libelf-0.137-3.el5 (i386)
elfutils-libelf-devel-0.137-3.el5 (x86_64
)
gcc-4.1.2-51.el5 (x86_64
)
gcc-c++-4.1.2-51.el5 (x86_64
)
glibc-2.5-65 (x86_64
)
glibc-2.5-65 (i686)
glibc-common-2.5-65 (x86_64
)
glibc-devel-2.5-65 (x86_64
)
glibc-devel-2.5-65 (i386)
glibc-headers-2.5-65 (x86_64
)
ksh-20100202-1.el5_6.6 (x86_64
)
libaio-0.3.106-5 (x86_64
)
libaio-0.3.106-5 (i386)
libaio-0.3.106-5 (x86_64
)
libaio-0.3.106-5 (i386)
package libaio-devel is not installed
libgcc-4.1.2-51.el5 (x86_64
)
libgcc-4.1.2-51.el5 (i386)
libstdc++-4.1.2-51.el5 (x86_64
)
libstdc++-4.1.2-51.el5 (i386)
libstdc++-devel-4.1.2-51.el5 (x86_64
)
make-3.81-3.el5 (x86_64
)
package sysstat
is not installed
如上检测所示,我们需要安装这些缺少的包:
[root@DB-Server Server]# rpm -ivh
libaio-devel*
warning: libaio-devel-0.3.106-5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:libaio-devel
########################################### [50%]
2:libaio-devel
########################################### [100%]
[root@DB-Server Server]# rpm -ivh sysstat
*
warning:sysstat
-7.0.2-11.el5.x86_64
.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:
sysstat
########################################### [100%]
[root@DB-Server Server]#
3.4 Compiler Requirements
Intel C++ Compiler 10.1 or later and the version of GNU C and C++ compilers listed under “Package Requirements” are supported with these products
3.5 其它软件要求(Additional Software Requirements)
这部分建立参考安装文档(里面内容较详细,有些是特殊要求),这里仅仅涉及 Oracle ODBC 相关驱动。
在 Oracle Linux 5, Red Hat Enterprise Linux 5, and Asianux Server 3 中,需要下面 3 个包的版本
– 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
[root@DB-Server Server]# rpm -ivh unixODBC-2.2.11-7.1.i386.rpm
warning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:unixODBC
########################################### [100%]
[root@DB-Server Server]# rpm -ivh unixODBC-2.2.11-7.1.x86_64
.rpm
warning: unixODBC-2.2.11-7.1.x86_64
.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:unixODBC
########################################### [100%]
[root@DB-Server Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm
warning: unixODBC-devel-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:unixODBC-devel
########################################### [100%]
[root@DB-Server Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.x86_64
.rpm
warning: unixODBC-devel-2.2.11-7.1.x86_64
.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...
########################################### [100%]
1:unixODBC-devel
########################################### [100%]
[root@DB-Server Server]#
4 Con
guring Kernel Parameters and Resource Limitsfi
在修改内核参数前,我们先检查、查看这些内核参数的配置值
[root@DB-Server ~]# /sbin/sysctl -a | grep sem
kernel.sem = 250
32000
32
128
[root@DB-Server ~]# /sbin/sysctl -a | grep shm
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
[root@DB-Server ~]# /sbin/sysctl -a | grep fi
le-max
fs.fi
le-max = 358778
[root@DB-Server ~]# /sbin/sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 32768
61000
[root@DB-Server ~]# /sbin/sysctl -a | grep rmem_default
net.core.rmem_default = 129024
[root@DB-Server ~]# /sbin/sysctl -a | grep rmem_max
net.core.rmem_max = 131071
[root@DB-Server ~]# /sbin/sysctl -a | grep wmem_default
net.core.wmem_default = 129024
[root@DB-Server ~]# /sbin/sysctl -a | grep wmem_max
net.core.wmem_max = 131071
[root@DB-Server ~]#
官方文档关于内核参数的推荐值如下截图所示,如果系统里面的配置大于这个值,那么就使用默认的值,不需要修改该参数值。
注意:If the current value of any parameter is higher than the value listed in this table, then do not change the value of that parameter.
在 /etc/sysctl.conf 中添加如下参数的设置值,如果这一步设置有误,也没有关系,后面安装过程会检测系统参数,提示参数设置有误,不能通过。需要你重新配置。
fs.fi
le-max = 6815744
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000
65500
kernel.sem = 250
32000
100
128
设置完成后执行 /sbin/sysctl -p 使之理解生效,从而不用重启系统。Oracle 11g 新增了
xup 脚本,在安装过程中,安装程序将会检查推荐的操作系统内核参数设置以及必须的软件包,对于不符合要求的部分将会自动生成 runfi
xup.sh,只需要手动以 root 用户执行该脚本即可,不需要手动调整配置了。所以这一块即使一些内核参数配置不正确,也可以在后面环境快速处理、验证。fi
5:创建系统账号和用户组
一般要检查是否存在 oracle 以及 dba、oinstall 用户组,如果是新环境,可以直接跳过,如果以前安装过 Oracle 数据库,那么就必须检查一下。
[root@DB-Server ~]# more /etc/oraInst.loc
/etc/oraInst.loc: No such fi
le or directory
[root@DB-Server ~]# grep oinstall /etc/group
[root@DB-Server ~]# grep dba /etc/group
[root@DB-Server ~]#
创建用户组 dba、oinstall
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
创建用户 oracle
[root@DB-Server ~]# id oracle
id: oracle: No such user
[root@DB-Server ~]# /usr/sbin/useradd -g oinstall -G dba oracle
[root@DB-Server ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba) context=root:system_r:unconfi
ned_t:SystemLow-SystemHigh
[root@DB-Server ~]#
设置账号密码:
[root@DB-Server ~]# 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@DB-Server ~]#
6:修改用户资源限制
[root@DB-Server ~]# ulimit -Sn
1024
[root@DB-Server ~]# ulimit -Hn
1024
[root@DB-Server ~]# ulimit -Su
36848
[root@DB-Server ~]# ulimit -Hu
36848
[root@DB-Server ~]# ulimit -Ss
1024
0
[root@DB-Server ~]# ulimit -Hs
unlimited
[root@DB-Server ~]#
在配置文件 /etc/security/limits.conf 里面设置
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft no
le fi
1024
oracle hard no
le 65536fi
修改用户验证选项
在 /etc/pam.d/login 配置文件里面加上下面配置,如果已经存在的,就忽略这些。
session required pam_selinux.so
session required /lib/security/pam_limits.so
7:修改用户配置文件
root 用户下:修改 /etc/pro
le 文件加入如下参数 fi
if [$USER = "oracle" ]; then
if [$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
或是在 oracle 用户下,修改.bash_pro
lefi
if [$USER = "oracle" ]; then
if [$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
8:安装目录配置
[root@DB-Server ~]# mkdir -p /u01/app/oracle
[root@DB-Server ~]# chown -R oracle:oinstall /u01/app/oracle
[root@DB-Server ~]# chmod -R 775 /u01/app/oracle
[root@DB-Server ~]# mkdir -p /u01/app/oraInventory
[root@DB-Server ~]# chown -R oracle:oinstall /u01/app/oraInventory/
[root@DB-Server ~]# chmod -R 775 /u01/app/oraInventory/
[root@DB-Server ~]#
9:修改用户 bash shell
以 oracle 账号登录,修改.bash_pro
le 参数文件 fi
[oracle@DB-Server ~]$ vi .bash_profi
le
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/dbhome_1
export ORACLE_SID=gsp
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
10:配置 VNC
[root@DB-Server ~]# rpm -qa | grep vnc
vnc-server-4.1.2-14.el5_6.6
[root@DB-Server ~]# vi /etc/sysconfi
g/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
VNCSERVERS="2:oracle"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
[root@DB-Server ~]# su - oracle
[oracle@DB-Server ~]$ vncserver :2
You will require a password to access your desktops.
Password:
Verify:
xauth:creating new authority
le /home/oracle/.Xauthority
fi
xauth: (stdin):1:bad display name "DB-Server.localdomain:2"
in
"add" command
New 'DB-Server.localdomain:2 (oracle)' desktop is DB-Server.localdomain:2
Creating default startup script /home/oracle/.vnc/xstartup
Starting applications specifi
ed in /home/oracle/.vnc/xstartup
Log fi
le is /home/oracle/.vnc/DB-Server.localdomain:2.log
在 root 用户下,设置 iptables,添加
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5902 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
ORACLE 11g 图形化安装步骤
将安装介质解压到 /tmp/database 下,然后按照下面步骤安装
$ ./runInstaller
如果没有 Oracle Support 账号或不想设置,取消勾选选项。
勾选 Server Class
我们勾选“Advanced install”
此处设置字符集,SGA Target 等。
Qwe123456
[root@DB-Server Server]# /u01/oraInventory/orainstRoot.sh
Changing permissions of /u01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/oraInventory to oinstall.
The execution of the script is complete.
[root@DB-Server Server]# /u01/app/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME=
/u01/app
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab fi
le...
Entries will be added to the /etc/oratab fi
le as needed by
Database Confi
guration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specifi
c root actions will be performed.
Finished product-specifi
c root actions.
[root@DB-Server Server]#
至此安装完成,然后测试验证,必要的话,关闭 VNC 服务,修改 iptables 设置。
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
更多 RedHat 相关信息见 RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-08/134217.htm