Oracle Linux7.8 下离线 一键静默安装Oracle12c

目录安装前的准备最小安装OracleLinux7.8(centos7.8一样)安装oracle需要的依赖包准备Oracle安装包准备一键安装脚本 并执行脚本使用安装前配置问题及解决方法:错误码ORA-28040

之前下载centos8.2 来安装oracle12c 发现怎么都装不成功,最后发现
oracle官方Linux7 系列之支持oracle 最高版本到18c linux8系列 只有oracle 19c支持。故果断下载oracle linux 7.8(跟centos7.8安装类似 )
安装oracle12c

脚本为一键静默安装,因为考虑到服务器不能联网的特点,连同必须的rpm包一起打包,真正做到了【一键静默离线安装oracle12c!】

安装前的准备
最小安装OracleLinux7.8(centos7.8一样)

(文末附下载)
安装详细过程不做介绍,一步一步即可
主要选择软件包的时候,选择基本的开发环境包和兼容包即可。
Oracle Linux7.8 下离线 一键静默安装Oracle12c
Oracle Linux7.8 下离线 一键静默安装Oracle12c

安装oracle需要的依赖包

需要rmp包列表如下:(附下载)

binutils-2.27-43.base.0.1.el7_8.1.x86_64.rpm
compat-libstdc++-33-3.2.3-72.el7.i686.rpm
cpp-4.8.5-39.0.5.el7.x86_64.rpm
gcc-4.8.5-39.0.5.el7.x86_64.rpm
gcc-c++-4.8.5-39.0.5.el7.x86_64.rpm
gcc-gfortran-4.8.5-39.0.5.el7.x86_64.rpm
glibc-2.17-307.0.1.el7.1.i686.rpm
glibc-devel-2.17-307.0.1.el7.1.i686.rpm
gpm-libs-1.20.7-6.el7.x86_64.rpm
gssproxy-0.7.0-28.el7.x86_64.rpm
keyutils-1.5.8-3.el7.x86_64.rpm
ksh-20120801-142.0.1.el7.x86_64.rpm
libaio-0.3.109-13.el7.i686.rpm
libaio-devel-0.3.109-13.el7.i686.rpm
libaio-devel-0.3.109-13.el7.x86_64.rpm
libbasicobjects-0.1.1-32.el7.x86_64.rpm
libcollection-0.7.0-32.el7.x86_64.rpm
libevent-2.0.21-4.el7.x86_64.rpm
libgcc-4.8.5-39.0.5.el7.i686.rpm
libgcc-4.8.5-39.0.5.el7.x86_64.rpm
libgfortran-4.8.5-39.0.5.el7.x86_64.rpm
libgomp-4.8.5-39.0.5.el7.x86_64.rpm
libini_config-1.3.1-32.el7.x86_64.rpm
libnfsidmap-0.25-19.el7.x86_64.rpm
libpath_utils-0.2.1-32.el7.x86_64.rpm
libquadmath-4.8.5-39.0.5.el7.x86_64.rpm
libquadmath-devel-4.8.5-39.0.5.el7.x86_64.rpm
libref_array-0.1.5-32.el7.x86_64.rpm
libstdc++-4.8.5-39.0.5.el7.i686.rpm
libstdc++-4.8.5-39.0.5.el7.x86_64.rpm
libstdc++-devel-4.8.5-39.0.5.el7.i686.rpm
libstdc++-devel-4.8.5-39.0.5.el7.x86_64.rpm
libtirpc-0.2.4-0.16.el7.x86_64.rpm
libverto-libevent-0.2.5-4.el7.x86_64.rpm
libX11-1.6.7-2.el7.i686.rpm
libX11-1.6.7-2.el7.x86_64.rpm
libX11-common-1.6.7-2.el7.noarch.rpm
libXau-1.0.8-2.1.el7.i686.rpm
libXau-1.0.8-2.1.el7.x86_64.rpm
libxcb-1.13-1.el7.i686.rpm
libxcb-1.13-1.el7.x86_64.rpm
libXext-1.3.3-3.el7.i686.rpm
libXext-1.3.3-3.el7.x86_64.rpm
libXi-1.7.9-1.el7.i686.rpm
libXi-1.7.9-1.el7.x86_64.rpm
libXtst-1.2.3-1.el7.i686.rpm
libXtst-1.2.3-1.el7.x86_64.rpm
lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64.rpm
mailx-12.5-19.el7.x86_64.rpm
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
nfs-utils-1.3.0-0.66.0.1.el7_8.x86_64.rpm
nss-softokn-freebl-3.44.0-8.0.1.el7_7.i686.rpm
quota-4.01-19.el7.x86_64.rpm
quota-nls-4.01-19.el7.noarch.rpm
rpcbind-0.2.0-49.el7.x86_64.rpm
smartmontools-7.0-2.el7.x86_64.rpm
sysstat-10.1.5-19.el7.x86_64.rpm
tcp_wrappers-7.6-77.el7.x86_64.rpm
unixODBC-2.3.1-14.0.1.el7.x86_64.rpm
unixODBC-devel-2.3.1-14.0.1.el7.x86_64.rpm
vim-common-7.4.629-6.0.1.el7.x86_64.rpm
vim-enhanced-7.4.629-6.0.1.el7.x86_64.rpm
vim-filesystem-7.4.629-6.0.1.el7.x86_64.rpm
wget-1.14-18.el7_6.1.x86_64.rpm
zlib-1.2.7-18.el7.i686.rpm
zlib-devel-1.2.7-18.el7.i686.rpm
zlib-devel-1.2.7-18.el7.x86_64.rpm

