准确的说,是Oracle 23ai Free Developer版,因为企业版目前只在云上(OCI和Azure)和ECC上提供。
前面我博客介绍了3种方法:
- Virtual Appliance
- RPM安装
- Docker
今天介绍最近新出的一种方法,也是我最为推荐的方法,使用vagrant box一键式获取23ai。
要使用这种方法,你需要有以下2个软件:
- Oracle VirtualBox
- Vagrant
然后克隆Oracle官方的vagrant项目:
git clone https://github.com/oracle/vagrant-projects.git
或许你早已克隆,但这个23ai是最近才有的,所以你更新一下就好:
git pull origin main
然后,进入23.4.0-Free
目录:运行vagrant up
即可,以下是日志片段:
PS C:\Users\****\Desktop\WORKSPACE\vagrant-projects\OracleDatabase\23.4.0-Free> vagrant up
==> vagrant: Getting Proxy Configuration from Host...
Bringing machine 'oracle23ai-free-vagrant' up with 'virtualbox' provider...
==> oracle23ai-free-vagrant: Box 'oraclelinux/9' could not be found. Attempting to find and install...oracle23ai-free-vagrant: Box Provider: virtualboxoracle23ai-free-vagrant: Box Version: >= 0
==> oracle23ai-free-vagrant: Loading metadata for box 'https://oracle.github.io/vagrant-projects/boxes/oraclelinux/9.json'oracle23ai-free-vagrant: URL: https://oracle.github.io/vagrant-projects/boxes/oraclelinux/9.json
==> oracle23ai-free-vagrant: Adding box 'oraclelinux/9' (v9.3.513) for provider: virtualboxoracle23ai-free-vagrant: Downloading: https://yum.oracle.com/boxes/oraclelinux/ol9/OL9U3_x86_64-vagrant-virtualbox-b513.boxoracle23ai-free-vagrant:oracle23ai-free-vagrant: Calculating and comparing box checksum...
==> oracle23ai-free-vagrant: Successfully added box 'oraclelinux/9' (v9.3.513) for 'virtualbox'!
==> oracle23ai-free-vagrant: Importing base box 'oraclelinux/9'...
==> oracle23ai-free-vagrant: Matching MAC address for NAT networking...
==> oracle23ai-free-vagrant: Checking if box 'oraclelinux/9' version '9.3.513' is up to date...
==> oracle23ai-free-vagrant: Setting the name of the VM: oracle23ai-free-vagrant
==> oracle23ai-free-vagrant: Clearing any previously set network interfaces...
==> oracle23ai-free-vagrant: Preparing network interfaces based on configuration...oracle23ai-free-vagrant: Adapter 1: nat
==> oracle23ai-free-vagrant: Forwarding ports...oracle23ai-free-vagrant: 1521 (guest) => 1521 (host) (adapter 1)oracle23ai-free-vagrant: 22 (guest) => 2222 (host) (adapter 1)
==> oracle23ai-free-vagrant: Running 'pre-boot' VM customizations...
==> oracle23ai-free-vagrant: Booting VM...
==> oracle23ai-free-vagrant: Waiting for machine to boot. This may take a few minutes...oracle23ai-free-vagrant: SSH address: 127.0.0.1:2222oracle23ai-free-vagrant: SSH username: vagrantoracle23ai-free-vagrant: SSH auth method: private keyoracle23ai-free-vagrant:oracle23ai-free-vagrant: Vagrant insecure key detected. Vagrant will automatically replaceoracle23ai-free-vagrant: this with a newly generated keypair for better security.oracle23ai-free-vagrant:oracle23ai-free-vagrant: Inserting generated public key within guest...oracle23ai-free-vagrant: Removing insecure key from the guest if it's present...oracle23ai-free-vagrant: Key inserted! Disconnecting and reconnecting using new SSH key...
==> oracle23ai-free-vagrant: Machine booted and ready!
==> oracle23ai-free-vagrant: Checking for guest additions in VM...
==> oracle23ai-free-vagrant: Setting hostname...
==> oracle23ai-free-vagrant: Configuring proxy environment variables...
==> oracle23ai-free-vagrant: Configuring proxy for Yum...
==> oracle23ai-free-vagrant: Mounting shared folders...oracle23ai-free-vagrant: /vagrant => C:/Users/****/Desktop/WORKSPACE/vagrant-projects/OracleDatabase/23.4.0-Free
==> oracle23ai-free-vagrant: Running provisioner: shell...oracle23ai-free-vagrant: Running: C:/Users/****/AppData/Local/Temp/vagrant-shell20240614-21940-manzyc.shoracle23ai-free-vagrant: INSTALLER: Started uporacle23ai-free-vagrant: Oracle Linux 9 BaseOS Latest (x86_64) 7.1 MB/s | 27 MB 00:03oracle23ai-free-vagrant: Oracle Linux 9 Application Stream Packages (x86 8.3 MB/s | 36 MB 00:04oracle23ai-free-vagrant: Oracle Linux 9 UEK Release 7 (x86_64) 4.6 MB/s | 36 MB 00:07oracle23ai-free-vagrant: Last metadata expiration check: 0:00:07 ago on Fri 14 Jun 2024 08:33:01 AM UTC.oracle23ai-free-vagrant: Dependencies resolved.oracle23ai-free-vagrant: =====================================================================================================oracle23ai-free-vagrant: Package Arch Version Repository Sizeoracle23ai-free-vagrant: =====================================================================================================oracle23ai-free-vagrant: Installing:oracle23ai-free-vagrant: kernel-uek-core x86_64 5.15.0-207.156.6.el9uek ol9_UEKR7 49 Moracle23ai-free-vagrant: kernel-uek-devel x86_64 5.15.0-207.156.6.el9uek ol9_UEKR7 39 Moracle23ai-free-vagrant: Upgrading:oracle23ai-free-vagrant: NetworkManager x86_64 1:1.46.0-8.0.1.el9_4 ol9_baseos_latest 2.3 Moracle23ai-free-vagrant: NetworkManager-libnm x86_64 1:1.46.0-8.0.1.el9_4 ol9_baseos_latest 1.9 Moracle23ai-free-vagrant: acl x86_64 2.3.1-4.el9 ol9_baseos_latest 87 k
...oracle23ai-free-vagrant: INSTALLER: Oracle preinstall and openssl completeoracle23ai-free-vagrant: INSTALLER: Environment variables setoracle23ai-free-vagrant: INSTALLER: Downloading Oracle Database softwareoracle23ai-free-vagrant: Last metadata expiration check: 0:06:04 ago on Fri 14 Jun 2024 04:33:01 PM +08.oracle23ai-free-vagrant: Dependencies resolved.oracle23ai-free-vagrant: ================================================================================oracle23ai-free-vagrant: Package Arch Version Repository Sizeoracle23ai-free-vagrant: ================================================================================oracle23ai-free-vagrant: Installing:oracle23ai-free-vagrant: oracle-database-free-23ai x86_64 1.0-1 @commandline 1.3 Goracle23ai-free-vagrant:oracle23ai-free-vagrant: Transaction Summaryoracle23ai-free-vagrant: ================================================================================oracle23ai-free-vagrant: Install 1 Packageoracle23ai-free-vagrant:oracle23ai-free-vagrant: Total size: 1.3 Goracle23ai-free-vagrant: Installed size: 3.6 Goracle23ai-free-vagrant: Downloading Packages:oracle23ai-free-vagrant: Running transaction checkoracle23ai-free-vagrant: Transaction check succeeded.oracle23ai-free-vagrant: Running transaction testoracle23ai-free-vagrant: Transaction test succeeded.oracle23ai-free-vagrant: Running transactionoracle23ai-free-vagrant: Preparing : 1/1oracle23ai-free-vagrant: Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64 1/1oracle23ai-free-vagrant: Installing : oracle-database-free-23ai-1.0-1.x86_64 1/1oracle23ai-free-vagrant: Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64 1/1oracle23ai-free-vagrant: [INFO] Executing post installation scripts...oracle23ai-free-vagrant: [INFO] Oracle home installed successfully and ready to be configured.oracle23ai-free-vagrant: 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.oracle23ai-free-vagrant:oracle23ai-free-vagrant: Verifying : oracle-database-free-23ai-1.0-1.x86_64 1/1oracle23ai-free-vagrant:oracle23ai-free-vagrant: Installed:oracle23ai-free-vagrant: oracle-database-free-23ai-1.0-1.x86_64oracle23ai-free-vagrant:oracle23ai-free-vagrant: Complete!oracle23ai-free-vagrant: INSTALLER: Oracle software installedoracle23ai-free-vagrant: 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:oracle23ai-free-vagrant: Confirm the password:oracle23ai-free-vagrant: Configuring Oracle Listener.oracle23ai-free-vagrant: Listener configuration succeeded.oracle23ai-free-vagrant: Configuring Oracle Database FREE.oracle23ai-free-vagrant: Enter SYS user password:oracle23ai-free-vagrant: *************oracle23ai-free-vagrant: Enter SYSTEM user password:oracle23ai-free-vagrant: ***************oracle23ai-free-vagrant: Enter PDBADMIN User Password:oracle23ai-free-vagrant: ***************oracle23ai-free-vagrant: Prepare for db operationoracle23ai-free-vagrant: 7% completeoracle23ai-free-vagrant: Copying database filesoracle23ai-free-vagrant: 29% completeoracle23ai-free-vagrant: Creating and starting Oracle instanceoracle23ai-free-vagrant: 30% completeoracle23ai-free-vagrant: 33% completeoracle23ai-free-vagrant: 36% completeoracle23ai-free-vagrant: 39% completeoracle23ai-free-vagrant: 43% completeoracle23ai-free-vagrant: Completing Database Creationoracle23ai-free-vagrant: 47% completeoracle23ai-free-vagrant: 49% completeoracle23ai-free-vagrant: 50% completeoracle23ai-free-vagrant: Creating Pluggable Databasesoracle23ai-free-vagrant: 54% completeoracle23ai-free-vagrant: 71% completeoracle23ai-free-vagrant: Executing Post Configuration Actionsoracle23ai-free-vagrant: 93% completeoracle23ai-free-vagrant: Running Custom Scriptsoracle23ai-free-vagrant: 100% completeoracle23ai-free-vagrant: Database creation complete. For details check the logfiles at:oracle23ai-free-vagrant: /opt/oracle/cfgtoollogs/dbca/FREE.oracle23ai-free-vagrant: Database Information:oracle23ai-free-vagrant: Global Database Name:FREEoracle23ai-free-vagrant: System Identifier(SID):FREEoracle23ai-free-vagrant: Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.oracle23ai-free-vagrant:oracle23ai-free-vagrant: Connect to Oracle Database using one of the connect strings:oracle23ai-free-vagrant: Pluggable database: localhost.localdomain/FREEPDB1oracle23ai-free-vagrant: Multitenant container database: localhost.localdomainoracle23ai-free-vagrant: INSTALLER: Database createdoracle23ai-free-vagrant: oracle-free-23ai.service is not a native service, redirecting to systemd-sysv-install.oracle23ai-free-vagrant: Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-free-23aioracle23ai-free-vagrant: INSTALLER: Created and enabled oracle-free-23ai systemd serviceoracle23ai-free-vagrant: INSTALLER: setPassword.sh file set uporacle23ai-free-vagrant: INSTALLER: Running user-defined post-setup scriptsoracle23ai-free-vagrant: INSTALLER: Done running user-defined post-setup scriptsoracle23ai-free-vagrant: ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: 3PZKRiIBbhsS1oracle23ai-free-vagrant: INSTALLER: Installation complete, database ready to use!
和生成其他版本的Oracle 数据库不同,23ai无需提前准备安装介质,这是在安装中自动下载的,因此网速很重要。
另外,这个数据库的操作系统是Oracle Linux 9:
[vagrant@localhost ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.4 (Plow)
PDB不是orclpdb1了,而是freepdb1:
[oracle@localhost ~]$ sqlplus / as sysdbaSQL*Plus: Release 23.0.0.0.0 - Production on Mon Jun 17 15:02:50 2024
Version 23.4.0.24.05Copyright (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.05SQL> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO3 FREEPDB1 READ WRITE NO
立此存照:
最后,看下环境变量设置:
$ tail .bashrc
...
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
export ORACLE_SID=FREE
export PATH=$PATH:$ORACLE_HOME/bin