Oracle11gR2单实例的安装与部署

1   安装目标与规划

交易系统1台HP DL580 G9服务器将安装Oracle11gR2 。

1.1  安装介质版本

主机名

his1

IP地址

192.168.40.102(非生产环境ip)

Oracle Grid软件

 

Oracle DB软件版本

Oracle Enterprise11g

补丁集版本

Oracle 11.2.0.4

PSU(推荐补丁版本)

Oracle 11.2.0.4.160719

1.2 安装目录规划

项目

类别

目录

空间大小

Oracle软件目录

Oracle DB

/oracle/11.2.0/db/dbhome_1

20GB

Oracle 在线日志文件及控制文件、数据文件、归档日志文件

控制文件,在线日志,数据文件

/data

500GB

文件系统

归档备份

/archive

500GB

2   安装环境检查

2.1  硬件配置检查

2.1.1物理内存,最小需求1024M

[root@his1 ~]# grep MemTotal /proc/meminfo

MemTotal:      2075524 kB

2.1.2交换区SWAP大小

[root@his1 ~]# grep SwapTotal /proc/meminfo

SwapTotal:     8385920 kB

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

 

2.1.3可用内存和交换空间

[root@ his1 ~]# free -m

         total    used       free     shared    buffers     cached

Mem:    2026    1291       735          0      73       1005

-/+ buffers/cache:   212       1814

Swap:    8189     0         8189

2.1.4临时目录/tmp 最少400MB

[root@his1 ~]# df -h

Filesystem        Size    Used   Avail    Use%   Mounted on

/dev/sda6         58G    9.4G   46G    18%     /

/dev/sda5         500G   0.4G   500G   0.018%  /archive

/dev/sda4         500G   0.4G   500G   0.018%  /data

/dev/sda3         20.1G  73M    20G    0.2%    /oracle

/dev/sda2         7.8G  358M    7.0G    5%     /tmp

/dev/sda1         388M   34M   334M  10%     /boot

tmpfs            1014M  528M   486M  53%     /dev/shm

2.1.5安装软件的剩余磁盘空间4.5G以上,安装目录在/u01

挂接点

大小

/

60GB

swap

8GB

  /oracle

500GB

   /archive

500GB

2.1.6配置主机名解析

[root@his1 ~]# cat  /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

192.168.40.102  his1

这个不设置的话安装的时候会出错。

2.1.7CPU信息

[root@his1 ~]# grep "model name" /proc/cpuinfo

model name      : Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz

2.2  软件需求检查

2.2.1操作系统需求

[root@his1 ~]# cat /proc/version

Linux version 2.6.18-164.el5PAE (mockbuild@ca-build10.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Sep 3 02:28:20 EDT 2009

[root@his1 ~]# cat /etc/issue

Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)

Kernel \r on an \m

2.2.2操作系统核心版本需求

[root@his1 ~]# uname -a

Linux his1 2.6.18-164.el5PAE #1 SMP Thu Sep 3 02:28:20 EDT 2009 i686 i686 i386 GNU/Linux

2.2.3系统软件包需求

Asianux Server 3, Oracle Linux 5, and Red Hat Enterprise Linux 5 The following packages (or later versions) must be installed:

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

elfutils-libelf-devel-static-0.125

gcc-4.1.2

gcc-c++-4.1.2

glibc-2.5-24

glibc-common-2.5

glibc-devel-2.5

glibc-headers-2.5

kernel-headers-2.6.18

ksh-20060214

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.2

libgomp-4.1.2

libstdc++-4.1.2

libstdc++-devel-4.1.2

make-3.81

sysstat-7.0.2

查看命令

yum  list binutils compat-libstdc++  elfutils-libelf  elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat

[root@his1 ~]# yum  list binutils compat-libstdc++  elfutils-libelf  elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat

Loaded plugins: security

file:///media/cdrom1/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/media/cdrom1/Server/repodata/repomd.xml'

Trying other mirror.

Installed Packages

binutils.i386             2.17.50.0.6-12.el5    installed

elfutils-libelf.i386         0.137-3.el5          installed

elfutils-libelf-devel.i386    0.137-3.el5          installed

