CentOS8安装Oracle datebase 19C
我这里安装Oracle数据库是rpm格式的包。需要先得有以下依赖包关系,先依次按此顺序安装。
yum install ./compat-libcap1-1.10-7.el7.x86_64.rpm
yum install ./compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
yum install ./oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
如果找不到依赖关系包,可以在(https://pkgs.org/)进行查找
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.rpm
yum install libnsl-2.28-72.el8.i686
dnf install libnsl
这些包也是需要进行安装的,若yum无法使用时,可以使用dnf进行安装。
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
设置字符集
vim /etc/profile.d/db.sh
cat /etc/profile.d/db.sh
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=ORA19C
新增变量环境
同时进行初始化一下,执行后等待较长时间即可 一般这一步不会出问题
[root@localhost ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.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.
看到100% complete 即可完成
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
把N设置为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