@clisdodo
2019-10-24T14:49:21.000000Z
字数 5333
阅读 2670
HUAWEIYUN
CentOS7.6
Oracle19c
Silent
AskScuti :搭建类 1-0-6 Oracle 19c 单实例文件系统静默安装
编辑 /etc/hosts
文件,IP在下面命令中被隐藏。
echo "x.x.x.x ecs-s6-medium-2-linux-20191021888888" >> /etc/hosts
echo "export LANG=en_US" >> ~/.bash_profile
华为云实验环境内存为2G,swap分区为2G * 2 = 4G
,物理内存对应swap大小规则参考值:
物理<8G swap=物理*2;
8<=物理<=16 swap=物理;
物理>16G swap=物理/2
dd if=/dev/zero of=/home/swap bs=1M count=4096
mkswap /home/swap
swapon /home/swap
free -h
获取交换分区UUID
blkid /home/swap
编辑 /etc/fstab
文件
vim /etc/fstab
,加入以下行内容
UUID=b8eb3f00-4ce3-4006-85fd-76a6971ce3bb swap swap defaults 0 0
/usr/sbin/groupadd -g 65431 oinstall
/usr/sbin/groupadd -g 65432 dba
/usr/sbin/groupadd -g 65433 oper
useradd -u 61001 -g oinstall -G dba,oper -m oracle
passwd oracle
mkdir /u01
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod -R 775 /u01
yum -y install autoconf
yum -y install automake
yum -y install binutils
yum -y install binutils-devel
yum -y install bison
yum -y install cpp
yum -y install dos2unix
yum -y install ftp
yum -y install gcc
yum -y install gcc-c++
yum -y install lrzsz
yum -y install python-devel
yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install compat-libstdc++-33.i686
yum -y install glibc-*
yum -y install glibc-*.i686
yum -y install libXpm-*.i686
yum -y install libXext
yum -y install libXext.i686
yum -y install libXtst
yum -y install libXtst.i686
yum -y install libX11
yum -y install libX11.i686
yum -y install libXau
yum -y install libXau.i686
yum -y install libxcb
yum -y install libxcb.i686
yum -y install libXi
yum -y install libXi.i686
yum -y install libstdc++.i686
yum -y install libstdc++-devel
yum -y install libstdc++-devel.i686
yum -y install libaio
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install ksh
yum -y install libXp
yum -y install libaio-devel
yum -y install numactl
yum -y install numactl-devel
yum -y install make -y
yum -y install sysstat -y
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core
yum -y install unzip
yum install -y libXrender
yum install -y libXrender-devel
yum install -y nfs-utils
yum install -y smartmontools
编辑 /etc/security/limits.conf
文件,内存大于8G需配置大内存页。
屏蔽内容
#* soft nofile 65535
#* hard nofile 65535
添加内容
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
#oracle hard memlock 8192000 (Memory larger than 8GB)
#oracle soft memlock 8192000 (Memory larger than 8GB)
echo "session required pam_limits.so" >> /etc/pam.d/login
编辑 /etc/sysctl.conf
文件
和内存大小相关的两个参数需要根据实际情况修改,修改建议请参考阿里云12cR2内核参数章节。
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 1932735283
kernel.shmall = 471859
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 = 1048586
kernel.panic_on_oops = 1
使之生效
sysctl -p
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
切换 oracle
用户
su - oracle
编辑 .bash_profile
vim .bash_profile
末尾添加以下行,注意换行问题
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_UNQNAME=cdb19c
ORACLE_SID=cdb19c; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
umask=022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
压缩包上传至 /soft
目录,用 oracle 用户进行解压,注意权限。
注意:从
oracle 18c
开始,必须把压缩文件解压到$ORACLE_HOME
里面,点我查看官方文档
chown -R oracle:oinstall /soft
chmod -R 775 /soft
su - oracle
cd $ORACLE_HOME
unzip -q /soft/19c-V982063-01.zip
静默安装参数定义请参考文件 $ORACLE_HOME/install/response/db_install.rsp
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
切换到 root
用户,依次执行下列两个脚本
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19.3.0/dbhome_1/root.sh
lsnrctl status
lsnrctl start
静默建库参数定义请参考文件 $ORACLE_HOME/assistants/dbca/dbca.rsp
或官方文档
dbca -silent -createDatabase -templateName General_Purpose.dbc \
-gdbname cdb19c \
-sid cdb19c \
-databaseConfigType SI \
-createAsContainerDatabase TRUE \
-numberOfPDBs 1 \
-pdbName sales \
-useLocalUndoForPDBs TRUE \
-pdbAdminPassword oracle \
-sysPassword oracle \
-systemPassword oracle \
-characterSet AL32UTF8 \
-memoryPercentage 30
sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Oct 23 13:02:21 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs