赞
踩
作者 | JiekeXu
来源 |公众号 JiekeXu DBA之路(ID: JiekeXu_IT)
如需转载请联系授权 | (个人微信 ID:JiekeXu_DBA)
大家好,我是 JiekeXu,江湖人称“强哥”,荣获 Oracle ACE 称号,墨天轮 MVP,墨天轮年度“墨力之星”,拥有 Oracle 11g OCP/OCM 认证,MySQL 5.7/8.0 OCP 认证以及 PCA、PCTA、OBCA、OGCA、KCP 等众多国产数据库认证证书,今天和大家一起来看看 Oracle 23ai free 版本地化安装指南,欢迎点击最上方蓝字“JiekeXu DBA之路”关注我的微信公众号,然后点击右上方三个点“设为星标”顶,更多干货文章才能第一时间推送,谢谢!
北京时间 2024年 5 月 3 日凌晨, Oracle Database 23ai 正式发布!在过去四年中,Oracle 数据库开发部门一直在努力研发 Oracle 数据库的下一个长期支持版本,重点是 AI 和提高开发人员的工作效率。鉴于此版本数据库中对 AI 的关注,Oracle Database 23c 更名为 Oracle Database 23ai。
Oracle Database 23ai 现已在 Oracle Exadata Cloud@Customer、OCI Exadata 数据库服务和 OCI 基础数据库服务上推出。Azure Oracle数据库服务中也有提供。对于开发人员,Oracle Database 23ai 现在可在 Always Free 自治数据库中使用,也可以在 Autonomous Database 23ai Container Image 和 Oracle Database 23ai Free 中下载。
您现在可以下载和试用 Oracle Database 23ai Free 本地版本:
- https://www.oracle.com/database/free/get-started 下载 Oracle Database 23ai rpm 和 VM VirtualBox ova 镜像文件,
-
-
- https://www.oracle.com/autonomous-database/free-trial/#free-container-image 下载 Autonomous Database 23ai 容器镜像
安装方式有如下图三种:
1)rpm 包安装方式
自 Oracle 18c 以后的版本,除传统的 zip 包安装方式外,便可以使用 rpm 包安装单机数据库。20 年的时候也写过 rpm 安装 19c 企业版的文章,感兴趣的可以点此查看:Oracle 19c 之 RPM 包安装初体验(一),去年 11 月份的时候,写静默安装文章的时候在文末第四章写了 23c rpm 包安装的方式:Oracle 主流版本不同架构下的静默安装指南。
今天我们在 Oracle Linux 8.7 上通过 rpm 包安装 23ai 版本时,需要卸载之前安装的 23c。
- [root@jiekexu init.d]#
- /etc/init.d/oracle-free-23c delete
- Deleting Oracle Listener.
- Deleting Oracle Database FREE.
- [WARNING] [DBT-19202] The Database
- Configuration Assistant will delete the Oracle instances and datafiles for your
- database. All information in the database will be destroyed.
- Prepare for db operation
- 32% complete
- Connecting to database
- 35% complete
- 39% complete
- 42% complete
- 45% complete
- 48% complete
- 52% complete
- 65% complete
- Updating network configuration files
- 68% complete
- Deleting instance and datafiles
- 84% complete
- 100% complete
- Database deletion completed.
- Look at the log file
- "/opt/oracle/cfgtoollogs/dbca/FREE/FREE0.log" for further details.
- [root@jiekexu init.d]# yum remove
- oracle-database-free-23c
- Dependencies resolved.
- =============================================================================================================================================================================================================================================
- Package Architecture Version Repository Size
- =============================================================================================================================================================================================================================================
- Removing:
- oracle-database-free-23c x86_64 1.0-1 @@commandline 5.2 G
- Transaction Summary
- =============================================================================================================================================================================================================================================
- Remove1 Package
- Freed space: 5.2 G
- Is this ok [y/N]: y
- Running transaction check
- Transaction check succeeded.
- Running transaction test
- Transaction test succeeded.
- Running transaction
- Preparing : 1/1
- Running scriptlet: oracle-database-free-23c-1.0-1.x86_64 1/1
- Erasing :
- oracle-database-free-23c-1.0-1.x86_64 1/1
- Running scriptlet: oracle-database-free-23c-1.0-1.x86_64 1/1
- Verifying :
- oracle-database-free-23c-1.0-1.x86_64 1/1
- Removed:
- oracle-database-free-23c-1.0-1.x86_64
- Complete!
卸载 preinstall rpm
包
yum remove oracle-database-preinstall-23ai
下载 Linux8 下的 rpm 包 oracle-database-free-23c-1.0-1.el8.x86_64.rpm
https://www.oracle.com/database/free/get-started/
下载 23ai preinstall rpm 包
https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/
oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm
然后我们需要将下载好的这两个软件包上传到服务器任意目录下,通过 yum 去安装。
安装 preinstall 和 rpm 软件包
- dnf -y install oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm
- dnf -y install oracle-database-free-23ai-1.0-1.el8.x86_64.rpm
- [root@jiekexu soft]# dnf -y install oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm
-
-
- Last metadata expiration check: 0:00:47 ago on Tue 07 May 2024 03:13:05 PM CST.
- Dependencies resolved.
- =============================================================================================================================================================================================================================================
- Package Architecture Version Repository Size
- =============================================================================================================================================================================================================================================
- Installing:
- oracle-database-preinstall-23ai x86_64 1.0-2.el8 @commandline 30 k
- replacing oracle-database-preinstall-23c.x86_64 1.0-0.5.el8
-
-
- Transaction Summary
- =============================================================================================================================================================================================================================================
- Install 1 Package
-
-
- Total size: 30 k
- Downloading Packages:
- Running transaction check
- Transaction check succeeded.
- Running transaction test
- Transaction test succeeded.
- Running transaction
- Preparing : 1/1
- Installing : oracle-database-preinstall-23ai-1.0-2.el8.x86_64 1/2
- Running scriptlet: oracle-database-preinstall-23c-1.0-0.5.el8.x86_64 2/2
- Obsoleting : oracle-database-preinstall-23c-1.0-0.5.el8.x86_64 2/2
- Running scriptlet: oracle-database-preinstall-23c-1.0-0.5.el8.x86_64 2/2
- Running scriptlet: oracle-database-preinstall-23ai-1.0-2.el8.x86_64 2/2
- Running scriptlet: oracle-database-preinstall-23c-1.0-0.5.el8.x86_64 2/2
- Verifying : oracle-database-preinstall-23ai-1.0-2.el8.x86_64 1/2
- Verifying : oracle-database-preinstall-23c-1.0-0.5.el8.x86_64 2/2
-
-
- Installed:
- oracle-database-preinstall-23ai-1.0-2.el8.x86_64
-
-
- Complete!
-
-
- [root@jiekexu soft]# dnf -y install oracle-database-free-23ai-1.0-1.el8.x86_64.rpm
- Last metadata expiration check: 0:01:51 ago on Tue 07 May 2024 03:13:05 PM CST.
- Dependencies resolved.
- =============================================================================================================================================================================================================================================
- Package Architecture Version Repository Size
- =============================================================================================================================================================================================================================================
- Installing:
- oracle-database-free-23ai x86_64 1.0-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-1.0-1.x86_64 1/1
- Installing : oracle-database-free-23ai-1.0-1.x86_64 1/1
- Running scriptlet: oracle-database-free-23ai-1.0-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-1.0-1.x86_64 1/1
-
-
- Installed:
- oracle-database-free-23ai-1.0-1.x86_64
-
-
- Complete!
配置数据库
/etc/init.d/oracle-free-23ai configure
相当于 dbca 的过程,当然你也可以通过图形化 dbca,我这里就按照官方推荐通过命令行静默配置监听和实例了,需要输入 SYS, SYSTEM and PDBADMIN 管理员用户的密码,注意不能是弱口令,我这里给了大小写加数字 Oracle23Ai
[root@jiekexu init.d]# /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/Free1.log" for further details. Connect to Oracle Database using one of the connect strings: Pluggable database: jiekexu/FREEPDB1 Multitenant container database: jiekexu
配置环境变量
- [root@jiekexu init.d]# su - oracle
- [oracle@jiekexu ~]$ vi .bash_profile
-
-
- # .bash_profile
-
-
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
-
-
- # User specific environment and startup programs
- export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
- export ORACLE_SID=Free
- export PDB_NAME=FREEPDB1
- export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
- export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
- export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/lib:/usr/lib
- export PATH=${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:$OGG_HOME:${PATH}
- export HOST=`hostname | cut -f1 -d"."`
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$OGG_HOME:/lib/usr/lib:/usr/local/lib
- # General exports and vars
- export PATH=$ORACLE_HOME/bin:$PATH
- LSNR=$ORACLE_HOME/bin/lsnrctl
- SQLPLUS=$ORACLE_HOME/bin/sqlplus
- alias sys='sqlplus / as sysdba'
- stty erase ^H
登录数据库查看
[oracle@jiekexu ~]$ sys SQL*Plus: Release 23.0.0.0.0 - Production on Tue May 7 16:41:35 2024 Version 23.4.0.24.05 Copyright (c) 1982, 2024, Oracle. All rights reserved. Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.4.0.24.05 SQL> set line 240 col profile for a20 SQL> set pages 999 col username for a25 col ACCOUNT_STATUS for a18 select USERNAME,ACCOUNT_STATUS,CREATED,LOCK_DATE,PROFILE,PASSWORD_VERSIONS,DEFAULT_TABLESPACE from dba_users where account_status='OPEN' order by CREATED asc; SQL> SQL> SQL> SQL> USERNAME ACCOUNT_STATUS CREATED LOCK_DATE PROFILE PASSWORD_VERSIONS DEFAULT_TABLESPACE ------------------------- ------------------ ------------------- ------------------- -------------------- ----------------- ------------------------------ SYS OPEN 2024-04-24 10:23:46 DEFAULT 11G 12C SYSTEM SYSTEM OPEN 2024-04-24 10:23:46 DEFAULT 11G 12C SYSTEM SYSRAC OPEN 2024-04-24 10:23:47 DEFAULT USERS SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 FREEPDB1 READ WRITE NO SQL> select TABLESPACE_NAME,BIGFILE from dba_tablespaces; TABLESPACE_NAME BIG ------------------------------ --- SYSTEM YES SYSAUX YES UNDOTBS1 YES TEMP NO USERS YES SQL> alter session set container=FREEPDB1; Session altered. SQL> select TABLESPACE_NAME,BIGFILE from dba_tablespaces; TABLESPACE_NAME BIG ------------------------------ --- SYSTEM YES SYSAUX YES UNDOTBS1 YES TEMP NO USERS NO SQL> create tablespace jiekexu DATAFILE '/opt/oracle/oradata/FREE/FREEPDB1/jiekexu01.dbf' size 10m; Tablespace created.
开机自启动设置
Oracle 建议您将系统配置为在系统启动时自动启动 Oracle Database Free,并在系统关闭时自动关闭系统。自动关闭数据库可防止不正确的数据库关闭。
要自动启动和关闭侦听器和数据库,请按以下方式运行以下命令
- # systemctl daemon-reload
- # systemctl enable oracle-free-23ai
使用 Configuration Services 脚本关闭和启动
配置侦听器后,可以运行配置服务脚本来检查数据库和侦听器的状态。
- # /etc/init.d/oracle-free-23ai status
- Status of the Oracle Free 23ai service:
- LISTENER status: RUNNING
- Free Database status: RUNNING
-
-
- # systemctl start oracle-free-23ai
- # systemctl stop oracle-free-23ai
- # systemctl restart oracle-free-23ai
验证开机自启动是否设置成功
docker 安装也非常简单,这里并不需要 Linux8,在一台可以联网的 Linux7 即可完成安装,启动 docker,直接 docker pull 就好了。
- Su – docker
- systemctl status docker
- systemctl start docker
- systemctl status docker
- docker pull container-registry.oracle.com/database/free:latest
- docker run -d --name jieke23ai -h JiekeXu -p 1521:11521 container-registry.oracle.com/database/free:latest
- docker exec -it jieke23ai sqlplus / as sysdba
[docker@JiekeXu ~]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9c66d08f839a container-registry.oracle.com/database/free:latest "/bin/bash -c $ORACL…" 12 hours ago Up 12 hours (healthy) 1521/tcp, 0.0.0.0:1521->11521/tcp, :::1521->11521/tcp jieke23ai [docker@JiekeXu ~]$ docker exec -it jieke23ai bash bash-4.4$ bash-4.4$ lsnrctl status LSNRCTL for Linux: Version 23.0.0.0.0 - Production on 09-MAY-2024 15:27:11 Copyright (c) 1991, 2024, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_FREE))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 23.0.0.0.0 - Production Start Date 09-MAY-2024 03:33:16 Uptime 0 days 11 hr. 53 min. 55 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service FREE Listener Parameter File /opt/oracle/product/23ai/dbhomeFree/network/admin/listener.ora Listener Log File /opt/oracle/diag/tnslsnr/JiekeXu/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_FREE))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))) Services Summary... Service "16df542da83f091ce0630500580a27e7" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "FREE" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "FREEXDB" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "freepdb1" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... The command completed successfully bash-4.4$ bash-4.4$ sqlplus / as sysdba SQL*Plus: Release 23.0.0.0.0 - Production on Thu May 9 15:27:43 2024 Version 23.4.0.24.05 Copyright (c) 1982, 2024, Oracle. All rights reserved. Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.4.0.24.05
3)导入 ova 安装
oracle 官方提供了一个已经在虚拟机上安装好了的 Oracle 23 ai,并将其打包成 ova 文件,可直接在官方下载,然后安装 VM VitualBox。完了将下载好的 ova 文件导入到虚拟机中,去年 4 月份也写过相关的文章,感兴趣的可点此链接查看:只需三步快速体验 Oracle 23c FREE 开发版,这里就不介绍了。ova 文件自带了 Oracle Linux 8.9+ oracle 23ai free (Oracle Database 23ai Free Release 23.0.0.0.0 – Develop, Learn, and Run for Free Version 23.4.0.24.05)。
在 2022 年 9 月份的时候, Oracle 23c 的一些新特性就广为人知了,当时我也转载过一篇《Oracle Database 23c 十小新特性速览》,今年 5 月发布的 23 ai 涵盖了 300+ 的新特性,一下子全部掌握了还是比较困难的,需要细嚼慢咽。比如,sqlplus 中就有五六个新特性:
SQL> SHOW CONNECTION SP2-0306: Invalid option. Help: https://docs.oracle.com/error-help/db/sp2-0306/ Usage: SHOW CONN[ECTION] NETS[ERVICENAMES] [<net_service_name 1> <net_service_name 2> ..] SQL> SQL> SHOW CONNECTION NETS Local Net Naming configuration file: /opt/oracle/product/23ai/dbhomeFree/network/admin/tnsnames.ora EXTPROC_CONNECTION_DATA FREE LISTENER_FREE FREEPDB1 SQL> SQL> ping Ok (0.902 msec) SQL> ping freepdb1 Local Net Naming configuration file: /opt/oracle/product/23ai/dbhomeFree/network/admin/tnsnames.ora Attempting to contact: (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = FREEPDB1))) Ok (0.725 msec) SQL> CONFIG EXPORT TNS FILE Generating config store JSON for Local Net Naming configuration file /opt/oracle/product/23ai/dbhomeFree/network/admin/tnsnames.ora Config store JSON file generated successfully (/home/oracle/oraconfig.json)
- SQL*Plus CONFIG Command
- SQL*Plus OERR Command and Improved HELP Syntax
- SQL*Plus PING Command and Command Line Option
- SQL*Plus SET ERRORDETAILS Command
- SQL*Plus SHOW CONNECTION Command
- SQL*Plus ARGUMENT Command
- https://docs.oracle.com/en/database/oracle/oracle-database/23/sqpug/ping.html#GUID-60C4A1C5-535A-4C9B-88F7-DDE2C198FD6E
参考链接
- https://www.oracle.com/database/free/get-started/
- https://www.oracle.com/database/23ai/
- https://docs.oracle.com/en/database/oracle/oracle-database/23/xeinl/index.html
- https://docs.oracle.com/en/database/oracle/oracle-database/23/nfcoa/toc.htm
- https://docs.oracle.com/en/database/oracle/oracle-database/23/nfcoa/application_development.html#GUID-87019-4
全文完,希望可以帮到正在阅读的你,如果觉得有帮助,可以分享给你身边的朋友,同事,你关心谁就分享给谁,一起学习共同进步~~~
一文搞懂 Oracle 统计信息
Oracle 主流版本不同架构下的静默安装指南
Oracle SQL 性能分析(SPA)原理与实战演练
Oracle 大数据量导出工具——sqluldr2 的安装与使用
在归档模式下直接 rm dbf 数据文件并重启数据库还有救吗?
欢迎关注我的公众号【JiekeXu DBA之路】,一起学习新知识!
————————————————————————————
公众号:JiekeXu DBA之路
墨天轮:https://www.modb.pro/u/4347
CSDN :https://blog.csdn.net/JiekeXu
ITPUB:https://blog.itpub.net/69968215
腾讯云:https://cloud.tencent.com/developer/user/5645107
————————————————————————————
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。