linux系统安装Oracle11g详细步骤

时间:2022-05-12 08:31:56

 

快速安装指引

■Reviewing Information About This Guide
■Logging In to the System as root 以root用户登录系统
■Checking the Hardware Requirements 检查硬件需求
■Checking the Software Requirements 检查软件需求
■Creating Required Operating System Groups and Users创建用户和组
■Configuring Kernel Parameters 配置内核参数
■Creating Required Directories 创建所需目录
■Configuring the oracle User’s Environment 配置用户环境
■Mounting the Product Disc 装载安装盘
■Installing Oracle Database 安装数据库
■Installing Oracle Database Examples 安装数据库样例
■What to Do Next?
■Additional Information
■Documentation Accessibility

 

 

Logging In to the System as root

[root@OCP Desktop]# xhost +

access control disabled, clients can connect from any host

配置IP 地址和主机名的映射

[root@OCP Desktop]# vi /etc/hosts

加入下面内容

本机IP(172.16.40.41)  + OCP(别名) OCP.localdomain(主机名)

[root@OCP Desktop]# vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=OCP.localdomain

Checking the Hardware Requirements  

检查硬件需求

 

  •  

RAM

Swap Space

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@OCP Desktop]# grep MemTotal /proc/meminfo

MemTotal:        1541880 kB

[root@OCP Desktop]# uname -m

x86_64

[root@OCP Desktop]# grep SwapTotal /proc/meminfo

SwapTotal:       5119996 kB

[root@OCP Desktop]# free

             total       used       free     shared    buffers     cached

Mem:       1541880     485160    1056720          0      29140     180520

-/+ buffers/cache:     275500    1266380

Swap:      5119996          0    5119996

[root@OCP Desktop]# df -k /dev/shm/

Filesystem     1K-blocks  Used Available Use% Mounted on

tmpfs             770940    76    770864   1% /dev/shm

[root@OCP Desktop]# df -h /tmp

Filesystem                   Size  Used Avail Use% Mounted on

/dev/mapper/vg_ocp-LogVol01   57G  4.1G   50G   8% /

[root@OCP Desktop]# df -h

Filesystem                   Size  Used Avail Use% Mounted on

/dev/mapper/vg_ocp-LogVol01   57G  4.1G   50G   8% /

tmpfs                        753M   76K  753M   1% /dev/shm

/dev/sda1                    477M   55M  397M  13% /boot

 

Checking the Software Requirements

检查软件需求

[root@OCP Desktop]#  cat /proc/version

Linux version 3.8.13-16.2.1.el6uek.x86_64 (mockbuild@ca-build44.us.oracle.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Thu Nov 7 17:01:44 PST 2013

[root@OCP Desktop]# lsb_release -id

Distributor ID: OracleServer

Description:    Oracle Linux Server release 6.5

[root@OCP Desktop]# uname -r

3.8.13-16.2.1.el6uek.x86_64

 

 

以下为oracle linux 6 64位必须安装的软件包

Oracle Linux 6 and Red Hat Enterprise Linux 6

The following packages (or later versions) 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)

 

[root@OCP Desktop]# rpm -qa binutils* compat-lib* gcc*  glibc*  ksh*  libgcc* libstdc* libaio* make* sysstat*

compat-libstdc++-296-2.96-144.el6.i686

compat-libtermcap-2.0.8-49.el6.x86_64

gcc-4.4.7-4.el6.x86_64

gcc-c++-4.4.7-4.el6.x86_64

glibc-headers-2.12-1.132.el6.x86_64

compat-libstdc++-33-3.2.3-69.el6.x86_64

compat-libgfortran-41-4.1.2-39.el6.x86_64

glibc-2.12-1.132.el6.i686

sysstat-9.0.4-22.el6.x86_64

libgcc-4.4.7-4.el6.x86_64

glibc-2.12-1.132.el6.x86_64

libstdc++-4.4.7-4.el6.x86_64

binutils-2.20.51.0.2-5.36.el6.x86_64

