溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

VMware下CentOS靜默安裝oracle的方法

發(fā)布時間:2022-04-12 16:06:16 來源:億速云 閱讀:151 作者:iii 欄目:編程語言

今天小編給大家分享一下VMware下CentOS靜默安裝oracle的方法的相關知識點,內容詳細,邏輯清晰,相信大部分人都還太了解這方面的知識,所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

環(huán)境準備:

vmware+centos,jdk

一、校驗系統(tǒng)磁盤大小

1.命令 df -h

保證可用磁盤大小15gb(包括oracle安裝時需要空間7.5gb + oracle安裝zip包接近3g+安裝包解壓文件3g)

VMware下CentOS靜默安裝oracle的方法

如果磁盤不滿足,安裝會失敗,需要擴容!

二、安裝準備

1.創(chuàng)建運行oracle數據庫的系統(tǒng)用戶和用戶組

groupadd oinstall
groupadd dba
useradd -g oinstall -g dba -m oracle

passwd oracle #不用管提示,連續(xù)輸入兩次密碼就可成功

VMware下CentOS靜默安裝oracle的方法

2.創(chuàng)建oracle數據庫安裝目錄,并將目錄賦權給oracle用戶

mkdir -p /opt/oracle/database #oracle安裝包解壓的文件
mkdir -p /opt/oracle/product/orainventory #
mkdir -p /opt/oracle/product/12.2.0/db_1 #oracle安裝目錄
chown -r oracle:oinstall /opt/oracle #更改oracle目錄的屬主
chmod 755 -r /opt/oracle #更改oracle目錄的權限

VMware下CentOS靜默安裝oracle的方法

3.安裝oracle數據庫依賴的軟件包

3.1.安裝

yum -y install 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 numactl-devel glibc-headers

3.2.查看是否安裝成功

rpm -q \binutils \compat-libstdc++-33 \elfutils-libelf \elfutils-libelf-devel \expat \gcc \gcc-c++ \glibc \glibc-common \glibc-devel \glibc-headers \libaio \libaio-devel \libgcc \libstdc++ \libstdc++-devel \make \pdksh \sysstat \unixodbc \unixodbc-devel | grep "not installed"

VMware下CentOS靜默安裝oracle的方法

4.關閉selinux,需要重啟生效(可以在最后安裝oracle之前再重啟) vim /etc/selinux/config

VMware下CentOS靜默安裝oracle的方法

5.修改內核參數 vim /etc/sysctl.conf

添加如下內容:

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

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 = 262144

net.core.rmem_max= 4194304

net.core.wmem_default= 262144

net.core.wmem_max= 1048576

VMware下CentOS靜默安裝oracle的方法

sysctl  -p #使配置生效

VMware下CentOS靜默安裝oracle的方法

6.對oracle用戶設置限制,提高系統(tǒng)運行性能

vim /etc/security/limits.conf

添加如下內容:

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

VMware下CentOS靜默安裝oracle的方法

7.配置用戶環(huán)境變量

vim /home/oracle/.bash_profile

添加如下內容:

export oracle_base=/opt/oracle

export oracle_home=$oracle_base/product/12.2.0/db_1

export oracle_sid=orcl

export oracle_term=xterm

export path=$oracle_home/bin:/usr/sbin:$path

export ld_library_path=$oracle_home/lib:/lib:/usr/lib

export

export nls_lang=american_america.zhs16gbk

VMware下CentOS靜默安裝oracle的方法

source /home/oracle/.bash_profile #使配置失效

8.解壓oracle安裝文件的壓縮包,在/opt/oracle/目錄下解壓

unzip 文件名(unzip不存在,可用命令進行安裝: yum install unzip)加壓較慢,需要等會

VMware下CentOS靜默安裝oracle的方法

9.配置應答文件

vim /opt/oracle/database/response/db_install.rsp

10.配置orainventory目錄位置

存放oracle軟件安裝的目錄信息,oracle的安裝和升級都需要用到這個目錄(最好放在oracle_base對應的目錄下邊)

vim /etc/orainst.loc

添加或修改成如下內容:

inventory_loc=/opt/oracle/product/orainventory

inst_group=oinstall

VMware下CentOS靜默安裝oracle的方法

11.重啟centos,reboot

12.關閉防火墻,systemctl stop firewalld

