rhel 7.9安装oracle 19.13

时间:2022-06-16 01:02:35
文档课题:rhel 7.9安装oracle 19.13.
1、安装准备
1.1、系统版本
# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Red Hat Enterprise Linux Server release 7.9 (Maipo)
1.2、SSH处理
--加快ssh访问.
# cp /etc/ssh/sshd_config /etc/ssh/sshd_config_`date +"%Y%m%d_%H%M%S"` && sed -i '/#LoginGraceTime 2m/ s/#LoginGraceTime 2m/LoginGraceTime 0/' /etc/ssh/sshd_config && grep LoginGraceTime /etc/ssh/sshd_config
# cp /etc/ssh/sshd_config /etc/ssh/sshd_config_`date +"%Y%m%d_%H%M%S"` && sed -i '/#UseDNS yes/ s/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config && grep UseDNS /etc/ssh/sshd_config
1.3、依赖包
1.3.1、挂载镜像源
# mount /dev/sr0 /mnt
1.3.2、配置yum源
# mkdir -p /etc/yum.repos.d/bak
# mv /etc/yum.repos.d/*.repo bak
# cat <<EOF>>/etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1
EOF
# yum makecache
1.3.3、安装依赖包
# yum install -y bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
elfutils-libelf \
elfutils-libelf-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
make \
net-tools \
nfs-utils \
smartmontools \
sysstat \
e2fsprogs \
e2fsprogs-libs \
fontconfig-devel \
expect \
unzip \
openssh-clients \
readline* \
tigervnc* \
iotop \
psmisc --skip-broken
1.3.4、上传依赖包
sftp> cd /tmp
sftp> lcd F:\package
sftp> put compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
1.3.5、检查依赖包
# rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline | grep "not installed"
1.4、防火墙
# systemctl status firewalld.service
# systemctl stop firewalld.service
# systemctl disable firewalld.service
1.5、禁用selinux
将SELINUX修改为disabled
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
注意:需重启主机,才能生效.
1.6、配置系统参数
--修改/etc/sysctl.conf文件.
# cat <<EOF>>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8181829631
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
net.ipv4.conf.ens33.rp_filter = 1
EOF
# /sbin/sysctl -p
1.7、用户与组
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -g oinstall -G dba,oper oracle
# echo oracle_4U |passwd --stdin oracle
1.8、安装目录
# mkdir -p /u01/app/oracle/product/19.13.0/db_1
# mkdir -p /u01/app/oraInventory
# chown -R oracle:oinstall /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oraInventory
# chmod -R 775 /u01
1.9、环境变量
# su - oracle
$ cat <<EOF>>.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.13.0/db_1
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
EOF
$ source .bash_profile
1.10、系统限制
# cat <<EOF>>/etc/security/limits.conf
oracle soft nproc 8192
oracle hard nproc 16384
oracle soft nofile 8192
oracle hard nofile 65536
oracle soft stack 10240
EOF
# cat <<EOF>>/etc/pam.d/login
session  required  /usr/lib64/security/pam_limits.so
EOF
2、安装包
2.1、上传文件
# mkdir -p /u01/setup/{db,RU,OPatch}
sftp> cd /u01/setup/db
sftp> lcd F:\installmedium\19c
sftp> put LINUX.X64_193000_db_home.zip
sftp> /u01/setup/RU
sftp> lcd F:\installmedium\19c\1913\19C211020\RU
sftp> put p33192793_190000_Linux-x86-64.zip
sftp> lcd F:\installmedium\19c\1913\19C211020\OPatch
sftp> cd /u01/setup/OPatch
sftp> put p6880880_190000_Linux-x86-64.zip
2.2、解压文件
说明:19C安装包需解压到对应ORACLE_HOME目录.
2.2.1、解压安装包
# chown -R oracle:oinstall /u01/setup
# su - oracle
$ pwd
/u01/setup/db
$ unzip -q LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
$ opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.
2.2.2、解压OPatch
[oracle@leo-oracle-1913 OPatch]$ pwd
/u01/setup/OPatch
[oracle@leo-oracle-1913 OPatch]$ unzip -q -o p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
[oracle@leo-oracle-1913 OPatch]$ opatch version
OPatch Version: 12.2.0.1.27

OPatch succeeded.
2.2.3、解压RU
[oracle@leo-oracle-1913 OPatch]$ cd ../RU
[oracle@leo-oracle-1913 RU]$ unzip -q p33192793_190000_Linux-x86-64.zip
[oracle@leo-oracle-1913 RU]$ ll
total 1379300
drwxr-xr-x. 5 oracle oinstall         81 Oct 15  2021 33192793
-rw-r--r--. 1 oracle oinstall 1411305781 Mar 25 10:38 p33192793_190000_Linux-x86-64.zip
-rw-rw-r--. 1 oracle oinstall    1093257 Oct 15  2021 PatchSearch.xml
3、安装软件
说明:
A、19C支持安装DB软件的同时打RU补丁.
B、安装前重启系统以及打开Xmanage以及.
3.1、图形界面安装
[oracle@leo-oracle-1913 db_1]$ cd $ORACLE_HOME
[oracle@leo-oracle-1913 db_1]$ export DISPLAY=192.168.133.1:0.0
[oracle@leo-oracle-1913 db_1]$ ./runInstaller -applyRU /u01/setup/RU/33192793
Preparing the home to patch...
Applying the patch /u01/setup/RU/33192793... 
注意:此处图形界面几分钟后才会出现.

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/oracle/product/19.13.0/db_1/root.sh

rhel 7.9安装oracle 19.13

3.2、检查补丁版本
$ opatch lspatches
33192793;Database Release Update : 19.13.0.0.211019 (33192793)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

$ sqlplus -version

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
4、创建实例
$ dbca

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

rhel 7.9安装oracle 19.13

5、查询信息
[oracle@leo-oracle-1913 db_1]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 25 12:26:23 2023
Version 19.13.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
SQL> select comp_id,status,version from dba_registry;

COMP_ID         STATUS     VERSION
--------------- ---------- ---------------
CATALOG         VALID      19.0.0.0.0
CATPROC         VALID      19.0.0.0.0
RAC             OPTION OFF 19.0.0.0.0
JAVAVM          VALID      19.0.0.0.0
XML             VALID      19.0.0.0.0
CATJAVA         VALID      19.0.0.0.0
APS             VALID      19.0.0.0.0
XDB             VALID      19.0.0.0.0
OWM             VALID      19.0.0.0.0
CONTEXT         VALID      19.0.0.0.0
ORDIM           VALID      19.0.0.0.0

COMP_ID         STATUS     VERSION
--------------- ---------- ---------------
SDO             VALID      19.0.0.0.0
XOQ             VALID      19.0.0.0.0
OLS             VALID      19.0.0.0.0
DV              VALID      19.0.0.0.0

15 rows selected.
SQL> select banner_full from v$version;
BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ----------
orcl             OPEN
SQL> r
  1  select 'datafile' file_type,file#,name FILE_NAME,status,enabled from v$datafile
  2  union all
  3  select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
  4  union all
  5  select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
  6  union all
  7* select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile

FILE_TYPE        FILE# FILE_NAME                                               STATUS     ENABLED
----------- ---------- ------------------------------------------------------- ---------- ----------
datafile             1 /u01/app/oracle/oradata/ORCL/system01.dbf               SYSTEM     READ WRITE
datafile             3 /u01/app/oracle/oradata/ORCL/sysaux01.dbf               ONLINE     READ WRITE
datafile             4 /u01/app/oracle/oradata/ORCL/undotbs01.dbf              ONLINE     READ WRITE
datafile             7 /u01/app/oracle/oradata/ORCL/users01.dbf                ONLINE     READ WRITE
tempfile             1 /u01/app/oracle/oradata/ORCL/temp01.dbf                 ONLINE     READ WRITE
logfile              3 /u01/app/oracle/oradata/ORCL/redo03.log
logfile              2 /u01/app/oracle/oradata/ORCL/redo02.log
logfile              1 /u01/app/oracle/oradata/ORCL/redo01.log
controlfile            /u01/app/oracle/oradata/ORCL/control01.ctl
controlfile            /u01/app/oracle/fast_recovery_area/ORCL/control02.ctl

10 rows selected.