make-3.81-20.el6.x86_64

libstdc++-devel-4.4.7-4.el6.x86_64

glibc-devel-2.12-1.132.el6.x86_64

libaio-0.3.107-10.el6.x86_64

compat-libf2c-34-3.4.6-19.el6.x86_64

libgcc-4.4.7-4.el6.i686

gcc-gfortran-4.4.7-4.el6.x86_64

binutils-devel-2.20.51.0.2-5.36.el6.x86_64

compat-libcap1-1.10-1.x86_64

glibc-common-2.12-1.132.el6.x86_64

从显示结果来看,需要的包都已经安装好了。

如果没有安装我们可以搭建yum,利用yum快速安装。

[root@OCP Desktop]#  vi /etc/yum.repos.d/server.repo

[server]

name=OCP

baseurl=file:///media/mycdrom/Server

enabled=1

gpgcheck=0

[root@OCP Desktop]# df -h

Filesystem                   Size  Used Avail Use% Mounted on

/dev/mapper/vg_ocp-LogVol01   57G  4.1G   50G   8% /

tmpfs                        753M  224K  753M   1% /dev/shm

/dev/sda1                    477M   55M  397M  13% /boot

/dev/sr0                     3.7G  3.7G     0 100% /media/OL6.5 x86_64 Disc 1 20131125

[root@OCP Desktop]# umount /dev/sr0

[root@OCP Desktop]# mount /dev/sr0 /media/mycdrom

mount: block device /dev/sr0 is write-protected, mounting read-only

[root@OCP yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak修改yum默认打开的文件,不然它找不到server.repo

[root@OCP Desktop]#yum install -y binutils* compat-lib* gcc*  glibc*  ksh*  libgcc* libstdc* libaio* make* sysstat*

最后执行上面的安装命令

 

Creating Required Operating System Groups and Users

创建操作系统用户组和用户

 

[root@OCP Desktop]#  grep oinstall /etc/group

[root@OCP Desktop]#  more /etc/oraInst.loc

/etc/oraInst.loc: No such file or directory

[root@OCP Desktop]# /usr/sbin/groupadd oinstall

[root@OCP Desktop]# /usr/sbin/groupadd -g 502 dba

[root@OCP Desktop]# /usr/sbin/groupadd -g 503 oper

[root@OCP Desktop]# id oracle

id: oracle: No such user

[root@OCP Desktop]# /usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle

[root@OCP Desktop]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

 

Configuring Kernel Parameters

配置内核参数

检查软硬限制

Check the soft and hard limits for the file descriptor setting

[root@OCP Desktop]# ulimit -Sn

1024

[root@OCP Desktop]# ulimit -Hn

4096

Check the soft and hard limits for the number of processes available to a user

[root@OCP Desktop]# ulimit -Su

11861

[root@OCP Desktop]# ulimit -Hu

11861

Check the soft limit for the stack setting

[root@OCP Desktop]# ulimit -Ss

8192

[root@OCP Desktop]# ulimit -Hs

Unlimited

设置oracle的软限制和硬限制

root@OCP Desktop]# vi /etc/security/limits.conf

加入下面内容

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

oracle              soft    stack   10240

设置内核参数

[root@OCP Desktop]# cat /etc/sysctl.conf|grep -v ^#|grep ^[^#]

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

net.bridge.bridge-nf-call-ip6tables = 0

net.bridge.bridge-nf-call-iptables = 0

net.bridge.bridge-nf-call-arptables = 0

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

[root@OCP Desktop]# vi /etc/sysctl.conf

加入如下内容

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

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

执行/sbin/sysctl –p使参数生效

 

 

Creating Required Directories

创建所需目录

 

[root@OCP Desktop]#  mkdir -p /u01/app/oracle

[root@OCP Desktop]# chown -R oracle:oinstall /u01/app

[root@OCP Desktop]# chmod -R 775 /u01/app/oracle

 

 

 

 

 

Configuring the oracle Users Environment

配置oracle用户环境

 