elfutils-libelf-devel-static.i386 0.137-3.el5         installed

gcc.i386                 4.1.2-46.el5         installed

gcc-c++.i386             4.1.2-46.el5          installed

glibc.i686                2.5-42              installed

glibc-common.i386        2.5-42              installed

glibc-devel.i386           2.5-42              installed

glibc-headers.i386         2.5-42              installed

kernel-headers.i386        2.6.18-164.el5       installed

ksh.i386                 20080202-14.el5     installed

libaio.i386                0.3.106-3.2         installed

libaio-devel.i386           0.3.106-3.2         installed

libgcc.i386                4.1.2-46.el5        installed

libgomp.i386              4.4.0-6.el5         installed

libstdc++.i386             4.1.2-46.el5        installed

make.i386                1:3.81-3.el5        installed

sysstat.i386               7.0.2-3.el5         installed

Available Packages

glibc.i386                  2.5-42             nam

补安装软件包:

配置yum

# cd /etc/yum.repos.d     操作系统密令

#vi server.repo          操作系统密令

[base]

name=iso

baseurl=file:///mnt

gpgcheck=1

enabled=1

gpgkey=file:///mnt/RPM-GPG-KEY-oracle

安装RPM包

yum  list binutils compat-libstdc++  elfutils-libelf  elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat

2.2.4JAVA 版本需求:1.4.2

运行oracle安装需要运行java OUI界面,要求操作系统中安装有java环境1.4.2以上

[root@his1~]#  java -version

java version "1.6.0"

OpenJDK  Runtime Environment (build 1.6.0-b09)

OpenJDK Client VM (build 1.6.0-b09, mixed mode)

3   安装前准备工作

3.1  创建安装目录

mkdir -p /oracle/11.2.0/db/dbhome

chown –R oracle.oinstall /oracle

3.2 建立用户

安装oracle 11g s数据库软件需要手工创建oracle用户,用于管理数据库

3.2.1建立oracle用户

#groupadd -g 1000 oinstall

#groupadd -g 1200 dba

#groupadd -g 1201 oper

#useradd -m -u 1100 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

3.2.2修改密码(初步设定密码为123456)

# passwd oracle

3.2.3检查nobody用户

# id nobody

uid=60001(nobody) gid=60001(nobody)

如没有该用户则需要建立nobody用户

# /usr/sbin/useradd nobody

  • 安装目录授权

chown -R oracle:oinstall /oracle

chown -R oracle:oinstall /data

chown -R oracle:oinstall /archive

3.2  参数配置和修改

配置系统内核参数,在两个节点上都进行修改

参数

推荐值

查看命令

semmsl

semmns

semopm

semmni

250

32000

100

128

/sbin/sysctl -a | grep sem

shmall

2097152

/sbin/sysctl -a | grep shm

 

shmmax

536870912

shmmni

4096

file-max

6815744

/sbin/sysctl -a | grep file-max

ip_local_port_range

Minimum:9000 Maximum: 65500

/sbin/sysctl -a | grep ip_local_port_range

rmem_default

262144

/sbin/sysctl -a | grep rmem_default

rmem_max

4194304

/sbin/sysctl -a | grep rmem_max

wmem_default

262144

/sbin/sysctl -a | grep wmem_default

wmem_max

1048576

/sbin/sysctl -a | grep wmem_max

aio-max-nr

Maximum: 1048576

/sbin/sysctl -a | grep aio-max-nr

vm.min_free_kbytes

524288

/sbin/sysctl -a | grep vm.min_free_kbytes

vm.swappiness

100

/sbin/sysctl -a | grep vm.swappiness

将以下修改添加到/etc/sysctl.conf中

kernel.shmmax = 34359738368

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 6815744

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

fs.aio-max-nr = 4194304

vm.min_free_kbytes = 524288

vm.swappiness=100

net.ipv4.conf.eth4.rp_filter = 0

net.ipv4.conf.eth8.rp_filter = 0

执行以下使得参数生效

# sysctl -p

禁用ASLR功能

禁用ASLR功能,在/etc/sysctl.conf文件添加以下内容

kernel.randomize_va_space=0

重启生效

