CentOS6.6安装Oracle10g步骤

Oracle10g的安装比较繁琐,要配置的东西很多,参考了网上不少文章。
系统环境为:
CentOS6.6 x86_64 (桌面环境)
1G内存
2G swap

安装软件:
10201_database_linux_x86_64.cpio (Oracle10g 10.2.0.1.0 x86_64)
网盘下载地址:http://pan.baidu.com/s/1ntr8N8H

一、系统环境配置
1、关闭防火墙、禁用SELinux

# setup




# vim /etc/selinux/config

修改:

SELINUX=enforcing

为:

SELINUX=disabled

然后重启系统。

2、安装依赖包

# yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat

补充:

# yum -y install libXt.i686 libXtst.i686 libXp libXp.i686

缺少补充软件包,安装oralce时会有如下错:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2015-02-02_06-04-46PM/jre/1.4.2/lib/i386/libawt.so: libXt.so.6: cannot open shared object file: No such file or directory

3、 将/dev/shm改大

vim /etc/fstab

修改:

tmpfs    /dev/shm    tmpfs    defaults      0 0


为:

tmpfs    /dev/shm    tmpfs    defaults,size=2G      0 0


然后重启系统。

4、创建Oracle用户与组
这里以单主机模式安装。
(1) 建立群组oinstall

# groupadd oinstall

(2) 建立群组dba

# groupadd dba

(3) 新增使用者oracle并将其加入oinstall和dba群组

# useradd -m -g oinstall -G dba oracle

(4) 测试oracle账号是否建立完成

# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

(5) 建立oracle的新密码

# passwd oracle

5、将oracle使用者加入到sudo群组中

# vim /etc/sudoers

找到root ALL=(ALL) ALL 这行,并且在底下再加入

oracle        ALL=(ALL)        ALL


输入wq!(由于这是一份只读文档所以需要再加上!)并且按下Enter

6、配置系统内核参数

# vi /etc/sysctl.conf

并输入以下内容:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152  //表示系统一次可以使用的共享内存总量(以页为单位)。缺省值就是2097152,通常不需要修改
kernel.shmmax = 2147483648  //定义了共享内存段的最大尺寸(以字节为单位)。缺省为32M,对于oracle来说,该缺省值太低了,通常将其设置为2G
kernel.shmmni = 4096  //用于设置系统范围内共享内存段的最大数量。该参数的默认值是 4096 。通常不需要更改
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  //发送窗口的最大大小
vm.hugetlb_shm_group = 501  //将dba组添加到系统内核中,给予创建共享内存的权限


会有一些与目前的参数重复的,就修改成文件上提供的。

使设置立即生效:

# sysctl -p

7、编辑/etc/security/limits.conf

# vim /etc/security/limits.conf

加入:

oracle  soft        nproc   2047
oracle  hard        nproc   16384
oracle  soft        nofile  1024
oracle  hard        nofile  65536


8、编辑/etc/pam.d/login

# vim /etc/pam.d/login

加入:

session required /lib/security/pam_limits.so
session required pam_limits.so

9、修改Linux发行版本信息
由于Oracle 10g发行的时候,CentOS 6没有发行,所以Oracle 10g并没有对CentOS 6确认支持,需要修改文件让Oracle 10g支持CentOS 6。
我们需要手工修改Linux的发行注记,让Oracle 10g支持CentOS 6。
编辑/etc/redhat-release文件

# vim /etc/redhat-release

将其中的内容CentOS release 6.3 (Final)修改为redhat 4

redhat 4
#CentOS release 6.6 (Final)

10、创建数据库安装目录、并修改用户变量
这里数据库安装在:/u01/oracle/product/10.2.0/db_1

# mkdir -p /u01/oracle/product/10.2.0/db_1
# chown -R oracle:dba /u01/oracle

11、配置Linux主机
检查/etc/hosts文件中是否有localhost的记录(指向127.0.0.1即可),若没有的话,在后面配置Oracle监听的时候会出现一些问题,导致无法启动监听,在此手工添加此记录即可。

12、配置oracle用户环境变量

# su oracle
$ cd /home/oracle
$ vim .bash_profile

添加:

export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/oracle/product/10.2.0/db_1
export CRS_HOME=$ORACLE_BASE/crs
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin:$CRS_HOME/bin
export LC_CTYPE=en_US.UTF-8
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"

至此第一阶段配置完成。下面开始安装步骤。

二、oracle软件安装
从10201_database_linux_x86_64.cpio软件包,解压出database文件夹到/home/oracle下。

使用oracle用户登录桌面,开一个终端窗口:

cd database
./runInstaller


将UNIX DBA Group选择为dba。设置sys、system用户密码。点击Next。


将群组选择为dba。点击Next。


鼠标勾选Checking Network Configuration requirements。点击Next。


点击Install。



出现了一个错误,网上说是个bug,点击继续。



点击OK。


新开个终端:

su - root

执行这两个脚本:

[root@localhost ~]# /u01/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/oracle/oraInventory to 770.
Changing groupname of /u01/oracle/oraInventory to dba.
The execution of the script is complete

[root@localhost ~]# /u01/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/oracle/product/10.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.sh script.
Now product-specific root actions will be performed.

The following J2EE Applications have been deployed and are accessible at the URLs listed below.



安装完成。

以下是一些组件的访问地址:

iSQL*Plus URL:
http://localhost:5560/isqlplus

iSQL*Plus DBA URL:
http://localhost:5560/isqlplus/dba


Enterprise Manager 10g Database Control URL:
http://localhost:1158/em

启动监听和em和isqlplus:

lsnrctl start
emctl start dbconsole
isqlplusctl start

参考资料:
本篇文章80%参考了 http://www.cnblogs.com/mchina/archive/2012/11/06/2737472.html
http://zjwbk.blog.51cto.com/8740969/1604572