一、下载rpm包
oracle-database-ee-19c-1.0-1.x86_64.rpm
下载页面链接: https://www.oracle.com/cn/database/technologies/oracle-database-software-downloads.html#19c
二、安装前准备
2.1 添加yum源及安装oracle数据库前配置(对应自己的版本)
##OL7
curl https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 > /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
cat > /etc/yum.repos.d/oracle-linux-ol7.repo <<"EOF"
[ol7_baseos_latest]
name=Oracle Linux 7 BaseOS Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF
##OL8
curl https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8 > /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
cat > /etc/yum.repos.d/oracle-linux-ol8.repo <<"EOF"
[ol8_baseos_latest]
name=Oracle Linux 8 BaseOS Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[ol8_appstream]
name=Oracle Linux 8 Application Stream Packages ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF
##OL9
curl https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 > /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
cat > /etc/yum.repos.d/oracle-linux-ol9.repo <<"EOF"
[ol9_baseos_latest]
name=Oracle Linux 9 BaseOS Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[ol9_appstream]
name=Oracle Linux 9 Application Stream Packages ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/appstream/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF
yum clean all &> /dev/null
yum makecache &> /dev/null
yum -y install oracle-database-preinstall-19c.x86_64
2.2 安装依赖包(正常不需要,有问题可以参考)
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm
yum -y localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm compat-libcap1-1.10-7.el7.x86_64.rpm
yum -y install bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libgcc libnsl librdmacm-devel libstdc++ libstdc++-devel libX11 libXau libxcb libXi libXrender libXrender-devel libXtst make net-tools nfs-utils python3 python3-configshell python3-rtslib python3-six smartmontools sysstat targetcli unzip
三、安装数据库
yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
四、初始化数据库
可以根据需要更改配置/etc/init.d/oracledb_ORCLCDB-19c
/etc/init.d/oracledb_ORCLCDB-19c configure
五、配置oracle用户
5.1 修改oracle用户密码
echo 'oracle:oraclepwd' | chpasswd
5.2 为oracle用户添加环境变量
路径按照自己的修改,我用的默认路径
su - oracle
cat >> .bash_profile <<"EOF"
#ORACLE-ENV
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export NLS_LANG=AMERICAN_AMERICA.UTF8
#alias sqlplus='rlwrap sqlplus'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export NLS_DATE_FORMAT='yyyy-MM-dd hh24:mi:ss'
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export PATH
EOF
六、错误问题及解决方法参考链接
https://www.modb.pro/db/224513?utm_source=index_ai
https://blog.csdn.net/LDaMin/article/details/131907382
oracle安装手册
https://yum.oracle.com/
七、oracle轻量级客户端下载
https://www.oracle.com/cn/database/technologies/instant-client/winx64-64-downloads.html