这些依赖包下载后打包成oracle_pkg.tar 并放入/Data/soft文件夹下
本文已经将rmp打包完毕 直接下载即可使用。
oracle12c所需要的库文件下载

准备Oracle安装包

把Oracle12C原安装包"linuxx64_12201_database.zip" 放入 /Data/soft
这个linuxx64_12201_database.zip需要去oracle 官网下载即可
或者在网盘里下载
两个链接下载哪个都可以
下载链接1
下载链接2

准备一键安装脚本 并执行

一键安装脚本借鉴spdir大神的 https://github.com/spdir/oracle-single-install
并进行了修改,可以灵活自定义安装oracle的路径和源文件位置并支持不联网的情况下安装oracle12c

脚本使用安装前配置

root用户执行(尽量系统为纯净环境)

    安装前请将Oracle 12C安装包放置在/Data/soft目录下,如果是其他目录修改脚本中的softdir变量
    系统需要具备512MB的交换分区
    并配置以下信息
    本机IP地址 HostIP 设置改成自己的IP
    脚本是通过
HostIP=`ip a | grep ens32 | grep inet |awk '{print $2}'|cut -d / -f 1`

注意上面的ens32 是自己电脑的网卡名称,如果是eth0 或者其他名字请更换为正确的网卡名称。

Oracle用户密码 OracleUserPasswd 默认为oracle
Oracle数据库管理员密码 ORACLE_DB_PASSWD 默认为 Oracle#123
Oracle SID/ServerName SID 默认为 orcl12c
是否安装实例 IS_INSTANCE

0-不安装实例
1-安装单实例(默认)
2-安装cdb : 因为CDB在初始化过程中需要输入参数,需要手动初始化,具体步骤会在最后进行提示

设置单实例默认字符编码SINGLE_CHARSET

1-AL32UTF8
2-ZHS16GBK默认

选择配置静默安装配置文件的获取方式Get_Config_Method

0-远程
2-本地获取(默认)(脚本执行根目录下需要有conf目录存放配置文件)

db_install.rsp 数据库安装配置文件
dbca_single.rsp 数据库单实例初始化配置文件
initcdb.ora CDB初始化配置文件

脚本以及conf文件打包下载地址:
一键脚本以及配置文件下载
一键安装脚本部分内容:

#!/bin/bash
#oracle 12c
#local host ip

datadir=/Data
softdir=/Data/soft
HostIP=`ip a | grep ens32 | grep inet |awk '{print $2}'|cut -d / -f 1`

