centOS x64系统上安装 oracle 11g R2 x64

来源:互联网 发布:fetch.js官网 编辑:程序博客网 时间:2024/05/22 07:40

1、首先到官网上下载oracle 11g x64位软件包

下载地址:

     http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip

     http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip

2、安装包检测及安装

[root@struggle ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh

 其中要安装几个32位的包:

    binutils

  compat-libstdc++

  compat-libstdc++(32 bit)

  elfutils-libelf

  elfutils-libelf-devel

  gcc

  gcc-c++

  glibc

  glibc(32 bit)

  glibc-common

  glibc-devel

  glibc-devel(32 bit)

  libaio

  libaio(32 bit)

  libaio-devel

  libgcc

  libgcc (32 bit)

  libstdc++

  libstdc++ (32 bit)

  libstdc++-devel

  make

  sysstat 

 

 3、查看内在及swap,对于服务器来说,肯定是没有问题的(如果安装系统时分了swap分区则可以免去这一步)

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

 

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

 

(1)创建/home/swap分区文件。文件的大小是5120000个block,1个block为1K。

dd if=/dev/zero of=/home/swap bs=1024 count=5120000 

  (2)把这个分区变成swap分区。

mkswap /home/swap 

  (3)把它加到fstab里面

echo "/home/swap swap swap defaults 0 0" >> /etc/fstab

 

 4、配置内核

[root@struggle ~]#  vim  /etc/sysctl.conf

# Kernel paramaters required by Oracle 11gR1 fs.file-max = 6815744 fs.aio-max-nr = 1048576 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 

保存并使之生效: [root@struggle ~]# /sbin/sysctl -p

如果有如下提示错误,忽略!

error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key

error: "net.bridge.bridge-nf-call-iptables" is an unknown key

error: "net.bridge.bridge-nf-call-arptables" is an unknown key

注意: kernel.shmmax's 的值是物理内存的一半。

 

5、对oracle 帐号进行资源限制

[root@struggle ~]# vi /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

 

6、登录认证配置pam模块

[root@struggle ~]# vim /etc/pam.d/login

session required pam_limits.so
session required /lib/security/pam_limits.so (如果是32位系统则要加上这一句)

 

7、为oracle用户在bash和ksh中设定资源限制编辑文件

[root@struggle ~]# vim /etc/profile

if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then  ulimit -p 16384  ulimit -n 65536 else  ulimit -u 16384 -n 65536 fifi

8、 创建操作系统用户,作为软件安装和支持组的拥有者

[root@struggle ~]# groupadd oinstall [root@struggle ~]# groupadd dba [root@struggle ~]# useradd -g oinstall -G dba oracle [root@struggle ~]# passwd oracle 

 

9、创建软件安装目录

[root@struggle ~]# mkdir -p /usr/u01/app/[root@struggle ~]# chown -R oracle:oinstall /usr/u01/[root@struggle ~]# chmod -R 755 /usr/u01/

 

10、设置环境变量

[root@struggle ~]# vi /home/oracle/.bash_profile

# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHTMP=/tmp; export TMPTMPDIR=$TMP; export TMPDIRORACLE_BASE=/usr/u01/app; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOMEORACLE_SID=orcl; export ORACLE_SIDORACLE_TERM=xterm; export ORACLE_TERMPATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;export CLASSPATHumask 022

 

11、将下载的oracle 11g 安装包解压到/home/oracle目录下

[root@struggle ~]# unzip linux.x64_11gR2_database_1of2.zip -d /home/oracle[root@struggle ~]# unzip linux.x64_11gR2_database_2of2.zip -d /home/oracle

 

12、进入/home/oracle/database目录下检查文件是否都在

[root@struggle database]# cd /home/oracle/database

[root@struggle database]# ls -al

总用量 44drwxr-xr-x.  8 root   root     4096  8月 21 2009 .drwx------.  5 oracle oinstall 4096 12月  5 14:19 ..drwxr-xr-x. 12 root   root     4096  8月 17 2009 docdrwxr-xr-x.  4 root   root     4096  8月 15 2009 installdrwxrwxr-x.  2 root   root     4096  8月 15 2009 responsedrwxr-xr-x.  2 root   root     4096  8月 15 2009 rpm-rwxr-xr-x.  1 root   root     3226  8月 15 2009 runInstallerdrwxrwxr-x.  2 root   root     4096  8月 15 2009 sshsetupdrwxr-xr-x. 14 root   root     4096  8月 15 2009 stage-rw-r--r--.  1 root   root     5402  8月 18 2009 welcome.html

 

13、关闭防火墙

[root@struggle database]#  service iptables stop

14、安装,用oracle用户登陆

[root@struggle database]# exit

[struggle@struggle ~]$ su - oracle

[oracle@struggle ~]$ cd /home/oracle/database/

[oracle@struggle ~]$./runInstaller -jreLoc /usr/lib/jvm/java-6-sun/jre (我是用自己的JDK安装)

第一步:填写email信息,以便得到支持(需要联网)

第二步:选择创建并配置一个数据库

第三步:选择服务端(看自己情况)

第四步:选择单实例数据库安装

第五步:选择自定义安装

第六步:选择产品语言

第七步:选择要安装的版本

第八步:选择安装路径(配置环境变量进的路径)

第九步:选择数据库实例名:orcl

第十步:选择数据字符集:ZHS16GBK

一路默认安装下去,到十七步的时候oracle检测必须组件,选择ignore all,这样选择安装完oracle后,oracle是可以正常工作的。

机器太卡,传图片太慢。。。

安装完成后进入sqlplus

SQL> sqlplus/nolog

SQL> conn /as sysdba

SQL> startup

配置开机启动:

/usr/u01/app/product/11.2.0/dbhome_1/bin下创建一个开机启动脚本:

[oracle@struggle dbhome_1]$ vim /usr/u01/app/product/11.2.0/dbhome_1/bin/oracledb

#!/bin/bash## /etc/init.d/oracledb## Run-level Startup script for the Oracle Listener and Instances# It relies on the information on /etc/oratabORACLE_BASE=/usr/u01/app ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_OWNR=oracleexport PATH=$PATH:$ORACLE_HOME/binexport ORACLE_SID=orclif [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]then    echo "Oracle startup: cannot start"    exit 1ficase "$1" in    start)           # Oracle listener and instance startup           echo -n "Starting Oracle: "           su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"           su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"           touch /var/lock/oracle           echo "OK"           ;;    stop)           # Oracle listener and instance shutdown             echo -n "Shutdown Oracle: "             su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"             su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"             rm -f /var/lock/oracle             echo "OK"             ;;       reload|restart)             $0 stop             $0 start             ;;       *)             echo "Usage: `basename $0` start|stop|restart|reload"             exit 1esacexit 0

 

修改脚本为可执行的:

[root@struggle ~]# chmod a+x /usr/u01/app/product/11.2.0/dbhome_1/bin/oracledb

创建连接:

[root@struggle ~]# ln -s /usr/u01/app/product/11.2.0/dbhome_1/bin/oracledb /etc/rc.d/init.d/oracledb

授权:

[root@struggle ~]# chmod 755 /etc/rc.d/init.d/

添加服务:

[root@struggle ~]# chkconfig --add oracledb

修改oracle启动配置

[root@struggle ~]# vim /etc/oratab

  orcl:/usr/u01/app/product/11.2.0/dbhome_1:Y

把N改为Y。

 

测试:

service oracledb stop

service oracledb start

成功!

 

0 0
原创粉丝点击