1. 下载相应的rpm包 我这边使用的主要有:
-rw-r--r-- 1 root root 19112 Apr 5 15:13 compat-libcap1-1.10-7.el7.x86_64.rpm -rw-r--r-- 1 root root 195388 Apr 5 15:15 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm -rw-r--r-- 1 root root 2694664264 Apr 5 17:16 oracle-database-ee-19c-1.0-1.x86_64.rpm -rw-r--r-- 1 root root 18204 Feb 14 2019 oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 194000 Apr 5 15:19 readline-6.2-11.el7.i686.rpm -rw-r--r-- 1 root root 121734 Apr 5 15:11 rlwrap-0.43-1.el7.x86_64.rpm-rw-r--r-- 1 root root 126276 Feb 10 02:40 rlwrap-0.43-5.el8.x86_64.rpm
2. 主要是oracle的包安装时会报错, 需要提前进行处理
发现preinstall 还有很多包没安装也就会报错需要安装其他的包
yum install -y gcc-c++ make yum install -y ksh yum install -y sysstat yum install -y xorg-x11-utils yum install java-11-openjdk-devel yum install -y libnsl rpm -ivh libaio-devel-0.3.110-12.el8.x86_64.rpm rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpmyum install libnsl-2.28-72.el8.i686
dnf install libnsl发现yum 有时候安装不成功 可以使用 dnf 来进行安装 https://www.cnblogs.com/askscuti/p/10984142.html以及需要设置一个兼容性设置
export CV_ASSUME_DISTID=RHEL7.6
之后可以进行安装, 为了防止digest失败可以使用如下命令
注意 需要先安装几个compat 开头的包然后安装rlwrap 可以避免输入命令总是出错.rpm -ivh oracle-database-ee-19c-1.0-1.x86_64.rpm --nodigest --nofiledigest
3. 设置字符集等
vim /etc/init.d/oracledb_ORCLCDB-19c export ORACLE_VERSION=19c export ORACLE_SID=ORA19C export TEMPLATE_NAME=General_Purpose.dbc export CHARSET=ZHS16GBK export PDB_NAME=ORA19CPDB export LISTENER_NAME=LISTENER export NUMBER_OF_PDBS=1 export CREATE_AS_CDB=true
4. 增加环境变量设置
可以与 SQL2019公用一个配置文件vim /etc/profile.d/db.shexport ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin export ORACLE_SID=ORA19C
5. 增加修改了 PID的配置文件信息
cd /etc/sysconfig/ scp oracledb_ORCLCDB-19c.conf oracledb_ORA19C-19c.conf
6. 进行设置
/etc/init.d/oracledb_ORCLCDB-19c configure可以进行设置密码 成功之后
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORA19C.
Database Information:
Global Database Name:ORA19C
System Identifier(SID):ORA19C
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORA19C/ORA19C.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user
等待较长时间即可 一般这一步不会出问题
7. 设置命令行别名
vim /etc/profile.d/db.sh alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman'
8. 设置开机自动启动
vim /etc/oratab 将里面 最后一句话设置从N 修改为Y 允许启动 ORA19C:/opt/oracle/product/19c/dbhome_1:Y 设置 Oracle启动命令vim /usr/bin/oracle.sh 增加的内容为: #! /bin/bash # script For oracle19c.service /opt/oracle/product/19c/dbhome_1/bin/lsnrctl start /opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1设置权限
chmod 777 /usr/bin/oracle.sh设置一个 systemd的服务
vim /etc/systemd/system/oracle19c.service增加内容为:
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/opt/oracle/product/19c/dbhome_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
设置服务自动启动
systemctl daemon-reload && systemctl enable oracle19c
9. 重启验证.
10. 发现centos8 上面 systemd 总是无法将oracle数据库拉起来..
没办法准备换用其他方式
将上面的 服务关掉 systemctl disable oracle19c 设置 开机自动启动的命令 chmod 777 /etc/rc.d/rc.local 设置命令 vim /etc/rc.d/rc.local 增加一行 /bin/su -u oracle -c /usr/bin/oracle.sh重启验证
来源:https://www.cnblogs.com/jinanxiaolaohu/p/12638175.html