• -------------------------------------------------------------
  • ====================================

Redhat7使用yum安装Oracle 11g快速安装

大数据库 dewbay 7年前 (2017-06-12) 2243次浏览 已收录 0个评论 扫描二维码

系统版本:
Red Hat Enterprise Linux 6 or Compatible
环境预处理:因为Oracle安装需要做许多的环境配置,所以官方提供了yum方式来处理环境配置的方案:

<code class="hljs lasso has-numbering"><span class="hljs-number">1.</span>下载资源:wget http:<span class="hljs-comment">//public-<a href="https://www.lushuiwan.com/tag/yum" title="查看更多关于 yum 的文章" target="_blank">yum</a>.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle</span>
<span class="hljs-number">2.</span>用<a href="https://www.lushuiwan.com/tag/yum" title="查看更多关于 yum 的文章" target="_blank">yum</a>预处理环境:<a href="https://www.lushuiwan.com/tag/yum" title="查看更多关于 yum 的文章" target="_blank">yum</a> install oracle<span class="hljs-attribute">-rdbms</span><span class="hljs-attribute">-server</span><span class="hljs-subst">-</span><span class="hljs-number">11</span>gR2<span class="hljs-attribute">-preinstall</span></code>
  • 1
  • 2
  • 1
  • 2

查看安预处理结果:

<code class="hljs lasso has-numbering">/<span class="hljs-built_in">var</span>/<span class="hljs-keyword">log</span>/oracle<span class="hljs-attribute">-rdbms</span><span class="hljs-attribute">-server</span><span class="hljs-subst">-</span><span class="hljs-number">11</span>gR2<span class="hljs-attribute">-preinstall</span>/results/orakernel<span class="hljs-built_in">.</span><span class="hljs-keyword">log</span>文件中保存中相关信息
/<span class="hljs-built_in">var</span>/<span class="hljs-keyword">log</span>/oracle<span class="hljs-attribute">-rdbms</span><span class="hljs-attribute">-server</span><span class="hljs-subst">-</span><span class="hljs-number">11</span>gR2<span class="hljs-attribute">-preinstall</span>/backup/Nov<span class="hljs-subst">-</span><span class="hljs-number">02</span><span class="hljs-subst">-</span><span class="hljs-number">2016</span><span class="hljs-subst">-</span><span class="hljs-number">14</span><span class="hljs-subst">-</span><span class="hljs-number">31</span><span class="hljs-subst">-</span><span class="hljs-number">26</span>文件中为备份信息
cat /etc/passwd <span class="hljs-subst">|</span>grep oracle
cat /etc/<span class="hljs-keyword">group</span> <span class="hljs-subst">|</span>grep dba 
cat /etc/<span class="hljs-keyword">group</span> <span class="hljs-subst">|</span>grep oinstall</code>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

可以查看到预处理时创建的oracle需要的用户信息:
Redhat7使用yum安装Oracle 11g快速安装
3.编辑 SELinux 配置文件 vi /etc/selinux/config,将 SELINUX 的值设为 disabled,如下:

<code class="hljs fix has-numbering"><span class="hljs-attribute">SELINUX</span>=<span class="hljs-string">disabled;</span></code>
  • 1
  • 1

修改该文件可使重启系统后不启动 SELinux。关闭当前已开启的 SELinux 使用如下命令:

<code class="hljs  has-numbering">setenforce 0</code>
  • 1
  • 1

4.配置 Oracle 的.bashrc 文件:

<code class="hljs bash has-numbering"><span class="hljs-keyword">export</span> ORACLE_BASE=/opt/oracle
<span class="hljs-keyword">export</span> ORACLE_HOME=<span class="hljs-variable">$ORACLE_BASE</span>/product/<span class="hljs-number">11.2</span>.<span class="hljs-number">0</span>/db_1
<span class="hljs-keyword">export</span> PATH=<span class="hljs-variable">$PATH</span>:<span class="hljs-variable">$HOME</span>/bin:<span class="hljs-variable">$ORACLE_HOME</span>/bin
<span class="hljs-keyword">export</span> ROACLE_PID=ora11g
<span class="hljs-keyword">export</span> NLS_LANG=AMERICAN_AMERICA.AL32UTF8
<span class="hljs-keyword">export</span> LD_LIBRARY_PATH=<span class="hljs-variable">$ORACLE_HOME</span>/lib:/usr/lib
<span class="hljs-keyword">export</span> ORACLE_SID=orcl11g</code>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

5.到 oracel 的页面选择要安装的版本并下载:

<code class="hljs avrasm has-numbering"><span class="hljs-label">http:</span>//www<span class="hljs-preprocessor">.oracle</span><span class="hljs-preprocessor">.com</span>/technetwork/database/enterprise-edition/downloads/index<span class="hljs-preprocessor">.html</span></code>
  • 1
  • 1

这里选择的 11g:

<code class="hljs avrasm has-numbering"><span class="hljs-label">http:</span>//download<span class="hljs-preprocessor">.oracle</span><span class="hljs-preprocessor">.com</span>/otn/linux/<a href="https://www.lushuiwan.com/tag/oracle11g" title="查看更多关于 oracle11g 的文章" target="_blank">oracle11g</a>/<span class="hljs-built_in">R2</span>/linux<span class="hljs-preprocessor">.x</span>64_11gR2_database_1of2<span class="hljs-preprocessor">.zip</span>?AuthParam=<span class="hljs-number">1478071188</span>_7470e80bbeb036e7c905308527a8ce76
<span class="hljs-label">http:</span>//<span class="hljs-number">120.52</span><span class="hljs-number">.72</span><span class="hljs-number">.24</span>/download<span class="hljs-preprocessor">.oracle</span><span class="hljs-preprocessor">.com</span>/c3pr90ntc0td/otn/linux/<a href="https://www.lushuiwan.com/tag/oracle11g" title="查看更多关于 oracle11g 的文章" target="_blank">oracle11g</a>/<span class="hljs-built_in">R2</span>/linux<span class="hljs-preprocessor">.x</span>64_11gR2_database_2of2<span class="hljs-preprocessor">.zip</span> </code>
  • 1
  • 2
  • 1
  • 2

下载后解压两个文件得到数据的安装文件夹 database(笔者的 oracle 的安装文件在下载并解压在/home/oracle 目录下):
/home/oracle/database/response 目录下有几个关于 oracle 的安装文件,这里因为没有图形界面所以使用 Oracle 的静默安装方式:
修改 db_install.rsp 的以下几项:

<code class="hljs ini has-numbering"><span class="hljs-setting">INVENTORY_LOCATION=<span class="hljs-value">/opt/oracle/oraInventory</span></span>
<span class="hljs-setting">ORACLE_HOME=<span class="hljs-value">/opt/oracle/product/<span class="hljs-number">11.2</span>.<span class="hljs-number">0</span>/db_1</span></span>
<span class="hljs-setting">ORACLE_BASE=<span class="hljs-value">/opt/oracle</span></span>
<span class="hljs-setting">DECLINE_SECURITY_UPDATES=<span class="hljs-value"><span class="hljs-keyword">true</span></span></span></code>
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

安装 Oracle:

<code class="hljs lasso has-numbering">/home/oracle/database/bin/runInstaller <span class="hljs-attribute">-silent</span> <span class="hljs-attribute">-force</span> <span class="hljs-attribute">-ignoreSysPrereqs</span> <span class="hljs-attribute">-responseFile</span> /home/oracle/database/response/db_install<span class="hljs-built_in">.</span>rsp</code>
  • 1
  • 1

完成安装:Successfully Setup Software.出此日志则表示安装完成。
6.用 root 用户执行下面的脚本

<code class="hljs avrasm has-numbering">/opt/oracle/oraInventory/orainstRoot<span class="hljs-preprocessor">.sh</span>
/opt/oracle/app/oracle/product/<span class="hljs-number">11.2</span><span class="hljs-number">.0</span>/dbhome_1/root<span class="hljs-preprocessor">.sh</span></code>
  • 1
  • 2
  • 1
  • 2

7.配置监听程序

<code class="hljs avrasm has-numbering">netca /silent /responsefile /home/oracle/response/netca<span class="hljs-preprocessor">.rsp</span></code>
  • 1
  • 1

成功运行后,在/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin 目录下生成 sqlnet.ora 和 listener.ora 两个文件。
通过 netstat -tlnp 命令,看到
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 22494/tnslsnr
说明监听器已经在 1521 端口上开始工作了
安装 oracle数据库

<code class="hljs lasso has-numbering">dbca <span class="hljs-attribute">-silent</span> <span class="hljs-attribute">-responseFile</span> /home/oracle/response/dbca<span class="hljs-built_in">.</span>rsp</code>
  • 1
  • 1

建库后实例检查:

<code class="hljs perl has-numbering">ps -ef | <span class="hljs-keyword">grep</span> ora<span class="hljs-number">_</span> | <span class="hljs-keyword">grep</span> -v <span class="hljs-keyword">grep</span></code>
  • 1
  • 1

Redhat7使用yum安装Oracle 11g快速安装

登录 ORACLE:

<code class="hljs oxygene has-numbering">sqlplus / <span class="hljs-keyword">as</span> sysdba
SQL> <span class="hljs-keyword">create</span> user seven identified <span class="hljs-keyword">by</span> <span class="hljs-number">123456</span>;
SQL> grant connect, resource,dba <span class="hljs-keyword">to</span> seven;</code>

露水湾 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Redhat7使用yum安装Oracle 11g快速安装
喜欢 (0)
[]
分享 (0)
关于作者:
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址