三、靜默安裝oracle12

1.已oracle用戶登陸linux系統(tǒng)

2.靜默安裝

/opt/oracle/database/runinstaller -silent -force -ignoreprereq -responsefile /opt/oracle/database/response/db_install.rsp

執(zhí)行過程需要等待幾分鐘。

VMware下CentOS靜默安裝oracle的方法

可監(jiān)控日志:

tail -f
/opt/oracle/product/orainventory/logs/installactions2018-11-22_11-04-03am.log

VMware下CentOS靜默安裝oracle的方法

3.切換root用戶登陸

4.執(zhí)行兩個sh文件

4.1. sh /opt/oracle/product/orainventory/orainstroot.sh

VMware下CentOS靜默安裝oracle的方法

如果目錄下沒有改腳本,可以新建一個,腳本內容為:

# cat /oracle/orainventory/orainstroot.sh

#!/bin/sh

awk=/bin/awk

chmod=/bin/chmod

chgrp=/bin/chgrp

cp=/bin/cp

echo=/bin/echo

mkdir=/bin/mkdir

ruid=`/usr/bin/id|$awk -f ′ print$2 ′ |$awk?f ′print$2′|$awk?f '{print $2}'|$awk -f '{print $1}'`

if [ ${ruid} != "root" ];then

  $echo "this script must be executed as root"

  exit 1

fi

if [ -d "/etc" ]; then

$chmod 755 /etc;

else

$mkdir -p /etc;

fi

if [ -f "/oracle/orainventory/orainst.loc" ]; then

$cp /oracle/orainventory/orainst.loc /etc/orainst.loc;

$chmod 644 /etc/orainst.loc

else

invptr=/etc/orainst.loc

invloc=/oracle/orainventory

grp=oinstall

ptrdir="`dirname $invptr`";

# create the software inventory location pointer file

if [ ! -d "$ptrdir" ]; then

 $mkdir -p $ptrdir;

fi

$echo "creating the oracle inventory pointer file ($invptr)";

$echo  inventory_loc=$invloc > $invptr

$echo  inst_group=$grp >> $invptr

chmod 644 $invptr

# create the inventory directory if it doesn't exist

if [ ! -d "$invloc" ];then

 $echo "creating the oracle inventory directory ($invloc)";

 $mkdir -p $invloc;

fi

fi

$echo "changing permissions of /oracle/orainventory.

adding read,write permissions for group.

removing read,write,execute permissions for world.

";

$chmod -r g+rw,o-rwx /oracle/orainventory;

if [ $? != 0 ]; then

 $echo "oui-35086:warning: chmod of /oracle/orainventory

adding read,write permissions for group.

,removing read,write,execute permissions for world.

 failed!";

fi

$echo "changing groupname of /oracle/orainventory to oinstall.";

$chgrp -r oinstall /oracle/orainventory;

if [ $? != 0 ]; then

 $echo "oui-10057:warning: chgrp of /oracle/orainventory to oinstall failed!";

fi

$echo "the execution of the script is complete."

4.2. sh /opt/oracle/product/12.2.0/db_1/root.sh

VMware下CentOS靜默安裝oracle的方法

5.切換oracle用戶登陸

6.安裝監(jiān)聽

$oracle_home/bin/netca /silent /responsefile /opt/oracle/database/response/netca.rsp

VMware下CentOS靜默安裝oracle的方法

7.啟動監(jiān)聽程序

lsnrctl start

VMware下CentOS靜默安裝oracle的方法

8.查看監(jiān)聽狀態(tài)

lsnrctl status

VMware下CentOS靜默安裝oracle的方法

9.通過dbca創(chuàng)建數據庫

/opt/oracle/product/12.2.0/db_1/bin/dbca -silent -createdatabase -templatename general_purpose.dbc -gdbname orcl -sid orcl -responsefile no_value -characterset zhs16gbk -memorypercentage 30 -emconfiguration local

(刪除:dbca -silent -deletedatabase -sourcedb orcl -sid orcl)

10.啟動實例(創(chuàng)建完,一般會自動啟動)

sqlplus / as sysdba
sql> startup
sql> select instance_name,version from v$instance;

查看數據庫文件dbf

sql> select name from v$datafile;

以上就是“VMware下CentOS靜默安裝oracle的方法”這篇文章的所有內容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI