redhat linux 5.4_x64安装oracle11g-1_64笔录

来源:互联网 发布:怎样开情趣用品淘宝店 编辑:程序博客网 时间:2024/05/22 01:28

    最近在单位一台DELL T710_x64机器上布置了一个oracle11g-1_64,从网上查很多的资料,进行综合才得以安装成功,以下是安装步骤总结,为给哪些和我一样迷茫过的初学者提供帮助,我的机器配置如下:

 

服务器:DELL T710-64位

CPU:E5520 64位 ×2

内存:8G

硬盘:STA 1T×3块 RAID5 2T

操作系统:redhat linux 5.4

硬盘分区:

/         :60G

/boot/  :200m

/usr/    :30G

/swap/ :20G

/tmp/   :10G

/home/ :40G

/ora/    :120G ;oracle11g-1系统和数据文件都在这个分区

/data/  :1.5T

.

.

 

 

以下是安装步骤:

 

1.完全安装Redhat Linux server 5.4_X64操作系统

 

(1) Oracle11g-1下载地址:下载oracle需注册一个账户

http://www.oracle.com/technology/software/products/database/oracle11g/111060_linuxsoft.html

 

 

2.修改主机配置文件(root身份)
#vi /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

#ip地址改为服务器的地址

127.0.0.1               localhost

192.168.xx.xx          localhost

 (上面的主机名localhost保持一致)


 

3.修改网卡绑定的主机名(HOSTNAME=localhost与hosts文件中的保持一致)

#vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost
GATEWAY=192.168.11.254

4.修改内核参数root身份

#vi /etc/sysctl.conf

添加下列代码:(我的服务器内存是8G,如果小于这个数你需要修改下面的参数)

kernel.sem=250 32000 100 128  #每个信号对象集的最大信号对象数;系统范围内最大信号

net.ipv4.ip_local_port_range=1024 65000 #应用程序可使用的IPv4端口范围

net.core.rmem_default=4194304 #套接字接收缓冲区大小的缺省值

net.core.rmem_max=4194304 #套接字接收缓冲区大小的最大值

net.core.wmem_default=262144 #套接字发送缓冲区大小的缺省值

net.core.wmem_max=262144 #套接字发送缓冲区大小的最大值

 

#sysctl –p使其生效

执行后显示如下:

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

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 4294967295

kernel.shmall = 268435456

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 262144

 

5.创建oracle用户和组

# groupadd oinstall

# groupadd dba

# groupadd oper

# useradd -g oinstall -G dba,oper oracle

# passwd oracle(设置oracle账户口令)

 

6.验证nobody用户:

# id nobody

显示如下:

uid=99(nobody) gid=99(nobody) groups=99(nobody)

 

7.赋予.ora分区写入权限给oracle账户

#chown -R oracle:oinstall /ora

 

 

8.oracle用户设置Shell限制

#vi /etc/security/limits.conf

文件尾部添加下列代码:

*     soft nproc 2047

*     hard nproc 16384

*     soft nofile 1024

*     hard nofile 65536

 

9.修改登录参数(此步骤做完后,服务器只能远程登录了,测试中未使用此步骤)

# vi /etc/pam.d/login

添加下列代码:

#session required /lib/security/pam_limits.so

 

10.修改/etc/profile文件

# vi /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

 

 

11.切换到oracle账户

#su - oracle

 

12.oracle用户设置环境变量oracle身份

$ vi .bash_profile

ORACLE_SID=orcl

ORACLE_BASE=/ora/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1

#export LC_CTYPE=zh_CN.UTF-8 (安装时界面为中文,可选)

export ORACLE_SID ORACLE_BASE ORACLE_HOME

PATH=$PATH:/$ORACLE_HOME/bin:$HOME/bin

使其生效:

$source .bash_profile

 

15.上传oracle安装程序到/home/oracle目录以oracle用户上传并解压

$unzip linux_11gR1_database.zip

$cd database

新开一个终端窗口,以root身份执行命令

#xhost +

然后回到oracle窗口

$./runInstaller开始安装

 .... 

  

16.启动oracle监听配置界面(oracle)

$netca

 

 17.创建数据库(oracle

$dbca

  

 

18.启动和停止监听:/ora/oracle/product/11.1.0/db_1/bin/lsnrctl start LISTENER

   $lsnrctl start

$lsnrctl stop

19.启动数据库

$sqlplus /nolog

SQL>conn /as sysdba

SQL>startup(启动)

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

SQL*Plus: Release 11.1.0.6.0 - Production on Mon Oct 22 13:57:07 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

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

 

SQL>shutdown immediate (关闭)

查看oracle11g-1是否正确启动起来(root权限)

#ps -ef | grep oracle

 

启动和停止Oracle Enterprise Manager:

  $emctl start dbconsole

   $emctl stop dbconsole

打开IE浏览器登录管理

https://192.168.xx.xx:1158/em

之后登录,就可以管理oracle11g-1了,包括可以建立数据库新账户、表空间等

 

如果在执行$ sqlplus "/ as sysdba"时出错:

sqlplus: error while loading shared libraries: /data/oracle/product/11.1/lib/libnnz11.so: cannot restore segment prot after reloc: Permission denied

此时只需SELinux设置由Enforcing改为Permissve(宽容)就可以了

 

以root身份执行$su – root)

 

# setenforce 0

# getenforce

Permissive(宽容)

 

回到oracle用户

# su – oracle

再次执行

$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on Mon Oct 22 13:57:07 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

一切OK

 

设置防火墙(如果需要对这台数据库服务器远程访问,还需设置防火墙打开与oracle的有关端口)

1158 em端口

1521 lsnr监听端口

 

root身份执行命令

#vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1158 -j ACCEPT

 

配置oracle11g-1随linxu启动

 (oracle身份)

$vi /etc/oratab   设置oracle11g-1自启参数:

orcl:/ora/oracle/product/10.2.0/db_1:Y

(以root身份)

#vi /etc/rc.local添加代码:

setenforce 0

su - oracle -c dbstart

su – oracle –c “lsnrctl start”

 

(全文完)2009-10-11