2012年10月7日星期日

CentOS 6安装Oracle 11gR2数据库

CentOS 6安装Oracle 11gR2数据库

1. 安装前准备

[1] 安装软件包

[root@localhost var]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel 
gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

安装软件包 pdksh-5.2.14-36.el5.i386.rpm (这个包yum源里没有,所以要手动安装,不装安装oracle时会有警告出现,但不影响最后的使用)

请下载这个包上传到CentOS后使用如下命令安装。(软件包见附件)

[root@localhost public_root]# rpm -ivh pdksh-5.2.14-36.el5.i386.rpm

[2] 更改kernel参数

[root@localhost var]# vi /etc/sysctl.conf# Disable netfilter on bridges.#net.bridge.bridge-nf-call-ip6tables = 0#net.bridge.bridge-nf-call-iptables = 0#net.bridge.bridge-nf-call-arptables = 0# Controls the default maxmimum size of a mesage queuekernel.msgmnb = 65536# Controls the maximum size of a message, in byteskernel.msgmax = 65536# Controls the maximum shared segment size, in byteskernel.shmmax = 4294967295# Controls the maximum number of shared memory segments, in pageskernel.shmall = 268435456# 在文件末尾添加net.ipv4.ip_local_port_range = 9000 65500fs.file-max = 6815744kernel.shmall = 10523004kernel.shmmax = 6465333657kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.core.rmem_default=262144net.core.wmem_default=262144net.core.rmem_max=4194304net.core.wmem_max=1048576fs.aio-max-nr = 1048576

执行以下命令使更改生效

[root@localhost var]# sysctl -p

[3] 创建安装oracle所需用户与用户组

[root@localhost var]# groupadd -g 200 oinstall[root@localhost var]# groupadd -g 201 dba[root@localhost var]# useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle[root@localhost var]# passwd oracle
[root@localhost var]# vi /etc/pam.d/login#%PAM-1.0auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.soauth       include      system-authaccount    required     pam_nologin.soaccount    include      system-authpassword   include      system-auth# pam_selinux.so close should be the first session rulesession    required     pam_selinux.so closesession    required     pam_loginuid.sosession    optional     pam_console.so# pam_selinux.so open should only be followed by sessions to be executed in the user contextsession    required     pam_selinux.so opensession    required     pam_namespace.sosession    required     pam_limits.sosession    optional     pam_keyinit.so force revokesession    include      system-auth-session   optional     pam_ck_connector.so
[root@localhost var]# vi /etc/security/limits.conf# 在文件末尾添加oracle   soft   nproc   2047oracle   hard   nproc   16384oracle   soft   nofile   1024oracle   hard   nofile   65536
[root@localhost var]# vi /etc/profile# 在文件末尾添加if [ $USER = "oracle" ]; then      if [ $SHELL = "/bin/ksh" ]; then           ulimit -p 16384           ulimit -n 65536      else           ulimit -u 16384 -n 65536      fifi

[4] 切换到oracle用户,并进行配置

[root@localhost ~]# su - oracle[oracle@localhost ~]$ chmod 755 /usr/oracle[oracle@localhost ~]$ mkdir /usr/oracle/app[oracle@localhost ~]$ chmod 755 /usr/oracle/app/[oracle@localhost ~]$ mkdir /usr/oracle/oradata[oracle@localhost ~]$ chmod 755 /usr/oracle/oradata/[oracle@localhost ~]$ vi ./.bash_profile# 在文件末尾添加umask 022export ORACLE_BASE=/usr/oracle/app

 

2. 安装oracle database

[1] 下载oracle安装文件(for linux x86),并上传到CentOS上

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

[2] 解压安装文件

[root@localhost public_root]# unzip linux_11gR2_database_1of2.zip[root@localhost public_root]# unzip linux_11gR2_database_2of2.zip

[3] 以oracle用户登陆,startx命令启动图形界面,打开一个终端窗口,进行到刚刚解压database的文件夹,运行以下命令

[oracle@localhost database]$ ./runInstaller

[4] oracle安装界面启动如下图所示,输入邮件地址及密码(oracle用户),以从oralce接收安全更新等信息

image

[5] 仅安装数据库软体

image

[6] 本实例中选择安装单实例数据库

image

[7] 选择语言

image

[8] 选择要安装的版本,这里选择 “Enterprise Edition”

image

[9] 指定Oracle Base 与 Software Location, 我们在oracle用户的profile文件里已设置此环境变量,此处保持默认

image

[10] 指定Inventory Directory, 本例保持默认

image

[11] 指定oralce特权用户组,本例保持默认

image

[12] 接下来,oralce安装程序会对安装环境进行检查,本例未检查到任何问题,显示安装信息如下。直接Finish, 开始安装。

image

[13] 静待oracle安装

image

[14] 当出现以下窗口时,另开一个终端,以root用户登陆,并执行下面的命令。执行完毕后,点击OK

image

[root@localhost ~]# /usr/oracle/oraInventory/orainstRoot.shChanging permissions of /usr/oracle/oraInventory.Adding read,write permissions for group.Removing read,write,execute permissions for world.Changing groupname of /usr/oracle/oraInventory to oinstall.The execution of the script is complete.[root@localhost ~]# /usr/oracle/app/product/11.2.0/dbhome_1/root.shRunning Oracle 11g root.sh script...The following environment variables are set as:    ORACLE_OWNER= oracle    ORACLE_HOME=  /usr/oracle/app/product/11.2.0/dbhome_1

[15] 至此oracle 11g R2数据库安装完毕。

image

 

[16] 其它注意事项

  • 关闭SeLinux
  • 配置好FTP以上传安装程序(也可以使用其它方式)

TAG: