海参战神 發表於 2019-8-1 16:55:00

CentOS 7.X 静默安装Oracle 12C数据库

<blockquote><h3>环境</h3><h4>System : CentOS 7.x</h4><div class="cnblogs_code"><pre style="white-space: pre">jrxxfwb-zrgldb:<span style="color: rgba(0, 128, 0, 1)">//&gt; uname -a</span>
Linux jrxxfwb-zrgldb 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux</pre></div><h4>SELINUX: 关闭</h4><h4>FIREWALL:关闭</h4><div class="cnblogs_code"><pre style="white-space: pre">systemctl <span style="color: rgba(0, 0, 255, 1)">stop</span> firewalld.service --关闭防火墙
systemctl disable firewalld.service -- 禁止防火墙开机启动
systemctl <span style="color: rgba(0, 0, 255, 1)">status</span> firewalld.service-- 查看防火墙状态</pre></div><p><br></p><h4></h4><h4></h4><h4></h4></blockquote><blockquote><h3>操作步骤</h3><p>A、环境准备</p><p>B、用户组创建</p><p>C、修改系统内核参数</p><p>D、修改用户配置</p><p>E、数据库应用安装</p><p>F、数据库初始化</p></blockquote><blockquote><h3>A、环境准备</h3><p>1、选择Oracle安装包,直接去官网选择自己需要的版本(需要注册oracle账号),如果下载不了的话也可以联系我度盘共享。</p><p>地址:https://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/index.html</p><p>本次使用的版本下载地址:https://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-2240591.html</p><p><img width="621" height="282" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165249434-1472263207.png" border="0"></p><p><br></p><p>2、使用root用户登录,进行系统基础环境准备。</p><p>执行以下命令:</p><div class="cnblogs_code"><pre style="white-space: pre">yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686</pre></div><p>静待系统进行软件更新安装,成功后如下:</p><p><img width="900" height="250" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165302844-793318146.png" border="0"></p><p>执行检查命令:</p><div class="cnblogs_code"><pre style="white-space: pre">rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel</pre></div><p><img width="366" height="368" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165316631-648772074.png" border="0"></p></blockquote><p>5</p><blockquote><h3>B、用户组创建</h3><p>1、创建 oinstall 和 dba 组</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/root/&gt; groupadd oinstall
zrgldb:/root/&gt; groupadd dba</pre></div><p>2、创建 oracle 用户,设置密码</p><div class="cnblogs_code"><pre style="white-space: pre">jrxxfwb-zrgldb:/root/&gt; useradd -g oinstall -G dba oracle
jrxxfwb-zrgldb:/root/&gt; passwd oracle
Changing password <span style="color: rgba(0, 0, 255, 1)">for</span> user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype <span style="color: rgba(0, 0, 255, 1)">new</span> password:
BAD PASSWORD: The password is shorter than 8 characters
Retype <span style="color: rgba(0, 0, 255, 1)">new</span> password:
passwd: all authentication tokens updated successfully.</pre></div><p>3、查看用户 id oracle</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/root/&gt; id oracle
uid=1004(oracle) gid=1004(oinstall) groups=1004(oinstall),1005(dba)</pre></div><p><br></p></blockquote><blockquote><h3>C、修改系统内核参数</h3><p>1、修改系统配置: vi /etc/sysctl.conf ,增加如下内容:</p><div class="cnblogs_code"><pre style="white-space: pre">fs.aio-max-nr = 1048576
fs.file-max = 6815744
</pre><pre style="white-space: pre"># shmall 是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。这两个可以设置为内存的 90%。例如 16G 内存,16*1024*1024*1024*90% = 15461882265,shmall 的大小为 15461882265/4k(getconf PAGESIZE可得到) = 3774873</pre><pre style="white-space: pre"># 因为本机是32G内存,所以shmmax 是 32*1024*1024*1024*90% = 30,923,764,531,shmall 是 30,923,764,531/4096 = 7,549,747</pre><pre style="white-space: pre"><font color="#ff0000">kernel.shmmax = 30923764531</font></pre><pre style="white-space: pre"><font color="#ff0000">kernel.shmall = 7549747</font>
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576</pre></div><p>结果如下:</p><p><img width="685" height="203" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165328820-872383557.png" border="0"></p><p><br></p><p>2、使配置生效:&nbsp; sysctl -p</p><p><img width="533" height="156" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165342723-1488409240.png" border="0"></p><p><br></p></blockquote><blockquote><h3>D、修改用户配置</h3><p>1、修改用户限制。</p><p>打开文件:&nbsp; vi&nbsp; /etc/security/limits.conf</p><p>在文件末尾添加如下6行内容:</p><div class="cnblogs_code"><pre style="white-space: pre">oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240</pre></div><p>最终结果如图:</p><p><img width="582" height="283" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165357118-879977325.png" border="0"></p><p><br></p><p>2、修改用户登录库文件引用</p><p>打开系统文件: vi /etc/pam.d/login</p><p>在文件末尾添加如下2行内容:</p><div class="cnblogs_code"><p>session&nbsp;&nbsp;&nbsp; required&nbsp;&nbsp;&nbsp;&nbsp; /lib64/security/pam_limits.so<br>
session&nbsp;&nbsp;&nbsp; required&nbsp;&nbsp;&nbsp;&nbsp; pam_limits.so</p></div><p>最终结果如图:</p><p><img width="649" height="247" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165410466-14947194.png" border="0"></p><p><br></p><p>3、修改用户登录环境变量</p><p>打开系统文件: vi /etc/profile</p><p>在文件末尾添加如下内容:</p><div class="cnblogs_code"><pre style="white-space: pre"><span style="color: rgba(0, 0, 255, 1)">if</span> [ $USER = "<span style="color: rgba(139, 0, 0, 1)">oracle</span>" ]; then
    <span style="color: rgba(0, 0, 255, 1)">if</span> [ $SHELL = "<span style="color: rgba(139, 0, 0, 1)">/bin/ksh</span>" ]; then
      ulimit -p 16384
      ulimit -n 65536
    <span style="color: rgba(0, 0, 255, 1)">else</span>
      ulimit -u 16384 -n 65536
    fi