#oracle user password
OracleUserPasswd="oracle"
#default `systemOracle.com`
read -p "please enter the password you want to set for SYS,SYSMAN,SYSTEM&DBSNMP[at least 8 characters with digits, upper and lower case letters [default:Oracle#123]:" ORACLE_DB_PASSWD
if [ -z "$ORACLE_DB_PASSWD" ];then
ORACLE_DB_PASSWD="Oracle#123"
fi
#SID/SERVERNAME,default `orcl12c`
read -p "Please input oracle server SID[ex: orcl12c]: " SID
if [ -z "$SID" ];then
SID="orcl12c"
fi
# Install single instance choose charset
# 1-AL32UTF8(default), 2-ZHS16GBK
# Currently only supports single instance, does not support pdb
SINGLE_CHARSET='2'
# Install instance
#0-no,1-singleInstance,2-cdb
IS_INSTANCE='1'
# Choose configure file path
# 0-remote(default) 1-local
Get_Config_Method="1"
#---------------------------------------------------------------------------------#
#Global environment variable
if [[ ${SID} == "" ]];then
SID="oriedb"
fi
root_path=$softdir
response='/home/oracle/response'
MemTotle=$(grep -r 'MemTotal' /proc/meminfo | awk -F ' ' '{print int($2/1024/1024+1)}')
ORACLE_HOME=${datadir}/oracle/product/12.2.0/db_1
con_name="
sqlplus / as sysdba<< EOF
show con_name;
exit;
EOF
"
web_plugin="
sqlplus / as sysdba<< EOF
exec dbms_xdb_config.sethttpport(1522);
exit;
EOF
"
cdb_sql="
sqlplus / as sysdba<< EOF
shutdown abort;
create spfile from pfile='"$ORACLE_HOME/dbs/initcdb.ora"';
startup nomount;
CREATE DATABASE ${SID}
USER SYS IDENTIFIED BY pass
USER SYSTEM IDENTIFIED BY pass
LOGFILE GROUP 1 ('"${datadir}/oracle/oradata/${SID}/redo01a.log"','"${datadir}/oracle/oradata/${SID}/redo01b.log"')
SIZE 100M BLOCKSIZE 512,
GROUP 2 ('"${datadir}/oracle/oradata/${SID}/redo02a.log"','"${datadir}/oracle/oradata/${SID}/redo02b.log"')
SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '"${datadir}/oracle/oradata/${SID}/system01.dbf"' SIZE 700M
SYSAUX DATAFILE '"${datadir}/oracle/oradata/${SID}/sysaux01.dbf"' SIZE 550M
DEFAULT TABLESPACE deftbs
DATAFILE '"${datadir}/oracle/oradata/${SID}/deftbs01.dbf"' SIZE 500M
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '"${datadir}/oracle/oradata/${SID}/temp01.dbf"' SIZE 20M
UNDO TABLESPACE undotbs1
DATAFILE '"${datadir}/oracle/oradata/${SID}/undotbs01.dbf"' SIZE 200M
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT = ('"${datadir}/oracle/oradata/${SID}/"',
'${datadir}/oracle/oradata/pdbseed/')
SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M
USER_DATA TABLESPACE usertbs
DATAFILE '${datadir}/oracle/oradata/pdbseed/usertbs01.dbf' SIZE 200M;
exit
EOF
"

