如何获得一个Oracle 23ai数据库(vagrant box)

准确的说,是Oracle 23ai Free Developer版,因为企业版目前只在云上(OCI和Azure)和ECC上提供。

前面我博客介绍了3种方法:

  1. Virtual Appliance
  2. RPM安装
  3. Docker

今天介绍最近新出的一种方法,也是我最为推荐的方法,使用vagrant box一键式获取23ai。

要使用这种方法,你需要有以下2个软件:

  • Oracle VirtualBox
  • Vagrant

然后克隆Oracle官方的vagrant项目

bash 复制代码
git clone https://github.com/oracle/vagrant-projects.git

或许你早已克隆,但这个23ai是最近才有的,所以你更新一下就好:

sql 复制代码
git pull origin main

然后,进入23.4.0-Free目录:运行vagrant up即可,以下是日志片段:

bash 复制代码
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: virtualbox
    oracle23ai-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: virtualbox
    oracle23ai-free-vagrant: Downloading: https://yum.oracle.com/boxes/oraclelinux/ol9/OL9U3_x86_64-vagrant-virtualbox-b513.box
    oracle23ai-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:2222
    oracle23ai-free-vagrant: SSH username: vagrant
    oracle23ai-free-vagrant: SSH auth method: private key
    oracle23ai-free-vagrant:
    oracle23ai-free-vagrant: Vagrant insecure key detected. Vagrant will automatically replace
    oracle23ai-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.sh
    oracle23ai-free-vagrant: INSTALLER: Started up
    oracle23ai-free-vagrant: Oracle Linux 9 BaseOS Latest (x86_64)           7.1 MB/s |  27 MB     00:03
    oracle23ai-free-vagrant: Oracle Linux 9 Application Stream Packages (x86 8.3 MB/s |  36 MB     00:04
    oracle23ai-free-vagrant: Oracle Linux 9 UEK Release 7 (x86_64)           4.6 MB/s |  36 MB     00:07
    oracle23ai-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          Size
    oracle23ai-free-vagrant: =====================================================================================================
    oracle23ai-free-vagrant: Installing:
    oracle23ai-free-vagrant:  kernel-uek-core                 x86_64  5.15.0-207.156.6.el9uek             ol9_UEKR7           49 M
    oracle23ai-free-vagrant:  kernel-uek-devel                x86_64  5.15.0-207.156.6.el9uek             ol9_UEKR7           39 M
    oracle23ai-free-vagrant: Upgrading:
    oracle23ai-free-vagrant:  NetworkManager                  x86_64  1:1.46.0-8.0.1.el9_4                ol9_baseos_latest  2.3 M
    oracle23ai-free-vagrant:  NetworkManager-libnm            x86_64  1:1.46.0-8.0.1.el9_4                ol9_baseos_latest  1.9 M
    oracle23ai-free-vagrant:  acl                             x86_64  2.3.1-4.el9                         ol9_baseos_latest   87 k
...
    oracle23ai-free-vagrant: INSTALLER: Oracle preinstall and openssl complete
    oracle23ai-free-vagrant: INSTALLER: Environment variables set
    oracle23ai-free-vagrant: INSTALLER: Downloading Oracle Database software
    oracle23ai-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         Size
    oracle23ai-free-vagrant: ================================================================================
    oracle23ai-free-vagrant: Installing:
    oracle23ai-free-vagrant:  oracle-database-free-23ai      x86_64      1.0-1       @commandline      1.3 G
    oracle23ai-free-vagrant:
    oracle23ai-free-vagrant: Transaction Summary
    oracle23ai-free-vagrant: ================================================================================
    oracle23ai-free-vagrant: Install  1 Package
    oracle23ai-free-vagrant:
    oracle23ai-free-vagrant: Total size: 1.3 G
    oracle23ai-free-vagrant: Installed size: 3.6 G
    oracle23ai-free-vagrant: Downloading Packages:
    oracle23ai-free-vagrant: Running transaction check
    oracle23ai-free-vagrant: Transaction check succeeded.
    oracle23ai-free-vagrant: Running transaction test
    oracle23ai-free-vagrant: Transaction test succeeded.
    oracle23ai-free-vagrant: Running transaction
    oracle23ai-free-vagrant:   Preparing        :                                                        1/1
    oracle23ai-free-vagrant:   Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                 1/1
    oracle23ai-free-vagrant:   Installing       : oracle-database-free-23ai-1.0-1.x86_64                 1/1
    oracle23ai-free-vagrant:   Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                 1/1
    oracle23ai-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/1
    oracle23ai-free-vagrant:
    oracle23ai-free-vagrant: Installed:
    oracle23ai-free-vagrant:   oracle-database-free-23ai-1.0-1.x86_64
    oracle23ai-free-vagrant:
    oracle23ai-free-vagrant: Complete!
    oracle23ai-free-vagrant: INSTALLER: Oracle software installed
    oracle23ai-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 operation
    oracle23ai-free-vagrant: 7% complete
    oracle23ai-free-vagrant: Copying database files
    oracle23ai-free-vagrant: 29% complete
    oracle23ai-free-vagrant: Creating and starting Oracle instance
    oracle23ai-free-vagrant: 30% complete
    oracle23ai-free-vagrant: 33% complete
    oracle23ai-free-vagrant: 36% complete
    oracle23ai-free-vagrant: 39% complete
    oracle23ai-free-vagrant: 43% complete
    oracle23ai-free-vagrant: Completing Database Creation
    oracle23ai-free-vagrant: 47% complete
    oracle23ai-free-vagrant: 49% complete
    oracle23ai-free-vagrant: 50% complete
    oracle23ai-free-vagrant: Creating Pluggable Databases
    oracle23ai-free-vagrant: 54% complete
    oracle23ai-free-vagrant: 71% complete
    oracle23ai-free-vagrant: Executing Post Configuration Actions
    oracle23ai-free-vagrant: 93% complete
    oracle23ai-free-vagrant: Running Custom Scripts
    oracle23ai-free-vagrant: 100% complete
    oracle23ai-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:FREE
    oracle23ai-free-vagrant: System Identifier(SID):FREE
    oracle23ai-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/FREEPDB1
    oracle23ai-free-vagrant:      Multitenant container database: localhost.localdomain
    oracle23ai-free-vagrant: INSTALLER: Database created
    oracle23ai-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-23ai
    oracle23ai-free-vagrant: INSTALLER: Created and enabled oracle-free-23ai systemd service
    oracle23ai-free-vagrant: INSTALLER: setPassword.sh file set up
    oracle23ai-free-vagrant: INSTALLER: Running user-defined post-setup scripts
    oracle23ai-free-vagrant: INSTALLER: Done running user-defined post-setup scripts
    oracle23ai-free-vagrant: ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: 3PZKRiIBbhsS1
    oracle23ai-free-vagrant: INSTALLER: Installation complete, database ready to use!

和生成其他版本的Oracle 数据库不同,23ai无需提前准备安装介质,这是在安装中自动下载的,因此网速很重要。

另外,这个数据库的操作系统是Oracle Linux 9:

sql 复制代码
[vagrant@localhost ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.4 (Plow)

PDB不是orclpdb1了,而是freepdb1:

sql 复制代码
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Mon Jun 17 15:02:50 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> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 FREEPDB1                       READ WRITE NO

立此存照:

最后,看下环境变量设置:

bash 复制代码
$ 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
相关推荐
百度智能云技术站5 小时前
广告投放系统成本降低 70%+,基于 Redis 容量型数据库 PegaDB 的方案设计和业务实践
数据库·redis·oracle
梦想平凡6 小时前
PHP 微信棋牌开发全解析:高级教程
android·数据库·oracle
夏木~8 小时前
Oracle 中什么情况下 可以使用 EXISTS 替代 IN 提高查询效率
数据库·oracle
吴冰_hogan9 小时前
MySQL InnoDB 存储引擎 Redo Log(重做日志)详解
数据库·oracle
CodeCraft Studio10 小时前
【实用技能】如何在 SQL Server 中处理 Null 或空值?
数据库·oracle·sqlserver
武汉联从信息10 小时前
浅谈ORACLE中间件SOA BPM,IDM,OID,UCM,WebcenterPortal服务器如何做迁移切换
oracle
Elastic 中国社区官方博客11 小时前
Elasticsearch:什么是查询语言?
大数据·数据库·elasticsearch·搜索引擎·oracle
夜光小兔纸12 小时前
oracle dblink 的创建及使用
数据库·oracle
Smile丶凉轩12 小时前
MySQL库的操作
数据库·mysql·oracle
p@nd@14 小时前
Oracle筑基篇-调度算法-LRU的引入
数据库·oracle·操作系统·lru