一、环境准备
1 划分磁盘
2 用户、目录创建
3 系统参数及环境变量配置
4 依赖包安装、oracle软件下载
5 开始安装
6 安装完成,测试
1.1 划分磁盘
[root@ora19c ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x5554dbd5 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
分区号 (1-4,默认 1):
起始 扇区 (2048-83886079,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-83886079,默认为 83886079):
将使用默认值 83886079
分区 1 已设置为 Linux 类型,大小设为 40 GiB
命令(输入 m 获取帮助):
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@ora19c ~]# partprobe /dev/sdb
[root@ora19c ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@ora19c ~]# vgcreate vg_ora /dev/sdb1
Volume group "vg_ora" successfully created
[root@ora19c ~]# lvcreate -l +100%free -n lv_ora vg_ora
Logical volume "lv_ora" created.
[root@ora19c ~]# mkfs.xfs /dev/mapper/vg_ora-lv_ora
meta-data=/dev/mapper/vg_ora-lv_ora isize=512 agcount=4, agsize=2621184 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=10484736, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=5119, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@ora19c ~]# mkdir /oracle
[root@ora19c ~]# mount /dev/mapper/vg_ora-lv_ora /oracle
[root@ora19c ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 12M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 26G 1.3G 25G 5% /
/dev/sda1 1014M 150M 865M 15% /boot
tmpfs 378M 0 378M 0% /run/user/0
/dev/mapper/vg_ora-lv_ora 40G 33M 40G 1% /oracle
[root@ora19c ~]# vi /etc/fstab
[root@ora19c ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri May 26 19:12:57 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=161b9873-75fe-40c1-8a5d-da9e4b3f5460 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/mapper/vg_ora-lv_ora /oracle xfs defaults 0 0
[root@ora19c ~]#
1.2 用户、目录创建
groupadd -g 10023 oinstall
groupadd -g 10024 dba
useradd -u 10025 -g oinstall -G dba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
echo "test" | passwd --stdin oracle
mkdir -p /oracle/app/db && mkdir -p /oracle/app/19.3.0/db_1
chown -R oracle:oinstall /oracle
chmod -R 755 /oracle
chmod -R 777 /oracle/soft
1.3 系统参数及环境变量配置
#disable firewalld
systemctl stop firewalld && systemctl disable firewalld
#disable selinux
sed -i "/^SELINUX=/s#enforcing#disabled#" /etc/selinux/config
#config NOZEROCONF
cat “NOZEROCONF=yes” >> /etc/sysconfig/network
#disable avahi
systemctl stop avahi-dnsconfd && systemctl stop avahi-daemon
systemctl disable avahi-dnsconfd && systemctl disable avahi-daemon
echo "192.168.111.201 ora19c" >>/etc/hosts
sysctl.conf参数调整
shmall 物理内存/4
shmmax 物理内存*0.8*1024
SHMALL=`awk '($1 == "MemTotal:"){print $2/4}' /proc/meminfo`
SHMMAX=`awk '/MemTotal/{printf("%1.0f\n",$2*0.8*1024)}' /proc/meminfo`
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall =
kernel.shmmax =
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
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
vm.min_free_kbytes=524288
kernel.panic_on_oops = 1
limits.conf参数配置
memlock物理内存/2
MEMLOCK=`awk '/MemTotal/{printf("%1.0f\n",$2/2.0)}' /proc/meminfo`
cat /etc/security/limits.conf
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft memlock
oracle hard memlock
oracle soft stack 65536
oracle hard stack 32768
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 65536
grid hard nofile 65536
grid soft stack 65536
grid hard stack 32768
cat << EOF >> /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF
cat << EOF >> /etc/profile
if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
cat << EOF >> /home/oracle/.bash_profile
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=TESTCDB
export ORACLE_BASE=/oracle/app
export ORACLE_HOME=/oracle/app/19.3.0/db_1
export ORACLE_UNQNAME=
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_TERM=xterm
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/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export EDITOR=vi
export LANG=en_US
export NLS_LANG=american_america.AL32UTF8
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
umask 022
1.4 依赖包安装、oracle软件下载
yum install -y bc \
gcc-c++ \
binutils \
compat-libcap1 \
elfutils-libelf \
elfutils-libelf-devel \
fontconfig-devel \
glibc \
glibc-devel \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
make \
net-tools \
nfs-utils \
smartmontools \
sysstat \
expect \
psmisc \
unzip \
zip
rpm -ivh compat-libstdc++-33-3.2.3-47.3.x86_64.rpm
rpm -ivh pdksh-5.2.14-37.el5.x86_64.rpm
注:软件包自行在官网上下载
1.5 开始安装
解压oracle软件包
su - oracle -c "unzip -qo db_home_193_V982063-01.zip -d $ORACLE_HOME"
开始安装软件
su - oracle -c "$ORACLE_HOME/runInstaller -silent -force -noconfig -ignoreInternalDriverError -ignorePrereq \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/oracle/app/oraInventory \
ORACLE_BASE=/oracle/app/db \
ORACLE_HOME=/oracle/app/19.3.0/db_1 \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oinstall \
oracle.install.db.OSBACKUPDBA_GROUP=oinstall \
oracle.install.db.OSDGDBA_GROUP=oinstall \
oracle.install.db.OSKMDBA_GROUP=oinstall \
oracle.install.db.OSRACDBA_GROUP=oinstall \
oracle.install.db.rootconfig.executeRootScript=false "
注:执行成功后会有需要root用户执行的脚本,root用户执行完后即可。
开始建库
su - oracle -c "
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-responseFile NO_VALUE \
-gdbname TESTCDB -sid TESTCDB \
-createAsContainerDatabase TRUE \
-numberOfPDBs 1 \
-pdbName TESTPDB \
-pdbAdminPassword Oracle_9999 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-memoryPercentage 70 \
-redoLogFileSize 200 \
-sysPassword Oracle_9999 -systemPassword Oracle_9999 \
-datafileDestination {ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/ \
-recoveryAreaDestination {ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME} \
-storageType FS \
-characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \
-emConfiguration NONE"
创建监听
su - oracle -c “netca -silent -responseFile $ORACLE_HOME/assistants/netca/netca.rsp -instype custom -listener LISTENER -lisport 1526”
1.6 6 安装完成,测试
select open_mode from v$database;