暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

Oracle 23AI 安装--docker和rpm哪种方式更趁手?

原创 听见风的声音 2025-07-07
415

1 Oracle 23AI数据库

Oracle 23AI的版本更新比较快,最新的版本已经是23.8了,看了一下这个版本更新内容,主要集中在AI 向量和json两个方面,这篇文章介绍了如何使用容器和rpm包快速安装Oracle 23AI 版本23.8.0.25.04,记录了容器方式下启动Oracle 23AI遇到的一个小问题及解决的过程,Oracle 23AI支持的安装方式和安装说明都在下面这个链接
Oracle Database Free 版本快速入门

2 使用容器快速部署

2.1 拉取Oracle 23AI官方镜像
root@dbsrv1:~# docker pull container-registry.oracle.com/database/free:latest latest: Pulling from database/free 67273d20686c: Pull complete fb5a2405efd1: Pull complete . . . 1ed5527365e9: Pull complete 9339d36e49cd: Pull complete Digest: sha256:ecdf62eb92efa19122f55322423ceaaa519027ca7ea1bde8f95ce43c3dbabd91 Status: Downloaded newer image for container-registry.oracle.com/database/free:latest container-registry.oracle.com/database/free:latest

查看拉取的影响
root@dbsrv1:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
container-registry.oracle.com/database/free latest 98201d89c4b3 2 months ago 9.62GB

2.2 使用容器快速启动数据库

下面的命令启动一个Oracle 23AI数据库,指定Oracle sys、system的密码(-e ORACLE_PWD=),将Oracle的数据目录映射到主机目录上(-v)选项,这里应该注意指定的主机目录的权限,容器内的Unix用户 “oracle” (uid: 54321)必须对这个目录有写权限。

root@dbsrv1:~# docker run -d --name oracle23ai \ -e ORACLE_PWD=******** \ -v /oradata:/opt/oracle/oradata \ 98201d89c4b3 3715f675c251e6075b629beb38253f3add63bfa04a7aa7640ffd25114bb5a1c5

查看创建的容器

root@dbsrv1:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3715f675c251 98201d89c4b3 "/bin/bash -c $ORACL…" 5 seconds ago Up 4 seconds (health: starting) 1521/tcp oracle23ai

容器的状态处于health: starting状态,正在启动数据库。这个容器创建后,容器一直处于health: starting状态,数据库的启动可能除了问题,这种情况下可以进入到容器中检查数据库的告警日志,也可以使用docker logs 命令查看容器的运行日志。

root@dbsrv1:~# docker logs -f oracle23ai Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration succeeded. Configuring Oracle Database FREE. [WARNING] [DBT-11205] Specified shared pool size does not meet the recommended minimum size requirement. This might cause database creation to fail. ACTION: Specify at least (496 MB) for shared pool size. Enter SYS user password: ******** Enter SYSTEM user password: *********** Enter PDBADMIN User Password: ******* Prepare for db operation 7% complete Copying database files 8% complete [WARNING] ORA-00821: Specified value of sga_target 268M is too small, needs to be at least 308M ORA-01078: failure in processing system parameters 9% complete [FATAL] ORA-01034: The Oracle instance is not available for use. Start the instance. 29% complete 100% complete [FATAL] ORA-01034: The Oracle instance is not available for use. Start the instance.

数据库的启动果然除了问题,sga_target的值设置的是268M,最小值要求是308M,共享池的设置也不能满足最下的要求(496M)。这里的操作系统是Ubuntu 22.04.5,docker版本是28.3.1,不知是否和这个有关,官网上没有提高必须要设置sga_target的值。调整一下docker启动命令,先加入sga_target的设置选项,命令如下:

root@dbsrv1:/oradata# docker run -d --name oracle23ai \ --memory=8g \ -e ORACLE_PWD=1qazxsw2 \ -e SGA_TASRGET=4g \ -v /oradata:/opt/oracle/oradata \ 98201d89c4b3 6e9ce67be58a53b01836a845ac438c79dfe1557840a3ca17602d7f7301c30802 #### 检查容器状态及运行日志 root@dbsrv1:/oradata# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6e9ce67be58a 98201d89c4b3 "/bin/bash -c $ORACL…" 4 seconds ago Up 3 seconds (health: starting) 1521/tcp oracle23ai root@dbsrv1:/oradata# docker logs 6e9ce67be58a -f . . . [WARNING] [DBT-11205] Specified shared pool size does not meet the recommended minimum size requirement. This might cause database creation to fail. ACTION: Specify at least (496 MB) for shared pool size. . . . [WARNING] ORA-00821: Specified value of sga_target 288M is too small, needs to be at least 308M ORA-01078: failure in processing system parameters 9% complete [FATAL] ORA-01034: The Oracle instance is not available for use. Start the instance. 29% complete 100% complete [FATAL] ORA-01034: The Oracle instance is not available for use. Start the instance. 7% complete 0% complete Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details. Database configuration failed. Check logs under '/opt/oracle/cfgtoollogs/dbca'.

容器仍然不能正常启动,报的错误信息和之前的相同,再在启动命令中增加一个共享池的设置,

root@dbsrv1:/oradata# docker run -d --name oracle23ai \ --memory=8g \ -e ORACLE_PWD=1qazxsw2 \ -e SGA_TASRGET=4g \ -e shared_pool_size=1G \ -v /oradata:/opt/oracle/oradata \ 98201d89c4b3 ####检查容器状态及容器运行日志 root@dbsrv1:/oradata# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4cffb82fcaf7 98201d89c4b3 "/bin/bash -c $ORACL…" 5 seconds ago Up 4 seconds (health: starting) 1521/tcp oracle23ai root@dbsrv1:/oradata# docker logs 4cffb82fcaf7 -f Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration succeeded. Configuring Oracle Database FREE. [WARNING] [DBT-11205] Specified shared pool size does not meet the recommended minimum size requirement. This might cause database creation to fail. ACTION: Specify at least (496 MB) for shared pool size. Enter SYS user password: ******** Enter SYSTEM user password: ********* Enter PDBADMIN User Password: ********** Prepare for db operation 7% complete Copying database files 29% complete Creating and starting Oracle instance 30% complete 33% complete 36% complete 39% complete 43% complete Completing Database Creation 47% complete 49% complete 50% complete Creating Pluggable Databases 54% complete 71% complete Executing Post Configuration Actions 93% complete Running Custom Scripts 100% complete Database creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/FREE. Database Information: Global Database Name:FREE System Identifier(SID):FREE Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details. Connect to Oracle Database using one of the connect strings: Pluggable database: 4cffb82fcaf7/FREEPDB1 Multitenant container database: 4cffb82fcaf7

仍然报了一个共享池大小设置不能满足最小要求的警告,但是数据库成功启动了,进入到容器后登录数据库查看

--查看数据库的SGA相关参数设置 SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ allow_group_access_to_sga boolean FALSE lock_sga boolean FALSE pre_page_sga boolean TRUE sga_max_size big integer 400M sga_min_size big integer 0 sga_target big integer 400M --这里的值并不是容器启动时的设置的值 --查看共享池的设置残烛 SQL> show parameter share_pool NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ shared_pool_reserved_size big integer 20258488 --这里的值也和容器启动命令设置的值不一致 shared_pool_size big integer 0 1

SGA和共享池的设置仍然不能满足创建容器启动时的最小值,这个SGA的值太小了,试着更改一下数据库的内存设置

SQL> alter system set sga_max_size=4096M scope=spfile;
System altered.
SQL> alter system set sga_target=4096M scope=spfile;
System altered.

这样设置,重启数据库,数据库反而起不来了。

2.3 使用体验

用容器启动的Oracle 23AI感觉并不好用,启动容器的过程中报的错误也有点不明所以,虽然起来了,数据库内存的设置并不合理,调整内存的命令虽然能运行,却导致数据库启动失败(我的虚拟机是10G的内存),下面再试一下用rpm包部署。

3 使用rpm包部署

目前Oracle只发布了Oracle linux 8和9 上的rpm安装包,在这两种操作系统上使用rpm包安装Oracle 23I非常简单,从安装到数据库启动只需要三条命令,联网的条件下可以不必下载,直接在线安装,步骤如下