注:# /sbin/sysctl -a | grep randomize

kernel.randomize_va_space = 1

If the parameter is set to any value other than 0 then ASLR is in use.

3.3.1修改Oracle用户限制

在机器上修改下列文件,增加对应的内容

cat >> /etc/security/limits.conf <<EOF

oracle soft nproc 2048

oracle hard nproc 32768

oracle soft nofile 2048

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

EOF

在oracle用户下执行以下命令

[root@his1 ~]# su - oracle

[oracle@his1 ~]$ ulimit -Sn

2048

[oracle@his1 ~]$ ulimit -Hn

65536

[oracle@his1 ~]$ ulimit -Su

2048

[oracle@his1 ~]$ ulimit -Hu

32768

[oracle@his1 ~]$ ulimit -Ss

10240

[oracle@his1 ~]$ ulimit -Hs

32768

编辑以下两个文件,添加相应的内容

echo 'session include system-auth' >> /etc/pam.d/login

echo 'session required pam_limits.so' >> /etc/pam.d/system-auth

cat >> /etc/profile <<EOF

if [ \$USER = "oracle" ]; then

    if [ \$SHELL = "/bin/ksh" ]; then

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

    umask 022

fi

EOF

3.3.2禁用HugePages

vi /boot/efi/EFI/redhat/grub.conf

添加transparent_hugepage=never

title Oracle Linux Server Unbreakable Enterprise Kernel (3.8.13-44.1.1.el6uek.x86_64)

        root (hd0,1)

        kernel /vmlinuz-3.8.13-44.1.1.el6uek.x86_32 ro root=/dev/mapper/vg_jydb1-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_jydb1/lv_root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=256M  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rd_LVM_LV=vg_jydb1/lv_swap rhgb quiet transparent_hugepage=never

        initrd /initramfs-3.8.13-44.1.1.el6uek.x86_32.img

重启用以下命令确认:

# cat /sys/kernel/mm/transparent_hugepage/enabled

always madvise [never]

# grep AnonHugePages /proc/meminfo

结果"AnonHugepages: 0 kB"

参考:

ALERT: Disable Transparent HugePages on SLES11, RHEL5, OEL5 and UEK2 Kernels (文档 ID 1557478.1)

3.3.3禁用AVAHI daemon

# service avahi-daemon stop

# /sbin/chkconfig avahi-daemon off

vi /etc/sysconfig/network

添加 NOZEROCONF=yes

参考:

CSSD Fails to Join the Cluster After Private Network Recovered if avahi Daemon is up and Running (文档 ID 1501093.1)

3.3.4关闭防火墙

# service iptables stop

# service ip6tables stop

# chkconfig iptables off

# chkconfig ip6tables off

3.3.5关闭SElinux

#vi /etc/selinux/config

修改SELINUX=disabled

3.3  配置环境变量

配置oracle用户环境变量

说明:oracle用户需要配置相关的环境变量

$ echo $SHELL

/usr/bin/bash

Bourne shell (sh), Bash shell (bash), or Korn shell (ksh):

$ vi .bash_profile

export PS1='[\h:\u:$PWD]$'

export ORACLE_BASE=/oracle/11.2.0/db

export ORACLE_HOME=$ORACLE_BASE/dbhome

export ORACLE_SID=qlhsdb1 # ORACLE_SID=qlhsdb2

export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORACLE_TERM=vt100

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"

export ORA_NLS11=$ORACLE_HOME/nls/data

export LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib

export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib

export CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export TEMP=/tmp

export TMP=/tmp

export TMPDIR=/tmp

stty erase ^H

umask 022

3.4  配置存储

说明:文件系统的话建议使用逻辑卷,这里在安装系统的时候已经把卷建好了

 

3.5  配置网络

说明:标记为红色的字体要注意

