一、部署环境
Oracle Linux 9.4
Oracle Database 23ai Free
二、Oracle Linux 9.X创建本地Yum/DNF仓库
创建本地 Yum/DNF 资源库的先决条件: 1)挂载 Oracle Linux 9 ISO 文件或 DVD
我们假设 RHEL 9 iso 文件已经被复制到系统中。
运行下面的挂载命令,将 ISO 文件挂载到/opt/repo文件夹。
mount -o loop OL-9-4-0-BaseOS-x86_64-dvd.iso
/run/media/root/OL-9-4-0-BaseOS-x86_64
或者 mount -o loop rhel-baseos-9.0-x86_64-dvd.iso /var/repo/
vi /etc/yum.repos.d/oracle-linux-ol9.repo
[Local-BaseOS]
name=Red Hat Enterprise Linux 9 - BaseOS
enabled=1
gpgcheck=0
baseurl=file:///run/media/root/OL-9-4-0-BaseOS-x86_64/BaseOS/
[Local-AppStream] name=Red Hat Enterprise Linux 9 - AppStream
enabled=1
gpgcheck=0
baseurl=file:///run/media/root/OL-9-4-0-BaseOS-x86_64/AppStream/
刷新 Yum/DNF 和订阅管理器的缓存
查看当前的 DNF 配置 /etc/dnf/dnf.conf 文件中的 [main] 部分仅包含已明确设置的设置。但是,您可以显示 [main] 部分的所有设置,包括尚未设置的部分,因此请使用它们的默认值。
显示全局 DNF 配置:
dnf config-manager --dump
执行以下命令来清理 Yum 或 DNF 和订阅管理器的缓存。
dnf clean all 列出系统上所有启用的存储库 dnf repolist
列出软件包 dnf list --all 用 dnf 命令通过上面配置的本地仓库安装软件包。 要显示所有可用的软件包,包括版本号和架构,请输入 dnf repoquery
dnf install -y nfs-utils
使用sudo作为root登录。
sudo -s
Oracle Linux 9.4
三、Oracle Database 23ai Free部署
转到Oracle yum网站:
https://yum.oracle.com/repo/oraclelinux/ol9/appstream/x86_64/
下载最新的23AI甲骨文数据库预启动rpm。例如,oracle-database-preinstall-23ai-1.0-2.el9.x86_64.rpm 安装Oracle数据库预启动RPM
使用root用户执行
# dnf install -y oracle-database-preinstall-23ai-1.0-2.el9.x86_64.rpm
Oracle数据库预启动RPM会自动创建Oracle安装所有者和组。它还根据Oracle数据库安装的要求设置其他内核配置设置。如果您打算使用工作角色分离,请根据您的要求创建扩展的数据库用户和组。 如果您想要-y选项。 dnf跳过包装确认提示,请使用
安装数据库软件 # dnf -y install oracle-database-free-23ai-1.0-1.el9.x86_64.rpm
Run the service configuration script: export DB_PASSWORD=oracle (echo "${DB_PASSWORD}"; echo "${DB_PASSWORD}";) | /etc/init.d/oracle-free-23ai configure
也可以使用脚本
#!/bin/bash yum -y install /downloads/oracle-database-free-23ai-1.0-1.el9.x86_64.rpm > /free_logs/FREEsilentinstall.log 2>&1 /etc/init.d/oracle-free-23ai configure >> /free_logs/FREEsilentinstall.log 2>&1
创建和配置数据库
Alternatively, you can enter the password in the script, such as: (echo "password"; echo "password";) | /etc/init.d/oracle-free-23ai configure >> /free_logs/FREEsilentinstall.log 2>&1
或者
/etc/init.d/oracle-free-23ai configure
oracle-free-23ai部署默认目录说明
| File Name and Location | Purpose |
|---|---|
/opt/oracle | Oracle base. This is the root of the Oracle Database Free directory tree. |
/opt/oracle/product/23ai/dbhomeFree | Oracle home. This home is where the Oracle Database Free is installed. It contains the directories of the Oracle Database Free executables and network files. |
/opt/oracle/oradata/FREE | Database files. |
/opt/oracle/diag subdirectories | Diagnostic logs. The database alert log is /opt/oracle/diag/rdbms/free/FREE/trace/alert_FREE.log |
/opt/oracle/cfgtoollogs/dbca/FREE | Database creation logs. The FREE.log file contains the results of the database creation script execution. |
/etc/sysconfig/oracle-free-23ai.conf | Configuration default parameters. |
/etc/init.d/oracle-free-23ai | Configuration and services script. |
配置环境变量 vi /home/oracle/.bash_profile
export ORACLE_SID=FREE
export ORAENV_ASK=NO . /opt/oracle/product/23ai/dbhomeFree/bin/oraenv
使用Oracle用户来连接数据库
export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree export PATH=$ORACLE_HOME/bin:$PATH
登录连接数据库
$ sqlplus / as sysdba
查看监听状态
$ lsnrctl status
-- 连接CDB数据库
sqlplus sys/SysPassword1@//localhost:1521/free as sysdba
-- 连接PDB数据库
sqlplus sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
数据库关闭和启动 # /etc/init.d/oracle-free-23ai stop # /etc/init.d/oracle-free-23ai start
# /etc/init.d/oracle-free-23ai status
跟随系统启动和停止配置
# systemctl daemon-reload
# systemctl enable oracle-free-23ai
# systemctl start oracle-free-23ai
# systemctl stop oracle-free-23ai
# systemctl restart oracle-free-23ai




