简单介绍可参考这里。
获取数据库可以参考这篇文章Introducing Oracle Database 23c Free – Developer Release或这里。
这是最快的方法。在OCI上创建一个计算实例,然后就可以拉取image使用了。
docker的安装和配置不赘述了。
拉取image:
$ docker pull container-registry.oracle.com/database/free
Using default tag: latest
Trying to pull repository container-registry.oracle.com/database/free ...
latest: Pulling from container-registry.oracle.com/database/free
031aed3cb40e: Pull complete
064e6354b87b: Pull complete
e0e26966d0d9: Pull complete
0d1f063a4da2: Pull complete
Digest: sha256:474f570148ef37d1152ccff3361109fb8b92e0eab523cef32efe273e5abcbb94
Status: Downloaded newer image for container-registry.oracle.com/database/free:latest
container-registry.oracle.com/database/free:latest
image大约11G:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
container-registry.oracle.com/database/free latest d45af382bf76 5 weeks ago 10.6GB
然后启动数据库,第一次时间长点,但感觉比企业版要快很多:
$ docker run container-registry.oracle.com/database/free:latest
Starting Oracle Net Listener.
Oracle Net Listener started.
Starting Oracle Database instance FREE.
Oracle Database instance FREE started.
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
PDB$SEED(2):Opening pdb with Resource Manager plan: DEFAULT_PLAN
FREEPDB1(3):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
FREEPDB1(3):Autotune of undo retention is turned on.
FREEPDB1(3):Undo initialization recovery: Parallel FPTR failed: start:245860668 end:245860669 diff:1 ms (0.0 seconds)
FREEPDB1(3):[162] Successfully onlined Undo Tablespace 2.
FREEPDB1(3):SUPLOG: Set PDB SUPLOG SGA at PDB OPEN, old 0x18, new 0x0 (no suplog)
2023-09-08T09:00:33.615993+00:00
FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN
Completed: Pluggable database FREEPDB1 opened read write
Completed: ALTER DATABASE OPEN
2023-09-08T09:00:34.918003+00:00
===========================================================
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
正式启动一次:
$ docker run -d --name ORCLCDB container-registry.oracle.com/database/free:latest
8c8facd08dc24261c2b2092ff9ecb2a41189303eaa059e1d2a1034226a6da1db
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8c8facd08dc2 container-registry.oracle.com/database/free:latest "/bin/bash -c $ORACL…" 35 seconds ago Up 34 seconds (health: starting) 1521/tcp ORCLCDB
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8c8facd08dc2 container-registry.oracle.com/database/free:latest "/bin/bash -c $ORACL…" About a minute ago Up About a minute (healthy) 1521/tcp ORCLCDB
这一次启动只需不到1分钟:
2023-09-08T09:04:05.032218930Z Starting Oracle Net Listener.
2023-09-08T09:04:05.176991996Z Oracle Net Listener started.
2023-09-08T09:04:05.177014108Z Starting Oracle Database instance FREE.
2023-09-08T09:04:40.229143588Z Oracle Database instance FREE started.
2023-09-08T09:04:40.229164627Z
2023-09-08T09:04:40.273314674Z The Oracle base remains unchanged with value /opt/oracle
2023-09-08T09:04:40.458092335Z #########################
2023-09-08T09:04:40.458114517Z DATABASE IS READY TO USE!
2023-09-08T09:04:40.458119405Z #########################
登录数据库:
$ docker exec -it ORCLCDB sqlplus / as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Fri Sep 8 09:09:14 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 FREEPDB1 READ WRITE NO
SQL> exit
Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
如果要离线用,Vagrant Box是一个不错的选择。
简介看这里。
和其它版本的Oracle不同,开发者版不需要预先下载安装介质,其实也没得可下。因此网速就很重要。
安装日志如下:
$ vagrant up
Bringing machine 'oracle23c-free-vagrant' up with 'virtualbox' provider...
==> oracle23c-free-vagrant: Importing base box 'oraclelinux/8'...
==> oracle23c-free-vagrant: Matching MAC address for NAT networking...
==> oracle23c-free-vagrant: Checking if box 'oraclelinux/8' version '8.8.485' is up to date...
==> oracle23c-free-vagrant: Setting the name of the VM: oracle23c-free-vagrant
==> oracle23c-free-vagrant: Clearing any previously set network interfaces...
==> oracle23c-free-vagrant: Preparing network interfaces based on configuration...
oracle23c-free-vagrant: Adapter 1: nat
==> oracle23c-free-vagrant: Forwarding ports...
oracle23c-free-vagrant: 1522 (guest) => 1522 (host) (adapter 1)
oracle23c-free-vagrant: 22 (guest) => 2222 (host) (adapter 1)
==> oracle23c-free-vagrant: Running 'pre-boot' VM customizations...
==> oracle23c-free-vagrant: Booting VM...
==> oracle23c-free-vagrant: Waiting for machine to boot. This may take a few minutes...
oracle23c-free-vagrant: SSH address: 127.0.0.1:2222
oracle23c-free-vagrant: SSH username: vagrant
oracle23c-free-vagrant: SSH auth method: private key
oracle23c-free-vagrant:
oracle23c-free-vagrant: Vagrant insecure key detected. Vagrant will automatically replace
oracle23c-free-vagrant: this with a newly generated keypair for better security.
...
==> oracle23c-free-vagrant: Machine booted and ready!
==> oracle23c-free-vagrant: Checking for guest additions in VM...
==> oracle23c-free-vagrant: Setting hostname...
==> oracle23c-free-vagrant: Mounting shared folders...
...
oracle23c-free-vagrant: INSTALLER: Started up
oracle23c-free-vagrant: Oracle Linux 8 BaseOS Latest (x86_64) 9.1 MB/s | 62 MB 00:06
oracle23c-free-vagrant: Oracle Linux 8 Application Stream (x86_64) 10 MB/s | 48 MB 00:04
oracle23c-free-vagrant: Latest Unbreakable Enterprise Kernel Release 7 7.5 MB/s | 19 MB 00:02
oracle23c-free-vagrant: Last metadata expiration check: 0:00:04 ago on Fri 08 Sep 2023 09:26:17 AM UTC.
oracle23c-free-vagrant: Dependencies resolved.
oracle23c-free-vagrant: =========================================================================================================
oracle23c-free-vagrant: Package Arch Version Repository Size
oracle23c-free-vagrant: =========================================================================================================
oracle23c-free-vagrant: Installing:
oracle23c-free-vagrant: kernel-uek-core x86_64 5.15.0-104.119.4.2.el8uek ol8_UEKR7 54 M
oracle23c-free-vagrant: kernel-uek-devel x86_64 5.15.0-104.119.4.2.el8uek ol8_UEKR7 20 M
oracle23c-free-vagrant: Upgrading:
oracle23c-free-vagrant: NetworkManager x86_64 1:1.40.16-4.0.1.el8_8 ol8_baseos_latest 2.3 M
oracle23c-free-vagrant: NetworkManager-libnm x86_64 1:1.40.16-4.0.1.el8_8 ol8_baseos_latest 1.9 M
oracle23c-free-vagrant: binutils x86_64 2.30-119.0.2.el8 ol8_baseos_latest 5.9 M
...
oracle23c-free-vagrant: Downloading Packages:
oracle23c-free-vagrant: (1/68): grub2-tools-efi-2.02-148.0.3.el8_8.1.x8 465 kB/s | 481 kB 00:01
oracle23c-free-vagrant: (2/68): NetworkManager-1.40.16-4.0.1.el8_8.x86_ 2.3 MB/s | 2.3 MB 00:00
oracle23c-free-vagrant: (3/68): NetworkManager-libnm-1.40.16-4.0.1.el8_ 6.1 MB/s | 1.9 MB 00:00
oracle23c-free-vagrant: (4/68): binutils-2.30-119.0.2.el8.x86_64.rpm 4.0 MB/s | 5.9 MB 00:01
oracle23c-free-vagrant: (5/68): kernel-uek-devel-5.15.0-104.119.4.2.el8 4.7 MB/s | 20 MB 00:04
...
oracle23c-free-vagrant: Complete!
oracle23c-free-vagrant: INSTALLER: System updated
...
oracle23c-free-vagrant: Installed:
oracle23c-free-vagrant: oraclelinux-developer-release-el8-1.0-7.el8.x86_64
oracle23c-free-vagrant:
oracle23c-free-vagrant: Complete!
...
oracle23c-free-vagrant: Complete!
oracle23c-free-vagrant: INSTALLER: Oracle preinstall and openssl complete
oracle23c-free-vagrant: INSTALLER: Environment variables set
oracle23c-free-vagrant: INSTALLER: Downloading Oracle Database software
oracle23c-free-vagrant: Last metadata expiration check: 0:03:36 ago on Fri 08 Sep 2023 05:30:37 PM +08.
oracle23c-free-vagrant: Dependencies resolved.
oracle23c-free-vagrant: ================================================================================
oracle23c-free-vagrant: Package Arch Version Repository Size
oracle23c-free-vagrant: ================================================================================
oracle23c-free-vagrant: Installing:
oracle23c-free-vagrant: oracle-database-free-23c x86_64 1.0-1 @commandline 1.6 G
oracle23c-free-vagrant:
oracle23c-free-vagrant: Transaction Summary
oracle23c-free-vagrant: ================================================================================
oracle23c-free-vagrant: Install 1 Package
oracle23c-free-vagrant:
oracle23c-free-vagrant: Total size: 1.6 G
oracle23c-free-vagrant: Installed size: 5.2 G
oracle23c-free-vagrant: Downloading Packages:
oracle23c-free-vagrant: Running transaction check
oracle23c-free-vagrant: Transaction check succeeded.
oracle23c-free-vagrant: Running transaction test
oracle23c-free-vagrant: Transaction test succeeded.
oracle23c-free-vagrant: Running transaction
oracle23c-free-vagrant: Preparing : 1/1
oracle23c-free-vagrant: Running scriptlet: oracle-database-free-23c-1.0-1.x86_64 1/1
oracle23c-free-vagrant: Installing : oracle-database-free-23c-1.0-1.x86_64 1/1
oracle23c-free-vagrant: Running scriptlet: oracle-database-free-23c-1.0-1.x86_64 1/1
oracle23c-free-vagrant: [INFO] Executing post installation scripts...
oracle23c-free-vagrant: [INFO] Oracle home installed successfully and ready to be configured.
oracle23c-free-vagrant: To configure Oracle Database Free, optionally modify the parameters in '/etc/sysconfig/oracle-free-23c.conf' and then run '/etc/init.d/oracle-free-23c configure' as root.
oracle23c-free-vagrant:
oracle23c-free-vagrant: Verifying : oracle-database-free-23c-1.0-1.x86_64 1/1
oracle23c-free-vagrant:
oracle23c-free-vagrant: Installed:
oracle23c-free-vagrant: oracle-database-free-23c-1.0-1.x86_64
oracle23c-free-vagrant:
oracle23c-free-vagrant: Complete!
oracle23c-free-vagrant: INSTALLER: Oracle software installed
oracle23c-free-vagrant: Configuring Oracle Listener.
oracle23c-free-vagrant: Listener configuration succeeded.
oracle23c-free-vagrant: Configuring Oracle Database FREE.
oracle23c-free-vagrant: Enter SYS user password:
oracle23c-free-vagrant: ***************
oracle23c-free-vagrant: Enter SYSTEM user password:
oracle23c-free-vagrant: **************
oracle23c-free-vagrant: Enter PDBADMIN User Password:
oracle23c-free-vagrant: ***************
oracle23c-free-vagrant: Prepare for db operation
oracle23c-free-vagrant: 7% complete
oracle23c-free-vagrant: Copying database files
oracle23c-free-vagrant: 29% complete
oracle23c-free-vagrant: Creating and starting Oracle instance
oracle23c-free-vagrant: 30% complete
oracle23c-free-vagrant: 33% complete
oracle23c-free-vagrant: 36% complete
oracle23c-free-vagrant: 39% complete
oracle23c-free-vagrant: 43% complete
oracle23c-free-vagrant: Completing Database Creation
oracle23c-free-vagrant: 47% complete
oracle23c-free-vagrant: 49% complete
oracle23c-free-vagrant: 50% complete
oracle23c-free-vagrant: Creating Pluggable Databases
oracle23c-free-vagrant: 54% complete
oracle23c-free-vagrant: 71% complete
oracle23c-free-vagrant: Executing Post Configuration Actions
oracle23c-free-vagrant: 93% complete
oracle23c-free-vagrant: Running Custom Scripts
oracle23c-free-vagrant: 100% complete
oracle23c-free-vagrant: Database creation complete. For details check the logfiles at:
oracle23c-free-vagrant: /opt/oracle/cfgtoollogs/dbca/FREE.
oracle23c-free-vagrant: Database Information:
oracle23c-free-vagrant: Global Database Name:FREE
oracle23c-free-vagrant: System Identifier(SID):FREE
oracle23c-free-vagrant: Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.
oracle23c-free-vagrant:
oracle23c-free-vagrant: Connect to Oracle Database using one of the connect strings:
oracle23c-free-vagrant: Pluggable database: localhost.localdomain:1522/FREEPDB1
oracle23c-free-vagrant: Multitenant container database: localhost.localdomain:1522
oracle23c-free-vagrant: INSTALLER: Database created
oracle23c-free-vagrant: oracle-free-23c.service is not a native service, redirecting to systemd-sysv-install.
oracle23c-free-vagrant: Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-free-23c
oracle23c-free-vagrant: INSTALLER: Created and enabled oracle-free-23c systemd service
oracle23c-free-vagrant: INSTALLER: setPassword.sh file set up
oracle23c-free-vagrant: INSTALLER: Running user-defined post-setup scripts
oracle23c-free-vagrant: INSTALLER: Done running user-defined post-setup scripts
oracle23c-free-vagrant: ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: uqNAuvC8dPI=1
oracle23c-free-vagrant: INSTALLER: Installation complete, database ready to use!
耗时半小时:
real 29m36.329s
user 0m0.015s
sys 0m0.016s
初始安装11.1GB,比企业版小一些。
登录正常:
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Fri Sep 8 17:57:12 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 FREEPDB1 READ WRITE NO
SQL> exit
Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
需要安装Virtual Box,其实上一个Vagrant Box也是需要的。下载页面见这里。
大小约7G,因为是图形界面的,可能会比Vagrant Box要慢一点点。