Redhat6.6 图形化安装 oracle12c

简介: 环境说明下载好Redhat6.6,在VMware Station12安装,选择安装图形化界面。下载oracle12c linuxamd64_12102_database.zip 并解压到database启动Redhat6.6 64位,点击菜单 虚拟机->VMware-tools安装。

环境说明

  1. 下载好Redhat6.6,在VMware Station12安装,选择安装图形化界面。下载oracle12c linuxamd64_12102_database.zip 并解压到database
  2. 启动Redhat6.6 64位,点击菜单 虚拟机->VMware-tools安装。
  3. 在命令行中根用户执行如下命令,进行VMware-tools安装

    cd /media/VMware\ Tools/
    cp VMwareTools-10.0.0-*.tar.gz ~
    cd ~
    tar zxf VMwareTools-10.0.0-*.tar.gz
    rm VMwareTools-10.0.0-*.tar.gz
    cd vmware-tools-distrib/
    ./vmware-intall.pl
    之后一路回车即可

    这里安装这个工具主要是后面使用共享文件夹
  4. 点击虚拟机设置->选项->共享文件夹 共享database
  5. 回到命令行,cd /mnt/hgfs/database,这里就是oracle12g的安装文件

配置安装Oracle的系统环境

  1. uname -a 检查linux版本,32 or 64
  2. 创建oracle用户及管理组
    以root用户登录linux,执行以下命令

    
    #groupadd dba 创建管理组 
    
    
    #groupadd oinstall 创建安装组 
    
    
    #useradd oracle -g oinstall -G dba 
    
    
    #passwd oracle
    
    oracle

    检查是否存在 nobody 用户:idnobody ,没有则添加: Useradd nobody

  3. 创建用于安装 oracle 的目录结构并赋权:

    
    #mkdir /opt/oracle/
    
    
    #mkdir /opt/oracle/oradata
    
    
    #mkdir /opt/oracle/product
    
    
    #chown -R oracle.oinstall /opt/oracle
    
    
    #mkdir /opt/oraInventory
    
    
    #chown -R oracle.oinstall /opt/oraInventory/
    
  4. 建立 oracle 环境变量:
    使用上面创建的 oracle 用户登录:

    
    #su - oracle
    
    $vi /home/oracle/.bash_profile
    在文件中添加如下:
    umask 022
    export ORACLE_BASE=/opt/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1 
    export ORACLE_SID=orcl
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
    保存退出 
    --执行以下命令让配置马上生效或以 oracle 用户登录使设置生效 
    $source $HOME/.bash_profile 
  5. 设置系统内核参数:
    切回root用户:su root
    其中给出的是最小值,因此如果你的系统使用的值较大,则不要更改他
    #vi /etc/sysctl.conf

    fs.file-max=6815744
    fs.aio-max-nr= 1048576
    kernel.shmall= 2097152
    kernel.shmmax=2147483648
    kernel.shmmni=4096
    kernel.sem=25032000100128
    net.ipv4.ip_local_port_range= 900065500
    net.core.rmem_default=4194304
    net.core.rmem_max=4194304
    net.core.wmem_default= 262144
    net.core.wmem_max= 1048576
    修改后运行"/sbin/sysctl -p"命令使得内核改变立即生效
  6. 对oracle用户进行限制配置:
    vi /etc/security/limits.conf

    oracle soft nproc 2047 
    oracle hard nproc 16384   //对 oracle 用户的 process 最大 16384 个
    oracle soft nofile 1024 
    oracle hard nofile 65536 //对 oracle 用户文件数量限制是 65535 个
    
    编辑文件:vi /etc/pam.d/login 加入以下语句(可能应该加在最后一条规则之前):
    session required /lib64/security/pam_limits.so
    session required pam_limits.so

安装oracle

  1. 解压oracle:
    前面已经解压设置成共享目录,可以跳过解压,但需要移动到根目录改权限,如果没有解压直接上传到服务器的,可以执行如下命令:

    
    #unzip linux*_1of2.zip
    
    
    #unzip linux*_2of2.zip
    
    注意解压好的目录用户oracle必须具有读写和执行的权限,可以将目录的用户和用户组设置为oracle。也可以拷贝到$ORACLE_BASE或者oracle用户的home下:
    
    #chown -R oracle database
    
    
    #chgrp -R oinstall database
    
  2. reboot并以oracle登录,进入图形界面

    
    #cd database
    
    
    #./runInstaller 
    

    Oracle Database 12c 1
    Oracle Database 12c 2
    Oracle Database 12c 3
    Oracle Database 12c 4
    Oracle Database 12c 5
    Oracle Database 12c 6
    Oracle Database 12c 7
    Oracle Database 12c 8
    Oracle Database 12c 9
    Oracle Database 12c 9.1
    这里会出现内核参数配置不对,可能是前面配置内核的参数是参考安装oracle 11g的参数的问题,依赖包也缺少
    (1)解决依赖包
    因为这里安装Redhat6.6的时候没有注册,没有线上源,这里先说明一下如何配置本地源
    1)虚拟机挂在安装Redhat6.6的镜像
    2)添加本地源:

    
    # cd /etc/yum.repos.d/
    
    
    # vi rhel-source.repo
    
    最后添加:
    [rhel_local_01]
    name=Red Hat Enterprise Linux $releasever - $basearch - Source33333
    baseurl=file:///media/"RHEL-6.6 Server.x86_64"
    gpgcheck=1
    
    
    # yum clean all
    
    
    导入公钥:
    rpm --import /etc/pki/rpm-gpg/RPM*

    3)安装依赖

    [root@localhost ~]# yum install compat-libcap1 compat-libstdc++-33 libstdc++-devel gcc gcc-c++ ksh libaio-devel
    
    依赖关系解决
    
    ============================================ ============================================
    软件包                    架构         版本                  仓库                 大小
    
    ========================================================================================
    正在安装:
    compat-libcap1            x86_64       1.10-1                rhel-local-01        17 k
    compat-libstdc++-33       x86_64       3.2.3-69.el6          rhel-local-01       183 k
    gcc                       x86_64       4.4.7-11.el6          rhel-local-01        10 M
    gcc-c++                   x86_64       4.4.7-11.el6          rhel-local-01       4.7 M
    ksh                       x86_64       20120801-21.el6       rhel-local-01       758 k
    libaio-devel              x86_64       0.3.107-10.el6        rhel-local-01        13 k
    libstdc++-devel           x86_64       4.4.7-11.el6          rhel-local-01       1.6 M
    为依赖而安装:
    cloog-ppl                 x86_64       0.15.7-1.2.el6        rhel-local-01        93 k
    cpp                       x86_64       4.4.7-11.el6          rhel-local-01       3.7 M
    mpfr                      x86_64       2.4.1-6.el6           rhel-local-01       156 k
    ppl                       x86_64       0.10.2-11.el6         rhel-local-01       1.3 M
    
    事务概要
    
    ========================================================================================
    Install      11 Package(s)
    
    总下载量:23 M
    Installed size: 56 M
    确定吗?[y/N]:y
    
    
    已安装:
    compat-libcap1.x86_64 0:1.10-1           compat-libstdc++-33.x86_64 0:3.2.3-69.el6   
    gcc.x86_64 0:4.4.7-11.el6                gcc-c++.x86_64 0:4.4.7-11.el6               
    ksh.x86_64 0:20120801-21.el6             libaio-devel.x86_64 0:0.3.107-10.el6        
    libstdc++-devel.x86_64 0:4.4.7-11.el6   
    
    作为依赖被安装:
    cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-11.el6 mpfr.x86_64 0:2.4.1-6.el6
    ppl.x86_64 0:0.10.2-11.el6

    (2)解决内核参数
    因为内核参数的问题是可修复的,点击修补并再次检查
    Oracle Database 12c 9.2
    这里说明只要根用户执行指定脚本即可

[root@localhost ~]# /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh

