redhat oracle实例,RHEL 5.7下Oracle 11g 单实例安装文档

这里介绍在Red Hat Enterprise Linux Server release 5.7 (Tikanga)下安装Oracle 11.2.0.1.0的过程,本文仅仅是为了写这样安装指导文档而整理在此。仅供参考!

1:下载对应平台的ORACLE 11g安装介质

安装ORACLE,首先要获取安装介质,大部分情况手头都有相关版本的安装介质。如果你手头没有安装介质,那么可以从下面链接获取对应平台的ORACLE安装介质。

强烈建议在安装ORACLE之前,先看一遍Linux Installation Guides 文档,毕竟这是最权威、最全面的资料。这样可以避免你在安装过程中遇到各类奇奇怪怪的问题,下载链接如下所示:

08345642176e856441aea18d52cd76f5.png

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 files. If you enable HugePages, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space

Linux Swap大小要求(这是一个指导值,最好根据Linux版本供应商的文档设置。如果不太清楚这些,尽量按照下面要求设置)

85f44fe94c0a0fb16add534631b6dec9.png

检查交换空间(Swap)大小(free命令亦可)

[root@DB-Server ~]# grep SwapTotal /proc/meminfo

SwapTotal: 6029304 kB

Automatic Memory Management

从Oracle Database 11g开始,自动内存管理(Automatic Memory Management)要求更多的共享内存(/dev/shm)和文件描述符(file descriptors),共享内存的大小应该只是比MEMROY_MAX_TARGET 和MEMROY_TARGET大。

查看共享内存大小

[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 file descriptors. The size of the shared  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 file descriptors for each Oracle instance must be at least  512*PROCESSES. The limit of descriptors for each process must be at least 512. If file  descriptors are not sized correctly, you see an ORA-27123 error from various Oracle  processes and potentially Linux Error EMFILE (Too many open files)in non-Oracle  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

edd1a77332559ff6ee7b8d102d9e0568.png

检查/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 Configuring Kernel Parameters and Resource Limits

在修改内核参数前,我们先检查、查看这些内核参数的配置值

[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 file-max

fs.file-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 ~]#

f449a67729e4be8ace4944129c391040.png

官方文档关于内核参数的推荐值如下截图所示,如果系统里面的配置大于这个值,那么就使用默认的值,不需要修改该参数值。

fb73ef5fa5de5e0eee52e5e07141bc12.png

注意:If the current value of any parameter is higher than the valuelisted in this table, then do not change the value of that parameter.

在 /etc/sysctl.conf中添加如下参数的设置值,如果这一步设置有误,也没有关系,后面安装过程会检测系统参数,提示参数设置有误,不能通过。需要你重新配置。

fs.file-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新增了fixup脚本,在安装过程中,安装程序将会检查推荐的操作系统内核参数设置以及必须的软件包,对于不符合要求的部分将会自动生成runfixup.sh,只需要手动以root用户执行该脚本即可,不需要手动调整配置了。所以这一块即使一些内核参数配置不正确,也可以在后面环境快速处理、验证。

5:创建系统账号和用户组

一般要检查是否存在oracle以及dba、oinstall用户组,如果是新环境,可以直接跳过,如果以前安装过Oracle数据库,那么就必须检查一下。

[root@DB-Server ~]# more /etc/oraInst.loc

/etc/oraInst.loc: No such file 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:unconfined_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

10240

[root@DB-Server ~]# ulimit -Hs

unlimited

[root@DB-Server ~]#

在配置文件/etc/security/limits.conf 里面设置

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

修改用户验证选项

在/etc/pam.d/login配置文件里面加上下面配置,如果已经存在的,就忽略这些。

session required pam_selinux.so

session required /lib/security/pam_limits.so

7:修改用户配置文件

root用户下:修改/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

或是在oracle用户下,修改.bash_profile

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_profile参数文件

[oracle@DB-Server ~]$ vi .bash_profile

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/sysconfig/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 file /home/oracle/.Xauthority

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 specified in /home/oracle/.vnc/xstartup

Log file 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

48efffc2cddaa3cea528cded791d30f2.png

ORACLE 11g图形化安装步骤

将安装介质解压到/tmp/database下,然后按照下面步骤安装

$ ./runInstaller

如果没有Oracle Support账号或不想设置,取消勾选选项。

30021af87133650e9a5966b0cc14007e.png

36bd8d4ac0f4a3dd57f4b9be7552b48b.png

0d2ffaa5cb533d2ea66e2627f23dc108.png

勾选Server Class

2365290f6d1dbf20f5eec2bd370efeb9.png

b38d5f8ec61df88b4cc05bb226f74c7d.png

我们勾选“Advanced install”

bde911b74f7aae92ad93a8a2e9caecd6.png

dea984a6aca2c50afb636094dae4c7a1.png

24265a3946cfc7cea2bed572a486b9fb.png

574b67c726e945ef6b31fc08d80d89d6.png

394e37e7e404a4765034d3c73c9a0cd0.png

92bc2626bc33f24de8820a387d09a95e.png

9adaa473715d961556619ca55cf8616c.png

b8f9c6e6357004f7d95e5904df974849.png

此处设置字符集,SGA Target等。

334373ba3c8c841f819d3db80727b6ff.png

ba02706590b7d1e68f37edf4183959eb.png

548a0ebee6a14d4d2097998c70ba1b3a.png

162772e5e24f5a61fe9593e2b62b390d.png

2b6a7e0f28b8b27af95161b82ac74e89.png

Qwe123456

181c0be77ae678278a851d4b9d9fc4e2.png

0c267c7e560bb8cdeedeee7c8a2082f3.png

f770ab68dc3c3c88416f7bfdf7aaf086.png

8ac65e636f08e57758734630874beceb.png

8c1946832ee24f8019e8056a76fca7d8.png

[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 file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

[root@DB-Server Server]#

至此安装完成,然后测试验证,必要的话,关闭VNC服务,修改iptables设置。

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值