天天看点

在linux下安装oracle11g

<b>Oracle11g for linux </b><b>安装</b>

<b>一 系统篇</b>

<b>1</b><b>系统定制安装选择包</b>

X Window System

GNOME Desktop Environment

Editors

Graphical Internet

Text-based Internet

Server Configuration Tools

Development Tools

Administration Tools

System Tools

<b>2 oracle</b><b>安装所必须软件</b>

binutils-2.17.50.0.6-2.el5

compat-libstdc++-33-3.2.3-61

elfutils-libelf-0.125-3.el5

elfutils-libelf-devel-0.125

glibc-2.5-24

glibc-common-2.5-12

glibc-devel-2.5-12

gcc-4.1.2

gcc-c++-4.1.2

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.1-52

libstdc++-4.1.2

libstdc++-devel-4.1.2

make-3.81-1.1

sysstat-7.0.2

unixODBC-2.2.11

unixODBC-devel-2.2.11

<b>查找系统是否缺少改软件</b>

<a>rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common \</a>

glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat \

unixODBC unixODBC-devel libgomp

注意以上软件包都可在光盘中找到挂在光盘的命令

mount /dev/cdrom  /mnt

cd /mnt/Server/

如果安装完后依然不行则配置yum,更新rpm包具体配置如下

1  到目录/etc/yum.repos.d下创建文件touch CentOS-Base.repo

2  vi  CentOS-Base.repo增加如下内容

[base]         

name=Red Hat Linux $releasever - $basearch - Base     

baseurl= http://centos.ustc.edu.cn/centos/5/os/i386/

gpgcheck=1

gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

3 启动yum服务

/etc/rc.d/init.d/yum-updatesd start

除此之外需要主机连网并配置dns

4 如果安装提示确实libXp.so.6 则安装rpm -ivh libXp-1.0.0-8.1.el5.i386.rpm  便可以再lib目录下找到find / -name libXp.so.6

/usr/lib/libXp.so.6

<b>3 </b><b>系统参数修改</b>

<b>a </b><b>修改系统核心参数</b>

kernel.shmall = 2097152

kernel.shmmax = 536870912 (当前内存*1024*1024*1024/2)

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65000

net.core.rmem_default=8388608

net.core.rmem_max=8388608

net.core.wmem_default=262144

net.core.wmem_max=1048576

fs.aio-max-nr=1048576

<b> </b>

<b>b </b><b>修改limits资源限制</b>

oracle soft nofile 65536

oracle hard nofile 65536

oracle soft nproc 16384

oracle hard nproc 16384

<b>c </b><b>更改/etc/pam.d/login文件</b>

session required /lib/security/pam_limits.so

session required pam_limits.so

注意如果是64位的linux 此处应该是/lib64/security/pam_limits.so 如果弄错。Linux所有用户都不能本地登录终端。

<b>d </b><b>更改/etc/profile文件</b>

 if [ $USER = "oracle" ]; then

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

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

e 查看swap交换分区是否满足16G

[oracle@linux ~]$ free -m

             total       used       free     shared    buffers     cached

Mem:          1213       1151         62          0          4        908

-/+ buffers/cache:        238        975

Swap:        16288          0      16288

<b>4 </b><b>创建用户和组</b>

a<b> </b><b>创建组</b>

groupadd dba

groupadd oper

groupadd oinstall

<b>b </b><b>创建用户</b>

useradd -m -g oinstall -G dba -d /oracle oracle

<b>c </b><b>更改用户密码</b>

passwd  oracle

5<b>  </b><b>设置oracle目录的属主和权限</b>

chown - R oracle.oinstall /oracle

chmod 755 /oracle/

<b>6  </b><b>上传oracle安装软件并加压缩并更改database权限和属组</b>

<b>a </b><b>开始上传</b>

# rz

rz waiting to receive.

正在开始 zmodem 传输。 按 Ctrl+C 取消。

正在传输 linux_11gR1_database_1013.zip...

<b>上传完后更改权限</b>

chown -R oracle:oinstall /install/database

chmod -R 755 /install/database/

ls -ld /install/database/

<b>二 安装篇</b>

1仅安装数据库软件

<a target="_blank" href="http://blog.51cto.com/attachment/201209/142813150.jpg"></a>

2在oracle用户主目录下更改.bash_profile文件添加环境变量

<a target="_blank" href="http://blog.51cto.com/attachment/201209/142851775.jpg"></a>

3运行dbca

4 运行netca

<b>三 把oracle启动脚本添加成服务</b>

<b></b>

<b>1 </b><b>在/etc/rc.d/init.d/ 目录下面建db文件并更改其权限为755文件内容如下</b>

# description: Oracle auto start-stop script.

# chkconfig: - 20 80

#

# Set ORA_HOME to be equivalent to the $ORACLE_HOME

# from which you wish to execute dbstart and dbshut;

# Set ORA_OWNER to the user id of the owner of the

# Oracle database in ORACLE_HOME.

case "$1" in

'start')

# Start the Oracle databases:

# The following command assumes that the oracle login

# will not prompt the user for any values

su -  oracle  &lt;&lt;!

      export ORACLE_SID=TEST

      lsnrctl start TEST

      sqlplus  / as sysdba

      startup

      exit

!

;;

'stop')

# Stop the Oracle databases:

      sqlplus / as sysdba

      shutdown immediate

'restart')

$0 stop

$0 start

esac

2 把该文件添加成linux系统服务

chkconfig   ---add  db

3 更改35级别该服务自动启动

chkconfig   --level 35  db  on 

本文转自 zhangxuwl 51CTO博客,原文链接:http://blog.51cto.com/jiujian/984480,如需转载请自行联系原作者