3.1 安装预安装包
[root@localhost ~]# dnf -y install oracle-database-preinstall-23ai ###在线安装 Last metadata expiration check: 0:01:54 ago on Sat 05 Jul 2025 08:11:22 PM EDT. Dependencies resolved. ============================================================================================================================================= Package Architecture Version Repository Size ============================================================================================================================================= Installing: oracle-database-preinstall-23ai x86_64 1.0-4.el8 ol8_appstream 31 k Installing dependencies: binutils x86_64 2.30-125.0.1.el8_10 ol8_baseos_latest 5.9 M Installed: binutils-2.30-125.0.1.el8_10.x86_64 glibc-devel-2.28-251.0.2.el8.x86_64 gssproxy-0.8.0-21.el8.x86_64 keyutils-1.5.10-9.el8.x86_64 ksh-20120801-267.0.1.el8.x86_64 libICE-1.0.9-15.el8.x86_64 libSM-1.2.3-1.el8.x86_64 libX11-xcb-1.6.8-8.el8.x86_64 libXcomposite-0.4.4-14.el8.x86_64 libXi-1.7.10-1.el8.x86_64 libXinerama-1.1.4-1.el8.x86_64 libXmu-1.1.3-1.el8.x86_64 libXrandr-1.5.2-1.el8.x86_64 libXt-1.1.5-12.el8.x86_64 libXtst-1.2.3-7.el8.x86_64 libXv-1.0.11-7.el8.x86_64 libXxf86dga-1.1.5-1.el8.x86_64 libXxf86misc-1.0.4-1.el8.x86_64 libXxf86vm-1.1.4-9.el8.x86_64 libdmx-1.1.4-3.el8.x86_64 libev-4.24-6.el8.x86_64 libverto-libev-0.3.2-2.el8.x86_64 libxcrypt-devel-4.1.1-6.el8.x86_64 lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_64 make-1:4.2.1-11.el8.x86_64 nfs-utils-1:2.3.3-64.0.1.el8_10.x86_64 oracle-database-preinstall-23ai-1.0-4.el8.x86_64 rpcbind-1.2.5-10.el8.x86_64 sysstat-11.7.3-13.0.2.el8_10.x86_64 xorg-x11-utils-7.5-28.el8.x86_64
3.2 安装Oracle软件
######这里用的是本地安装,用./指定文件的本地路径 [root@localhost ~]# dnf -y install ./oracle-database-free-23ai-23.8-1.el8.x86_64.rpm Last metadata expiration check: 0:08:15 ago on Sat 05 Jul 2025 08:11:22 PM EDT. Dependencies resolved. ============================================================================================================================================= Package Architecture Version Repository Size ============================================================================================================================================= Installing: oracle-database-free-23ai x86_64 23.8-1 @commandline 1.3 G Transaction Summary ============================================================================================================================================= Install 1 Package Total size: 1.3 G Installed size: 3.6 G Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: oracle-database-free-23ai-23.8-1.x86_64 1/1 Installing : oracle-database-free-23ai-23.8-1.x86_64 1/1 Running scriptlet: oracle-database-free-23ai-23.8-1.x86_64 1/1 [INFO] Executing post installation scripts... [INFO] Oracle home installed successfully and ready to be configured. To configure Oracle Database Free, optionally modify the parameters in '/etc/sysconfig/oracle-free-23ai.conf' and then run '/etc/init.d/oracle-free-23ai configure' as root. Verifying : oracle-database-free-23ai-23.8-1.x86_64 1/1 Installed: oracle-database-free-23ai-23.8-1.x86_64 Complete!
3.3 初始化数据库
[root@localhost sysconfig]# /etc/init.d/oracle-free-23ai configure Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration succeeded. Configuring Oracle Database FREE. Enter SYS user password: ******* Enter SYSTEM user password: ********* Enter PDBADMIN User Password: ************ Prepare for db operation 7% complete Copying database files 29% complete Creating and starting Oracle instance 30% complete 33% complete 36% complete 39% complete 43% complete Completing Database Creation 47% complete 49% complete 50% complete Creating Pluggable Databases 54% complete 71% complete Executing Post Configuration Actions 93% complete Running Custom Scripts 100% complete Database creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/FREE. Database Information: Global Database Name:FREE System Identifier(SID):FREE Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details. Connect to Oracle Database using one of the connect strings: Pluggable database: localhost.localdomain/FREEPDB1 Multitenant container database: localhost.localdomain
3.4 登录数据库

登录数据前需要设置环境变量,编辑oracle用户的.bash_profile文件,加入下面的内容

export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/23ai/dbhomeFree export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=FREE

退出重登录oracle用户后就可以用sqlplus登录数据库了。

[root@localhost dbhomeFree]# su - oracle [oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 23.0.0.0.0 - Production on Sat Jul 5 20:56:44 2025 Version 23.8.0.25.04 Copyright (c) 1982, 2025, Oracle. All rights reserved. Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.8.0.25.04 ---检查一下数据库sga设置 SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ allow_group_access_to_sga boolean FALSE lock_sga boolean FALSE pre_page_sga boolean TRUE sga_max_size big integer 1536M--这个初始值也需要调整 sga_min_size big integer 0 sga_target big integer 1536M
3.5 其它事项

初始化数据库前可以编辑/etc/sysconfig目录下oracle-free-23ai.conf文件调整相关配置,这个文件的内容如下:

[root@localhost sysconfig]# cat oracle-free-23ai.conf #This is a configuration file to setup the Oracle Database. #It is used when running '/etc/init.d/oracle-free-23ai configure'. # LISTENER PORT used Database listener, Leave empty for automatic port assignment LISTENER_PORT= # Character set of the database CHARSET=AL32UTF8 # Database file directory # If not specified, database files are stored under Oracle base/oradata DBFILE_DEST= # DB Domain name DB_DOMAIN= # Configure TDE CONFIGURE_TDE=false # Encrypt Tablespaces list, Leave empty for user tablespace alone or provide ALL for encrypting all tablespaces # For specific tablespaces use SYSTEM:true,SYSAUX:false ENCRYPT_TABLESPACES= # SKIP Validations, memory, space

这个文件里可以调整监听端口、字符集、数据文件的位置等选项,如果还要调整其它选项,可以使用dbca创建数据库。

4 写在后面

Oracle 23AI free的安装还是很简单的,只有简单的几步,容器方式的安装好像还有点小问题,rpm方式的安装不但简单,也十分顺畅,大概是操作系统也是Oracle 的原因吧。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论