切换到oracle用户su – oracle

[root@OCP Desktop]# su - oracle

[oracle@OCP ~]$ vi /home/oracle/.bash_profile

加入下面内容

export ORACLE_SID=orcl

export ORACLE_BASE=/u01/app/oracle //ORACLE

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export PATH=$PATH:$ORACLE_HOME/bin

export ORACLE_TERM=xterm

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

export CLASSPATH=$ORACLE_HOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Mounting the Product Disc

装载安装盘

到官网下载oracle软件包http://www.oracle.com/technetwork/indexes/downloads/index.html

本例用的是zip包。

p13390677_112040_Linux-x86-64_1of7.zip

p13390677_112040_Linux-x86-64_2of7.zip

把两个包粘贴到同一个文件夹下(本例在/u01/app/oracle),用unzip命令解压。

如unzip   p13390677_112040_Linux-x86-64_1of7.zip

解压后cd  database

执行安装

 

Installing Oracle Database

安装oracle数据库

 

[oracle@OCP oracle]$ ll database

total 60

drwxr-xr-x.  4 oracle oinstall  4096 Aug 27  2013 install

-rw-r--r--.  1 oracle oinstall 30016 Aug 27  2013 readme.html

drwxr-xr-x.  2 oracle oinstall  4096 Aug 27  2013 response

drwxr-xr-x.  2 oracle oinstall  4096 Aug 27  2013 rpm

-rwxr-xr-x.  1 oracle oinstall  3267 Aug 27  2013 runInstaller

drwxr-xr-x.  2 oracle oinstall  4096 Aug 27  2013 sshsetup

drwxr-xr-x. 14 oracle oinstall  4096 Aug 27  2013 stage

-rw-r--r--.  1 oracle oinstall   500 Aug 27  2013 welcome.html

[oracle@OCP oracle]$ cd database

[oracle@OCP database]$ ls

install      response  runInstaller  stage

readme.html  rpm       sshsetup      welcome.html

[oracle@OCP database]$ xhost +

access control disabled, clients can connect from any host

[oracle@OCP database]$ ./runInstaller

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 43474 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 4999 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-07-24_04-41-31PM. Please wait ...

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

 

 linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

有两个包提示警告,我们到root用户下用rpm  -qa 查看

 

 

发现这两个包没有装,我们用yum对这两个包进行安装。

[root@OCP Desktop]# yum install -y ksh* libaio-devel

Loaded plugins: refresh-packagekit, security

server                                                   | 3.7 kB     00:00 ...

server/primary_db                                        | 3.0 MB     00:00 ...

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package ksh.x86_64 0:20120801-10.el6 will be installed

---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package             Arch          Version                  Repository     Size

================================================================================

Installing:

 ksh                 x86_64        20120801-10.el6          server        755 k

 libaio-devel        x86_64        0.3.107-10.el6           server         13 k

 

Transaction Summary

================================================================================

Install       2 Package(s)

 

Total download size: 768 k

Installed size: 1.7 M

Downloading Packages:

--------------------------------------------------------------------------------

Total                                           4.0 MB/s | 768 kB     00:00    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : libaio-devel-0.3.107-10.el6.x86_64                           1/2

  Installing : ksh-20120801-10.el6.x86_64                                   2/2

  Verifying  : ksh-20120801-10.el6.x86_64                                   1/2

  Verifying  : libaio-devel-0.3.107-10.el6.x86_64                           2/2

 

Installed:

  ksh.x86_64 0:20120801-10.el6       libaio-devel.x86_64 0:0.3.107-10.el6     

 

Complete!

再次查看.显示装好。单击Check Again再次检查

 linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

linux系统安装Oracle11g详细步骤

在root用户下执行这两个脚本。执行完后按OK继续

 

[root@OCP Desktop]# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

[root@OCP Desktop]# /u01/app/oracle/product/11.2.0/db_1/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/db_1

 

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 script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

linux系统安装Oracle11g详细步骤

到此数据库软件就安装好了