内核参数变化如下:(通过/sbin/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
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.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmni = 4096
kernel.sem = 25032000100128
error: "Invalid argument" setting key "net.ipv4.ip_local_port_range"
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

修改后:
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
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.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmni = 4096
kernel.sem = 930699040  32000   100 128
net.ipv4.ip_local_port_range = 9000   65535
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

确定即可
Oracle Database 12c 10

保存响应文件,以备以后静默安装oralce使用
Oracle Database 12c 10.1
之后等待即可
Oracle Database 12c 11

Oracle Database 12c 11.1

执行配置脚本:
[root@localhost ~]# /opt/oraInventory/orainstRoot.sh 
更改权限/opt/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/opt/oraInventory 到 oinstall.
脚本的执行已完成。
[root@localhost ~]# /opt/oracle/product/12.1.0/dbhome_1/root.sh 
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /opt/oracle/product/12.1.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /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 script.
Now product-specific root actions will be performed.

Oracle Database 12c 12

命令行显示此次安装日志的位置:
.[oracle@localhost database]$ 
[oracle@localhost database]$ 可以在以下位置找到本次安装会话的日志:
 /opt/oraInventory/logs/installActions2015-12-14_12-39-07PM.log

安装数据库

执行命令
$dbca
Database Configuration Assistant 1
Database Configuration Assistant 2
Database Configuration Assistant 3
Database Configuration Assistant 4
Database Configuration Assistant 4.1
Database Configuration Assistant 4.2
Database Configuration Assistant 4.3
Database Configuration Assistant 5
Database Configuration Assistant 6
Database Configuration Assistant 6.1

安装监听

执行命令
$netca
进入图形化配置,直接默认下一步,到最后完成,其中你也可以修改监听器的名称,协议,端口

Oracle Net Congiguration Assistant 1
Oracle Net Congiguration Assistant 2
Oracle Net Congiguration Assistant 3
Oracle Net Congiguration Assistant 4
Oracle Net Congiguration Assistant 5
Oracle Net Congiguration Assistant 6
Oracle Net Congiguration Assistant 7

命令行显示
Oracle Net Services 配置:
正在配置监听程序:LISTENER
监听程序配置完成。
Oracle Net 监听程序启动:
    正在运行监听程序控制: 
      /opt/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start LISTENER
    监听程序控制完成。
    监听程序已成功启动。
成功完成 Oracle Net Services 配置。退出代码是0

安装完毕后的一些测试、配置及检查

  1. 配置oracle随机启动
    (1)修改/etc/oratab文件,需要将orcl:/opt/oracle/product/12.1.0/dbhome_1:N最后的N改成Y(如果/etc/oratab文件不存在,则需要使用root用户执行$ORACLE_HOME/root.sh文件)

    
    #cat /etc/oratab
    
    orcl:/opt/oracle/product/12.1.0/dbhome_1:Y

    (2)使用oracle的安装用户(oracle)修改$ORACLE_HOME/bin/dbstart文件,修改之前最好备份一下,使用如下命令

    
    #cp $ORACLE_HOME/bin/dbstart $ORACLE_HOME/bin/dbstart.bak
    
    找到
    ORACLE_HOME_LISTNER=...,
    修改成
    ORACLE_HOME_LISTNER=/opt/oracle/product/12.1.0/dbhome_1
    或者直接修改成:
    ORACLE_HOME_LISTNER=$ORACLE_HOME

    (3)测试运行dbshut, dbstart
    1)修改dbstart和dbshut的日志文件的权限(如果这两个文件不存在,先手工touch):
    root用户先创建这两个文件,不创建也可以,系统会自动创建在$ORACLE_HOME下。

    
    #cd $ORACLE_HOME/bin
    
    
    #touch startup.log
    
    
    #chown oracle.oinstall startup.log
    
    
    #chmod 755 startup.log
    
    
    #touch shutdown.log
    
    
    #chown oracle.oinstall shutdown.log
    
    
    #chmod 755 shutdown.log
    
    
    #ls -l startup.log shutdown.log
    

    2)执行相应的脚本进行测试

    
    #su - oracle
    
    $cd $ORACLE_HOME
    $dbshut (or dbstart)

    3)创建oracle服务启动脚本oradb(使用root用户),创建后可以使用oradb start|stop 命令。

    
    #touch /home/oracle/oradb
    
    
    #chown oracle.oinstall /home/oracle/oradb
    
    
    #chmod 775 /home/oracle/oradb
    
    
    脚本内容如下:
    
    #!/bin/sh
    
    
    # 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 ORA_HOME.
    
    ORA_HOME=/opt/oracle/product/12.1.0/dbhome_1/
    ORA_OWNER=oracle
    if [ ! -f $ORA_HOME/bin/dbstart ]
    then
    echo "Oracle startup: cannot start"
    exit
    fi
    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 - $ORA_OWNER -c $ORA_HOME/bin/dbstart
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
    ;;
    'stop')
    
    # Stop the Oracle databases:
    
    
    # The following command assumes that the oracle login
    
    
    # will not prompt the user for any values
    
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
    su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
    ;;
    'restart')
    $0 stop
    $0 start
    ;;
    esac
    
    把该脚本copy到/etc/init.d/目录下
    
    #cp /home/oracle/oradb /etc/init.d/oradb
    
    将oradb加入到系统启动列表中
    
    #chkconfig --add /home/oracle/oradb 注:一定要在/etc/init.d/目录下执行
    
    
    #chkconfig --list oradb
    

    测试快速启动命令:

    
    #/etc/init.d/oradb stop
    
    
    #/etc/init.d/oradb start
    

    重启linux #reboot 在linux启动的时候,会偏慢

    
    # su - oracle
    
    
    # ps -ef | grep ora
    

    (4)测试连接数据库
    用oracle用户远程登陆,然后

 [oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 12.1.0.2.0 Production on Mon Dec 14 23:30:15 2015

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

SQL> conn / as sysdba
Connected.

 SQL> create table testUser(id integer, name char(10));

Table created.

SQL> insert into testUser values(0, 'Jack');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from testUser;

    ID NAME
---------- ----------
     0 Jack

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

到此,oracle安装完毕


参考

oracle自启动脚本
安装Linux版本的oracle11g单机版.PDF
Oracle Enterprise Manager 12c 安装过程

目录
相关文章
|
4月前
|
SQL Oracle 关系型数据库
Win10下安装Oracle 18c
Win10下安装Oracle 18c
|
1月前
|
Oracle 关系型数据库 数据库
如何利用 Docker 安装 Oracle 数据库
【2月更文挑战第14天】
97 0
|
1月前
|
存储 Oracle 关系型数据库
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
|
2月前
|
Oracle 关系型数据库 数据安全/隐私保护
Docker安装oracle11g
Docker安装oracle11g步骤
|
2月前
|
Oracle 关系型数据库
oracle rac 手工安装补丁,不适用auto
oracle rac 手工安装补丁,不适用auto
25 3
|
3月前
|
Oracle 关系型数据库 Linux
RHEL7.9系统下一键脚本安装Oracle 11gR2单机版本
RHEL7.9系统下一键脚本安装Oracle 11gR2单机版本
64 1
|
4月前
|
SQL Oracle 关系型数据库
docker 方式安装ORACLE 11g
docker 方式安装ORACLE 11g
199 4
|
1月前
|
安全 Linux 网络安全
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
94 0
|
7月前
|
编解码 Java Linux
linux【redhat&ubuntu】下ffmpeg-3.1安装编译及视频转码
这篇是几年前整理的老文章了,当时在调研流视频推送及播放相关技术,并在项目中应用,使用到ffmpeg,所以整理了这篇文章,但并未发布。最近又有相关的技术需求,所以整理出来,作为一个新的开始。
174 0
|
8月前
|
关系型数据库 Linux 数据库
百度搜索:蓝易云【Redhat Linux9上安装DB2【详解】】
注意事项: - 安装过程中需要注意所选的软件包版本和系统依赖。 - 在创建 DB2 用户和组时,可以使用自己的用户名和组名,但需要与后续操作一致。 - 在配置环境变量时,需要注意所填写的路径是否正确,否则会导致启动 DB2 失败。 - 在启动 DB2 时,需要以 DB2 用户身份进行操作,否则会提示权限不足。
73 0

推荐镜像

更多