#Judgment parameter
function j_para() {
#判断必要参数是否存在
if [[ ${HostIP} == '' ]];then
echo -e "\033[34mInstallNotice >>\033[0m \033[31mPlease config HostIP\033[0m"
exit
fi
if [ -e $datadir ]
then
echo "The default installation directory for oracle[$datadir] already exists. Please specify a new installation directory to continue!"
read -p "Please input installation directory for oracle[Ex: /Data]: " datadir
if [ -z "$datadir" ];then
datadir="/Data"
fi
fi
mkdir $datadir && chmod 777 $datadir

#判断数据库包文件是否存在
if [ ! -f ${softdir}/linuxx64_12201_database.zip ]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[31mlinuxx64_12201_database.zip not found\033[0m"
exit
fi
if [[ ${Get_Config_Method} == "1" ]]; then
if [[ ${IS_INSTANCE} == '1' ]]; then
if [[ ! -f ${root_path}/conf/db_install.rsp || ! -f ${root_path}/conf/dbca_single.rsp ]]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[31m ./conf/db_install.rsp or ./conf/dbca_single.rsp file not found\033[0m"
exit
fi
elif [[ ${IS_INSTANCE} == '2' ]]; then
if [[ ! -f ${root_path}/conf/initcdb.ora ]]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[31m ./conf/initcdb.ora file not found\033[0m"
exit
fi
else
if [[ ! -f ${root_path}/conf/db_install.rsp ]]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[31m ./conf/db_install.rsp file not found\033[0m"
exit
fi
fi
fi
}

#install package
function install_package() {
if [[ ${Get_Config_Method} == "1" ]]; then
#判断包文件是否存在
if [ ! -f ${softdir}/oracle_pkg.tar ]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[31m oracle_pkg.tar not found\033[0m"
exit
fi
mkdir -p /Data/packages
mv ${softdir}/oracle_pkg.tar /Data/packages
cd /Data/packages #切换到目录
tar xvf oracle_pkg.tar #解压依赖包
yum localinstall *.rpm --nogpgcheck
else
yum install -y binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 glibc glibc.i686 \
glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libX11 libX11.i686 \
libXau libXau.i686 libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 \
libstdc++-devel libstdc++-devel.i686 libxcb libxcb.i686 make nfs-utils net-tools smartmontools sysstat \
unixODBC unixODBC-devel gcc gcc-c++ libXext libXext.i686 zlib-devel zlib-devel.i686 unzip wget vim epel-release
fi
}

#base_config
function base_config() {
dbhostname= ${HOSTNAME}_${HostIP##*.}
echo "${HostIP} ${dbhostname}" >> /etc/hosts
hostnamectl set-hostname dbhostname
ping -c 3 $HOSTNAME
#close selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
#close firewalld
systemctl stop firewalld && systemctl disable firewalld
#add user and group
groupadd oinstall && groupadd dba && groupadd oper && useradd -g oinstall -G dba,oper oracle \
&& echo "$OracleUserPasswd" | passwd oracle --stdin
#mkdir oracle need directory
orcl_home=$datadir
mkdir -p ${orcl_home}/oracle/product/12.2.0/db_1 && chmod -R 775 ${orcl_home}/oracle \
&& chown -R oracle:oinstall ${orcl_home}
#modify some file
echo 'fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
' >> /etc/sysctl.conf && sysctl -p
echo 'oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
' >> /etc/security/limits.d/20-nproc.conf
echo 'session required /lib64/security/pam_limits.so
session required pam_limits.so
' >> /etc/pam.d/login
echo 'if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
' >> /etc/profile
#add oracle environmental variable
echo '# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=DB
export ORACLE_UNQNAME=oriedb
export ORACLE_BASE=/data/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=oriedb
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
' > /tmp/oracleInstallTmp.txt

if [[ ${SID} != 'oriedb' ]];then
sed -i "s/oriedb/${SID}/g" /tmp/oracleInstallTmp.txt
fi
if [[ ${datadir} != '/data/app' ]];then
sed -i "s#/data/app#${datadir}#g" /tmp/oracleInstallTmp.txt
fi
if [[ ${dbhostname} != '=DB' ]];then
sed -i "s#=DB#=${dbhostname}#g" /tmp/oracleInstallTmp.txt
fi

cat /tmp/oracleInstallTmp.txt >> /home/oracle/.bash_profile && bash /home/oracle/.bash_profile
rm -rf /tmp/oracleInstallTmp.txt
}

#option oracle file
function oracle_file() {
#Decompression package
unzip ${softdir}/linuxx64_12201_database.zip -d ${softdir}
chown -R oracle:oinstall ${softdir}/database
#get install config file
mkdir -p ${response} && cd ${response}
# delete old config
rm -rf {db_install.rsp,dbca_single.rsp}
# get config method
if [[ ${Get_Config_Method} == "1" ]]; then
cp ${root_path}/conf/db_install.rsp .
cp ${root_path}/conf/dbca_single.rsp .
else
echo "ERROR,please put db_install.rsp &db_install.rsp in conf directory"
exit
fi
#modify config file
if [[ ${ORACLE_DB_PASSWD} != "" ]];then
sed -i "s/systemOracle.com/${ORACLE_DB_PASSWD}/g" dbca_single.rsp
fi
#option memory gt 4G
if [[ ${MemTotle} -gt 4 ]];then
sed -i 's/automaticMemoryManagement=true/automaticMemoryManagement=false/g' \
/home/oracle/response/dbca_single.rsp
fi
#modify config file `SID`
if [[ ${SID} != 'oriedb' ]];then
sed -i "s/oriedb/${SID}/g" db_install.rsp
sed -i "s/oriedb/${SID}/g" dbca_single.rsp
fi
if [[ ${datadir} != '/data/app' ]];then
sed -i "s#/data/app#${datadir}#g" db_install.rsp
sed -i "s#/data/app#${datadir}#g" dbca_single.rsp
fi
#modify oracle single instance default charset
if [[ ${SINGLE_CHARSET} == '2' ]]; then
sed -i 's/characterSet=AL32UTF8/characterSet=ZHS16GBK/g' dbca_single.rsp
fi
#copy config file to oracle home
cp ${softdir}/database/response/netca.rsp ${response}/netca.rsp
chown -R oracle:oinstall ${response}

echo -e "\n\nThis program uniformly sets the password for sys, system, sysman and DBSNMP accounts."
echo "User defines the following environment variables:"
echo ">> ORACLE_HOME is: $datadir/oracle/product/12.2.0/db_1"
echo ">> ORACLE_BASE is: $datadir/oracle"
echo ">> Database SID is: $SID"
echo ">> SYS&SYSMAN.. user's password is set: $ORACLE_DB_PASSWD "
read -p "Press Enter to continue ..."
}

#start install oracle software and start listen
function install_oracle() {
#start install oracle
oracle_out='/tmp/oracle.out'
su - oracle -c "${softdir}/database/runInstaller -force -silent -noconfig \
-responseFile ${response}/db_install.rsp -ignorePrereq" 1> ${oracle_out}
echo -e "\033[34mInstallNotice >>\033[0m \033[32moracle install starting \033[05m...\033[0m"
while true; do
grep '[FATAL] [INS-10101]' ${oracle_out} &> /dev/null
if [[ $? == 0 ]];then
echo -e "\033[34mInstallNotice >>\033[0m \033[31moracle start install has [ERROR]\033[0m"
cat ${oracle_out}
exit
fi
cat /tmp/oracle.out | grep sh
if [[ $? == 0 ]];then
`cat /tmp/oracle.out | grep sh | awk -F ' ' '{print $2}' | head -1`
if [[ $? == 0 ]]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[32mScript 1 run ok\033[0m"
else
echo -e "\033[34mInstallNotice >>\033[0m \033[31mScript 1 run faild\033[0m"
fi
`cat /tmp/oracle.out | grep sh | awk -F ' ' '{print $2}' | tail -1`
if [[ $? == 0 ]];then
echo -e "\033[34mInstallNotice >>\033[0m \033[32mScript 2 run ok\033[0m"
else
echo -e "\033[34mInstallNotice >>\033[0m \033[31mScript 2 run faild\033[0m"
fi
#start listen
echo -e "\033[34mInstallNotice >>\033[0m \033[32mOracle start listen \033[05m...\033[0m"
su - oracle -c "netca /silent /responsefile ${response}/netca.rsp"
netstat -anptu | grep 1521
if [[ $? == 0 ]]; then
echo -e "\033[34mInstallNotice >>\033[0m \033[32mOracle run listen\033[0m"
break
else
echo -e "\033[34mInstallNotice >>\033[0m \033[31mOracle no run listen\033[0m"
exit
fi
fi
done
}

#install oracle single instance
function single_instance() {
echo -e "\033[34mInstallNotice >>\033[0m \033[32mStart install single instance \033[05m...\033[0m"
#此安装过程会输入三次密码,超级管理员,管理员,库(这些密码也可以在配置文件中写)
su - oracle -c "dbca -silent -createDatabase -responseFile ${response}/dbca_single.rsp"
su - oracle -c "mkdir -p ${datadir}/oracle/oradata/${SID}/"
su - oracle -c "${con_name}" > /tmp/oracle.out1
su - oracle -c "${web_plugin}"
grep "${SID}" /tmp/oracle.out1
if [[ $? == 0 ]];then
echo -e "\033[34mInstallNotice >>\033[0m \033[32mOracle and instances install successful\033[0m"
finish
echo -e "\033[34mYou can visit (http://${HostIP}:1522/em) for web management.\033[0m"
else
echo -e "\033[34mInstallNotice >>\033[0m \033[31mOracle install successful,but instances init faild\033[0m"
fi
rm -rf /tmp/oracle.out1
exit
}

#install oracle cdb instance
function cdb_pdb() {
echo -e "\033[34mInstallNotice >>\033[0m \033[32mStart install CDB \033[05m...\033[0m"
INIT_CDB_FILE="${datadir}/oracle/product/12.2.0/db_1/dbs/initcdb.ora"
rm -rf ${INIT_CDB_FILE}
if [[ ${Get_Config_Method} == "1" ]]; then
cp ${root_path}/conf/initcdb.ora ${INIT_CDB_FILE}
else
wget https://raw.githubusercontent.com/spdir/oracle-single-install/master/conf/initcdb.ora -O ${INIT_CDB_FILE}
fi

if [[ ${SID} != 'oriedb' ]];then
sed -i "s/oriedb/${SID}/g" ${INIT_CDB_FILE}
fi
if [[ ${datadir} != '/data/app' ]];then
sed -i "s/\/data\/app/${datadir}/g" ${INIT_CDB_FILE}
fi
if [[ ${MemTotle} -gt 4 ]];then
cdb_mem=`expr ${MemTotle} / 3`
proc=`expr 150 \* ${cdb_mem}`
sed -i "s/memory_target=1G/memory_target=${cdb_mem}G/g" ${INIT_CDB_FILE}
sed -i "s/processes = 150/processes = ${proc}/g" ${INIT_CDB_FILE}
fi
chown -R oracle:oinstall ${INIT_CDB_FILE}
su - oracle -c "
mkdir -p ${datadir}/oracle/oradata/${SID}
mkdir -p ${datadir}/oracle/oradata/pdbseed
mkdir -p ${datadir}/oracle/admin/${SID}/adump
mkdir -p ${datadir}/oracle/fast_recovery_area
"
echo ${cdb_sql}
su - oracle -c "${cdb_sql}"
su - oracle -c "sed -i '35s/util/Util/g' ${datadir}/oracle/product/12.2.0/db_1/rdbms/admin/catcdb.pl"
echo -e '\033[42;31mFollow the steps to run the following commands\033[0m
\033[34m1. $ \033[32msu - oracle\033[0m\033[0m
\033[34m2. $ \033[32mcd ${datadir}/oracle/product/12.2.0/db_1/perl/lib/5.22.0/x86_64-linux-thread-multi/Hash/\033[0m\033[0m
\033[34m3. $ \033[32mexport PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin:$ORACLE_HOME/jdk/bin:$PATH\033[0m\033[0m
\033[34m4. $ \033[32msqlplus / as sysdba\033[0m\033[0m
\033[34m5. SQL > \033[32m@?/rdbms/admin/catcdb.sql\033[0m\033[0m
\033[34m Enter value for 1: \033[32m${datadir}/oracle/product/12.2.0/db_1/rdbms/admin\033[0m\033[0m
\033[34m Enter value for 2: \033[32m${datadir}/oracle/product/12.2.0/db_1/rdbms/admin/catcdb.pl\033[0m\033[0m
\033[34m Enter new password for SYS: \033[32msys user password\033[0m\033[0m
\033[34m Enter new password for SYSTEM: \033[32msystem user password\033[0m\033[0m
\033[34m Enter temporary tablespace name: \033[32mtablespace name\033[0m\033[0m
\033[34m6. SQL > \033[32mshow con_name;\033[0m\033[0m
\033[34m7. SQL > \033[32mshow pdbs;\033[0m\033[0m'
echo -e '\033[33mThe initialization process is relatively long. Please wait patiently.\033[0m'
echo -e '\033[33mCDB use reference: \033[34mhttps://www.cnblogs.com/zhichaoma/p/9328765.html\033[0m'
exit
}

#install oracle instance
function oracle_instance() {
#安装Oracle实例
if [[ ${IS_INSTANCE} == '1' ]]; then #install single instance
single_instance
elif [[ ${IS_INSTANCE} == '2' ]];then #install oracle cdb
cdb_pdb
else # not install instance
echo -e "\033[34mInstallNotice >>\033[0m \033[32mOracle install successful, but there are no instances of installation\033[0m"
exit
fi
}
function finish()
{
echo "Oracle install successful"
echo ">> ORACLE_HOME is: $datadir/oracle/product/12.2.0/db_1"
echo ">> ORACLE_BASE is: $datadir/oracle"
echo ">> Database SID is: $SID"
echo ">> SYS&SYSMAN.. user's password is set: $ORACLE_DB_PASSWD "
}

function main() {
j_para && \
install_package && \
base_config && \
oracle_file && \
install_oracle && \
oracle_instance
}

#run script
main

https://download.csdn.net/download/cuman/12820728
https://download.csdn.net/download/cuman/12820878
https://pan.baidu.com/s/1YvgmT0_Pm7y4O2XOxlFc3g

上面文件如果都下载好
服务器/Data/soft 目录完整文件应该为
Oracle Linux7.8 下离线 一键静默安装Oracle12c

cd /Data/soft
tar xvf oracleLinux7_install_oracle12c.tar
chmod +x oracleLinux7_install_oracle12c.sh
sh oracleLinux7_install_oracle12c.sh

脚本默认安装目录/Data

oracle安装包位置 /Data/soft

如果修改请修改 datadir和softdir的变量值。

脚本提示输入oracle 用户密码 默认Oracle#123

脚本提示输入SID 默认 orcl12c

本脚本在oracle linux 7.8 上验证通过。

附:

oracle Linux 7.8 下载地址:

oracle Linux 7.8 下载地址

问题及解决方法:

PLSQL无法链接的错误:

错误码ORA-28040

修改 $ORACLE_HOME\NETWORK\ADMIN\sqlnet.ora 文件,网上提供了两种版本的修改:

a、增加一行配置如下

SQLNET.ALLOWED_LOGON_VERSION=8

b、增加两行配置如下“

SQLNET.ALLOWED_LOGON_SERVER=8

SQLNET.ALLOWED_LOGON_CLIENT=8

错误码ORA-01017

#在 错误码ORA-28040之前创建的用户需要修改密码
sqlplus / as sysdba
alter user dbuserbasic identified by 123456;

原创:https://www.panoramacn.com
源码网提供WordPress源码,帝国CMS源码discuz源码,微信小程序,小说源码,杰奇源码,thinkphp源码,ecshop模板源码,微擎模板源码,dede源码,织梦源码等。

专业搭建小说网站,小说程序,杰奇系列,微信小说系列,app系列小说

Oracle Linux7.8 下离线 一键静默安装Oracle12c

免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。

您必须遵守我们的协议,如果您下载了该资源行为将被视为对《免责声明》全部内容的认可-> 联系客服 投诉资源
www.panoramacn.com资源全部来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。 敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:2640602276@qq.com
未经允许不得转载:书荒源码源码网每日更新网站源码模板! » Oracle Linux7.8 下离线 一键静默安装Oracle12c
关注我们小说电影免费看
关注我们,获取更多的全网素材资源,有趣有料!
120000+人已关注
分享到:
赞(0) 打赏

评论抢沙发

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

您的打赏就是我分享的动力!

支付宝扫一扫打赏

微信扫一扫打赏