fi</pre></div><p>最终结果如图:</p><p><img width="626" height="530" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165424976-827459503.png" border="0"></p><p>退出编辑状态,使修改的文件生效: </p><div class="cnblogs_code"><pre style="white-space: pre">source /etc/profile</pre></div><p><br></p><p>4、创建安装目录,配置安装目录权限。</p><div class="cnblogs_code"><pre style="white-space: pre">mkdir -p /usr/app/
chown -R oracle:oinstall /usr/app/
chmod -R 775 /usr/app/</pre></div><p><br></p><p>5、配置 Oracle 用户环境变量</p><p>切换用户: su – oracle</p><p>编辑环境变量: vi .bash_profile</p><p>新增配置如下:</p><div class="cnblogs_code"><pre style="white-space: pre"><span style="color: rgba(0, 0, 255, 1)">export</span> ORACLE_BASE=/usr/app/oracle
<span style="color: rgba(0, 0, 255, 1)">export</span> ORACLE_SID=orcl
<span style="color: rgba(0, 0, 255, 1)">export</span> PS1=`uname -n`':$PWD/&gt; '
</pre></div><p><img width="470" height="248" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165437531-1148754059.png" border="0"></p><p>生效配置文件: source .bash_profile</p></blockquote><blockquote><h3>E、数据库应用安装</h3><p>1、使用 oracle 用户,创建数据库安装配置文件夹 etc 。</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb://&gt; su - oracle</pre><pre style="white-space: pre">zrgldb:/<span style="color: rgba(0, 0, 255, 1)">home</span>/oracle/&gt; mkdir etc</pre></div><p><br></p><p>2、上传安装文件到 oracle 用户目录下,并解压文件。</p><p>执行命令:</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/<span style="color: rgba(0, 0, 255, 1)">home</span>/oracle/&gt; unzip linuxamd64_12102_database_1of2.zip</pre><pre style="white-space: pre">zrgldb:/<span style="color: rgba(0, 0, 255, 1)">home</span>/oracle/&gt; unzip linuxamd64_12102_database_2of2.zip</pre></div><p>解压完成会在用户目录下出现一个 database 文件夹,如下:</p><p><img width="735" height="83" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165451585-1383075374.png" border="0"></p><p><br></p><p>3、复制 Oracle配置文件到 etc 目录下,并修改配置文件权限</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/<span style="color: rgba(0, 0, 255, 1)">home</span>/oracle/&gt; cp&nbsp; ./database/response<span style="color: rgba(0, 128, 0, 1)">/* ./etc/</span></pre><pre style="white-space: pre">zrgldb:/home/oracle/&gt; chmod 700 ./etc/*.rsp</pre></div><p>复制后的etc目录文件如下:</p><p><img width="580" height="50" title="image" style="display: inline; background-image: none" alt="image" src="https://img2018.cnblogs.com/blog/701590/201908/701590-20190801165504541-1571363493.png" border="0"></p><p><br></p><p>4、修改静默安装配置文件 db_install.rsp</p><p>vi ./etc/db_install.rsp</p><div class="cnblogs_code"><img class="code_img_closed" id="code_img_closed_914a7ad4-1f85-4470-b314-bca247c64837" alt="" src="https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif"><img class="code_img_opened" id="code_img_opened_914a7ad4-1f85-4470-b314-bca247c64837" style="display: none" alt="" src="https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif">
<div class="cnblogs_code_hide" id="cnblogs_code_open_914a7ad4-1f85-4470-b314-bca247c64837"><pre style="white-space: pre"># 修改文件配置
#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
#   - INSTALL_DB_SWONLY
#   - INSTALL_DB_AND_CONFIG
#   - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the Unix group to be set <span style="color: rgba(0, 0, 255, 1)">for</span> the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter <span style="color: rgba(0, 0, 255, 1)">if</span> installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/usr/app/oracle/oraInventory

# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs
#-------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/usr/app/oracle/product/12/db_1

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/usr/app/oracle

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
#   - EE   : Enterprise Edition

#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
# The value to be specified <span style="color: rgba(0, 0, 255, 1)">for</span> OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=oinstall

#------------------------------------------------------------------------------
# The BACKUPDBA_GROUP is the OS group which is to be granted OSBACKUPDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.BACKUPDBA_GROUP=oinstall

#------------------------------------------------------------------------------
# The DGDBA_GROUP is the OS group which is to be granted OSDGDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DGDBA_GROUP=oinstall

#------------------------------------------------------------------------------
# The KMDBA_GROUP is the OS group which is to be granted OSKMDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.KMDBA_GROUP=oinstall

#-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
#   - GENERAL_PURPOSE
#   - DATA_WAREHOUSE
# GENERAL_PURPOSE: A starter database designed <span style="color: rgba(0, 0, 255, 1)">for</span> general purpose use or transaction-heavy applications.
# DATA_WAREHOUSE : A starter database optimized <span style="color: rgba(0, 0, 255, 1)">for</span> data warehousing applications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl

#-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl

#-------------------------------------------------------------------------------
# Specify the Starter Database character set.
#
#One of the following
#AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
#EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
#BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
#AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
#IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
#KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
#ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------
# This variable should be set to true <span style="color: rgba(0, 0, 255, 1)">if</span> Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=true

#------------------------------------------------------------------------------
# This variable holds the password that is to be used <span style="color: rgba(0, 0, 255, 1)">for</span> all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=oracle

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password <span style="color: rgba(0, 0, 255, 1)">for</span>
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=true

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value <span style="color: rgba(0, 0, 255, 1)">for</span> this variable should be true <span style="color: rgba(0, 0, 255, 1)">if</span> you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true</pre>
</div>
<span class="cnblogs_code_collapse">Look这里</span></div><p><br></p><p>5、开始安装,执行 db_install.rsp</p><div class="cnblogs_code"><p>zrgldb:/home/oracle/&gt; ./database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp<br>
Starting Oracle Universal Installer...</p>
<p>Checking Temp space: must be greater than 500 MB.&nbsp;&nbsp; Actual 44203 MB&nbsp;&nbsp;&nbsp; Passed<br><font color="#ff0000" style="background-color: rgba(255, 255, 0, 1)">
Checking swap space: 0 MB available, 150 MB required.&nbsp;&nbsp;&nbsp; Failed &lt;&lt;&lt;&lt;</font><br><font color="#ff0000" style="background-color: rgba(255, 255, 0, 1)">
</font></p>
<p>Some requirement checks failed. You must fulfill these requirements before</p>
<p>continuing with the installation,</p>
<p>Continue? (y/n) </p></div><p><font color="#ff0000">报错了。我直接输入 n退出了,当然输入 y 也可能安装成功,避免失败,我还是把问题解决一下。如果没报错直接进行安装操作,跳过以下步骤。</font></p><p><font color="#ff0000">一、是没有swap空间</font></p><p>① 检查一下系统的 swap 文件</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/home/oracle/&gt;swapon –s
swapon: stat failed –s: No such file or directory</pre></div><p>说明系统不存在swap</p><p>② 切换 root 用户,创建swap文件</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/root/&gt; dd <span style="color: rgba(0, 0, 255, 1)">if</span>=/dev/zero of=/swapfile bs=1024 count=512k
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 1.49301 s, 360 MB/s</pre></div><p>③ 格式化并激活 Swap 文件</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/root/&gt; mkswap /swapfile
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=ea40b04c-238c-41b1-8f83-7d36b8b7fd66</pre><p>zrgldb:/root/&gt; swapon /swapfile<br>
swapon: /swapfile: insecure permissions 0644, 0600 suggested.</p></div><p>④ 再次检查系统的 Swap 文件</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/root/&gt; swapon -s
Filename                              Type            Size    Used    Priority
/swapfile                               file    5242840       -1</pre></div><p>⑤ 配置机器重启自动挂载Swap,修改 fstab 配置:vi&nbsp; /etc/fstab</p><p>添加一行</p><div class="cnblogs_code"><pre style="white-space: pre">/swapfile          swap            swap    defaults      0 0</pre></div><p>⑥ 赋予 Swap 文件权限</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:<span style="color: rgba(0, 128, 0, 1)">//&gt; chmod 600 /swapfile</span>
zrgldb:<span style="color: rgba(0, 128, 0, 1)">//&gt; chown root:root /swapfile</span></pre></div><p><br></p><p>切换到 oracle 用户 ,再次执行本部操作的数据库安装命令:</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/home/oracle/&gt; ./database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 43690 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 511 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-08-01_03-16-16PM. Please wait ...</pre><pre style="white-space: pre"><br></pre><pre style="white-space: pre">…</pre><pre style="white-space: pre">…</pre><pre style="white-space: pre"><br></pre><p>You can find the log of this install session at:<br>&nbsp; /usr/app/oracle/oraInventory/logs/installActions2019-08-01_03-20-39PM.log<br>
The installation of Oracle Database 12c was successful.<br>
Please check '/usr/app/oracle/oraInventory/logs/silentInstall2019-08-01_03-20-39PM.log' for more details.</p>
<p>As a root user, execute the following script(s):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. /usr/app/oracle/oraInventory/orainstRoot.sh<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. /usr/app/oracle/product/12/db_1/root.sh</p>
<p><br></p>
<p><font color="#ff0000" style="background-color: rgba(255, 255, 0, 1)">Successfully Setup Software.</font></p></div><p>等待结果,这样安装就成功完成了。</p><p>6、切换 root 用户,修改数据库配置</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:<span style="color: rgba(0, 128, 0, 1)">//&gt; /usr/app/oracle/oraInventory/orainstRoot.sh</span>
Changing permissions of /usr/app/oracle/oraInventory.
Adding <span style="color: rgba(0, 0, 255, 1)">read</span>,<span style="color: rgba(0, 0, 255, 1)">write</span> permissions <span style="color: rgba(0, 0, 255, 1)">for</span> group.
Removing <span style="color: rgba(0, 0, 255, 1)">read</span>,<span style="color: rgba(0, 0, 255, 1)">write</span>,execute permissions <span style="color: rgba(0, 0, 255, 1)">for</span> world.

Changing groupname of /usr/app/oracle/oraInventory to oinstall.
The execution of the script is complete.
jrxxfwb-zrgldb:<span style="color: rgba(0, 128, 0, 1)">//&gt; /usr/app/oracle/product/12/db_1/root.sh</span>
Check /usr/app/oracle/product/12/db_1/install/root_jrxxfwb-zrgldb_2019-08-01_15-29-54.<span style="color: rgba(0, 0, 255, 1)">log</span> <span style="color: rgba(0, 0, 255, 1)">for</span> the output of root script</pre></div><p><br></p></blockquote><blockquote><h3>F、数据库初始化</h3><p>1、使用 oracle 用户登录,修改用户环境变量</p><div class="cnblogs_code"><pre style="white-space: pre">export ORACLE_BASE=/usr/app/oracle
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/usr/app/oracle/product/12/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="<span style="color: rgba(139, 0, 0, 1)">zh_CN.UTF-8</span>"
export NLS_LANG="<span style="color: rgba(139, 0, 0, 1)">SIMPLIFIED CHINESE_CHINA.AL32UTF8</span>"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
</pre></div><p>使环境变量生效,执行命令:source .bash_profile</p><p><br></p><p>2、配置监听程序</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/home/oracle/&gt; netca /silent /responsefile /home/oracle/etc/netca.rsp
</pre></div><p><br></p><p>3、启动监听</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/home/oracle/&gt; lsnrctl start
LSNRCTL <span style="color: rgba(0, 0, 255, 1)">for</span> Linux: Version 12.1.0.2.0 - Production on 01-8月 -2019 15:47:15
Copyright (c) 1991, 2014, Oracle.All rights reserved.
</pre></div><p><br></p><p>4、静默建库文件修改,打开 dbca.rsp 文件。</p><p>vi ./etc/dbca.rsp</p><div class="cnblogs_code"><pre style="white-space: pre">#-----------------------------------------------------------------------------
# Name          : SID
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values: Check Oracle12c Administrator's Guide
# Default value : &lt;db_name&gt; specified in GDBNAME
# Mandatory   : No
#-----------------------------------------------------------------------------
SID = "<span style="color: rgba(139, 0, 0, 1)">orcl</span>"

#-----------------------------------------------------------------------------
# Name          : CHARACTERSET
# Datatype      : String
# Description   : Character set of the database
# Valid values: Check Oracle12c National Language Support Guide
# Default value : "<span style="color: rgba(139, 0, 0, 1)">US7ASCII</span>"
# Mandatory   : NO
#-----------------------------------------------------------------------------
CHARACTERSET = "<span style="color: rgba(139, 0, 0, 1)">AL32UTF8</span>"

#-----------------------------------------------------------------------------
# Name          : LISTENERS
# Datatype      : String
# Description   : Specifies list of listeners to <span style="color: rgba(0, 0, 255, 1)">register</span> the database with.
#               By <span style="color: rgba(0, 0, 255, 1)">default</span> the database is configured <span style="color: rgba(0, 0, 255, 1)">for</span> all the listeners specified in the
#               $ORACLE_HOME/network/admin/listener.ora
# Valid values: The list should be comma separated like "<span style="color: rgba(139, 0, 0, 1)">listener1,listener2</span>".
# Mandatory   : NO
#-----------------------------------------------------------------------------
LISTENERS = "<span style="color: rgba(139, 0, 0, 1)">LISTENERS</span>"</pre></div><p><br></p><p>5、执行静默建库</p><p>zrgldb:/home/oracle/&gt;&nbsp; dbca -silent -createDatabase&nbsp; -responseFile&nbsp; /home/oracle/etc/dbca.rsp<br>
输入 SYS 用户口令: <br>&nbsp; <br>
输入 SYSTEM 用户口令: <br>
<br>
复制数据库文件<br>
1% 已完成<br>
3% 已完成<br>
11% 已完成<br>
18% 已完成<br>
26% 已完成<br>
37% 已完成<br>
正在创建并启动 Oracle 实例<br>
40% 已完成<br>
45% 已完成<br>
50% 已完成<br>
55% 已完成<br>
56% 已完成<br>
60% 已完成<br>
62% 已完成<br>
正在进行数据库创建<br>
66% 已完成<br>
70% 已完成<br>
73% 已完成<br>
85% 已完成<br>
96% 已完成<br>
100% 已完成<br>
有关详细信息, 请参阅日志文件 "/usr/app/oracle/cfgtoollogs/dbca/orcl/orcl.log"。</p><p>建库完成了。</p><p><br></p><p>6、创建数据库应用用户并授权。</p><div class="cnblogs_code"><pre style="white-space: pre">zrgldb:/home/oracle/&gt; sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on 星期四 8月 1 16:45:33 2019

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


连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL&gt; create user starring identified by starring;

用户已创建。

SQL&gt; grant connect,resource,dba to starring;

授权成功。
</pre></div></blockquote><br><br>
来源:https://www.cnblogs.com/laramia/p/11283760.html
頁: [1]
查看完整版本: CentOS 7.X 静默安装Oracle 12C数据库