[root@his1 ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:96:91:67 

          inet addr:192.168.40.102  Bcast:192.168.40.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe96:9167/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5164 errors:0 dropped:0 overruns:0 frame:0

          TX packets:5513 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:412668 (402.9 KiB)  TX bytes:1638598 (1.5 MiB)

          Interrupt:59 Base address:0x2024

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:983 errors:0 dropped:0 overruns:0 frame:0

          TX packets:983 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:49739 (48.5 KiB)  TX bytes:49739 (48.5 KiB)

[root@his1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

HWADDR=00:0c:29:96:91:67

NETMASK=255.255.255.0

IPADDR=192.168.40.34

TYPE=Ethernet

4   软件安装过程

4.1  安装Oracle DB 11.2.0.4软件

步骤

详细操作

登录his1

#xhost +

#su - oracle

运行RDBMS的runInstaller

$ cd /oracle/install/db/database

./runInstaller

界面1:Configure Security Updates

取消选择“I wish to receive security updates via My Oracle Support” 。点击“next”,忽略提示警告。

界面2:Download Software Updates

选择“Skip software updates”. 点击“next”

界面3:Installation Option

选择“Install database software only”. 点击“next”

界面4:Grid Installation Options

选择“Single instance database installtion” 然后点击“next”

界面5:Select Product Languages

从左侧选择“Simplified Chinese”到右侧. 点击“next”

界面6:Select Database Edition

选择“Enterprise Edition”点击“Select Option”确认以下选件:

Oracle Partitioning

Oracle OLAP

Oracle Data Mining RDBMS Files

Oracle Real Application Testing

点击“Next”

界面7:Specify Installation Location

确定Oracle的安装路径:

Oracle Base: /oracle/11.2.0/db

Software Location:  /oracle/11.2.0/db/dbhome      

点击“Next”

界面8:Privileged Operating System Groups

操作系统用户组

Database Administration (OSDBA) Group : dba

Database Operator (OSOPER) Group: oper

点击“next”。

界面9:Perform Prerequisite Checks

等待约安装检查的完成

界面10:Summary

点击“Install”

界面11:Install Product

等待完成

Install (Execute Configuration scripts)

安装接近完成时,需要手使用root用户在每一个节点运行以下脚本:

在两个节点上上执行

#/oracle/11.2.0/db/dbhome/root.sh

 

运行root.sh后最后显示:

Performing root user operation for Oracle 11g

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/11.2.0/db/dbhome

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /var/opt/oracle/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.

界面12:Finish

点击“Close”退出

4.2  建立数据库

步骤

详细操作

启动dbca

#su - oracle

$dbca

界面1:Welcome

选择Create a Database,点击next

界面2: Step 2 of 12: Database Templates

选择Custom Database,点击next

界面3:Step 3 of 12: Databases Identifier

Global Database Name:orcl

SID Prefix: orcl

点击next

界面4: Step 4 of 12: Management Options

取消选择"Configure Enterprise Manager"

取消选择"Automatic Maintenance Tasks"

点击Next

界面5:Step 5 of 12: Database Credentials

选择Use the same password for all accounts , 输入口令“oracle”并确认输入,点击next

界面6: Step 6 of 12: Storage Options

选择存储类型:File System

选择"Use Database File Location from  Template"

点击Next

界面7: Step 7 of 12: Recovery Configuration

选择“Specify Fast Recovery Area”

点击Next

界面8: Step 8 of 12: Database Content

选择Oracle Text、Oracle OLAP、Oracle Spatial、Enterprise Manager Repository和Oracle Warehourse Builder

点击Next

界面9: Step 9 of 12: Initialization Parameters

在Memory处选择Typical指定64%即40G作为memory_target大小

Block Size=8192, Processes=5000

在Character Sets TAB处选择

选择“Use Unicode (AL32UTF8)”

在Connection Mode TAB处选择:Dedicated Server Mode

点击Next

界面10:Step 10 of 12: Database Storage

SYSAUX表空间:10240M

SYSTEM表空间:5120M

TEMP表空间  :10240M

UNDOTBS1表空间:10240M

UNDOTBS2表空间:10240M

USERS表空间:2048M

Redo Thread 1:

Group1  500M

Group2  500M

Redo Thread 2:

Group3  500M

Group4  500M

 

配置完毕后点击Next

界面11:Step 11 of 12

点击Finish。开始创建数据库。

界面12:Finish

点击“Exit”

转载于:https://www.cnblogs.com/7798456shunqian/p/7016616.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值