Oracle Database Api for MongoDB Installation Steps
Oracle Database 23ai, previously known as Oracle Database 23c, has been released on May 2, 2024. I am happy that i could have a chance to test it in action in the first weeks. I have installed it using rpm method and also this is the first I have installed Oracle Database Software with a rpm package.
First i will download the latest Generally Available setup file.
[root@oradev01 ~]# curl -L -o oracle-database-free-23ai-1.0-1.el8.x86_64.rpm https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23ai-1.0-1.el8.x86_64.rpm
After downloading the required setup file. I will install it using dnf package manager.
| [root@oradev01 ~]# dnf install -y oracle-database-free-23ai | |
| Last metadata expiration check: 0:03:50 ago on Sat 04 May 2024 10:42:18 PM +03. | |
| Dependencies resolved. | |
| ========================================================================================================================================= | |
| Package Architecture Version Repository Size | |
| ========================================================================================================================================= | |
| Installing: | |
| oracle-database-free-23ai x86_64 1.0-1 @commandline 1.3 G | |
| Installing dependencies: | |
| compat-openssl10 x86_64 1:1.0.2o-4.el8_6 ol8_appstream 1.1 M | |
| glibc-devel x86_64 2.28-211.0.1.el8 ol8_baseos_latest 83 k | |
| ksh x86_64 20120801-259.0.1.el8 ol8_appstream 923 k | |
| libxcrypt-devel x86_64 4.1.1-6.el8 ol8_baseos_latest 25 k | |
| lm_sensors-libs x86_64 3.4.0-23.20180522git70f7e08.el8 ol8_baseos_latest 59 k | |
| make x86_64 1:4.2.1-11.el8 ol8_baseos_latest 498 k | |
| oracle-database-preinstall-23ai x86_64 1.0-2.el8 ol8_appstream 30 k | |
| sysstat x86_64 11.7.3-11.0.1.el8 ol8_appstream 427 k | |
| Transaction Summary | |
| ========================================================================================================================================= | |
| Install 9 Packages | |
| … | |
| [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. | |
After installation completed, modify the parameters in ‘/etc/sysconfig/oracle-free-23ai.conf’ and then run ‘/etc/init.d/oracle-free-23ai configure’ as root. I have changed the default listener port to 1426. This is my school number.
[root@oradev01 ~]# vi /etc/sysconfig/oracle-free-23ai.conf
...
# LISTENER PORT used Database listener, Leave empty for automatic port assignment
LISTENER_PORT=1426
..
# DB Domain name
DB_DOMAIN=localdomain
...
| [root@oradev01 ~]# /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.localdomain | |
| 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: oradev01.localdomain:1426/FREEPDB1 | |
| Multitenant container database: oradev01.localdomain:1426 | |
| Oracle Home is configured as "/opt/oracle/product/23ai/dbhomeFree" | |
I’m going to establish a directory for ORDS and a separate directory for its configuration. Specifically, I’ve opted for /home/oracle/ords and /home/oracle/ordsconf
[root@oradev01 ~]# mkdir -p /home/oracle
[root@oradev01 ~]# chown -R oracle:oinstall /home/oracle
[oracle@oradev01 ~]$ mkdir /home/oracle/ordsconfig
[oracle@oradev01 ~]$ mkdir /home/oracle/ords
Download latest ORDS (Oracle Rest Data Service) setup file and unzip it.
[oracle@oradev01 ~]$ curl -L -o ords-latest.zip https://download.oracle.com/otn_software/java/ords/ords-latest.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116M 100 116M 0 0 10.3M 0 0:00:11 0:00:11 --:--:-- 10.2M
[oracle@oradev01 ~]$ unzip /home/oracle/ords-latest.zip -d /home/oracle/ords
After setting environment variables, I will install it with the commands provided below.
| [oracle@oradev01 ~]$ export ORDS_CONFIG=/home/oracle/ordsconfig | |
| [oracle@oradev01 ~]$ export PATH=/home/oracle/ords/bin:/opt/oracle/product/23ai/dbhomeFree/jdk/bin:$PATH | |
| [oracle@oradev01 ~]$ export JAVA_HOME=/opt/oracle/product/23ai/dbhomeFree/jdk | |
| [oracle@oradev01 ords]$ export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree | |
| [oracle@oradev01 ~]$ cd ords | |
| [oracle@oradev01 ords]$ ords install | |
| ORDS: Release 24.1 Production on Sat May 04 20:19:24 2024 | |
| Copyright (c) 2010, 2024, Oracle. | |
| Configuration: | |
| /home/oracle/ordsconfig | |
| The configuration folder /home/oracle/ordsconfig does not contain any configuration files. | |
| Oracle REST Data Services – Interactive Install | |
| Enter a number to select the TNS net service name to use from /opt/oracle/product/23ai/dbhomeFree/network/admin/tnsnames.ora or specify the database connection | |
| [1] FREE SERVICE_NAME=FREE.localdomain | |
| [S] Specify the database connection | |
| Choose [1]: 1 | |
| Provide database user name with administrator privileges. | |
| Enter the administrator username: sys | |
| Enter the database password for SYS AS SYSDBA: | |
| Retrieving information… | |
| Your database connection is to a CDB. ORDS common user ORDS_PUBLIC_USER will be created in the CDB. ORDS schema will be installed in the PDBs. | |
| Root CDB$ROOT – create ORDS common user | |
| PDB PDB$SEED – install ORDS 24.1.1.r1201228 (mode is READ ONLY, open for READ/WRITE) | |
| PDB FREEPDB1 – install ORDS 24.1.1.r1201228 | |
| Install ORDS in the database | |
| [1] Yes | |
| [2] No | |
| Choose [1]: 1 | |
| ORDS is not installed in the database. ORDS installation is required. | |
| Enter a number to update the value or select option A to Accept and Continue | |
| [1] Connection Type: TNS | |
| [2] TNS Connection: TNS_NAME=FREE TNS_FOLDER=/opt/oracle/product/23ai/dbhomeFree/network/admin | |
| Administrator User: SYS AS SYSDBA | |
| [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <generate> | |
| [4] ORDS runtime user and schema tablespaces: Default: SYSAUX Temporary TEMP | |
| [5] Additional Feature: Database Actions | |
| [6] Configure and start ORDS in Standalone Mode: Yes | |
| [7] Protocol: HTTP | |
| [8] HTTP Port: 8080 | |
| [A] Accept and Continue – Create configuration and Install ORDS in the database | |
| [Q] Quit – Do not proceed. No changes | |
| Choose [A]: A | |
| The setting named: db.connectionType was set to: tns in configuration: default | |
| The setting named: db.tnsAliasName was set to: FREE in configuration: default | |
| The setting named: db.tnsDirectory was set to: /opt/oracle/product/23ai/dbhomeFree/network/admin in configuration: default | |
| The setting named: db.serviceNameSuffix was set to: .localdomain in configuration: default | |
| The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: default | |
| The setting named: db.password was set to: ****** in configuration: default | |
| The setting named: feature.sdw was set to: true in configuration: default | |
| The global setting named: database.api.enabled was set to: true | |
| The setting named: restEnabledSql.active was set to: true in configuration: default | |
| The global setting named: standalone.http.port was set to: 8080 | |
| The global setting named: standalone.static.context.path was set to: /ords | |
| The global setting named: standalone.doc.root was set to: /home/oracle/ordsconfig/global/doc_root | |
| The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: default | |
| 2024-05-04T20:21:21.560Z INFO Created folder /home/oracle/ords/logs | |
| 2024-05-04T20:21:21.561Z INFO The log file is defaulted to the current working directory located at /home/oracle/ords/logs | |
| 2024-05-04T20:21:21.680Z INFO Installing Oracle REST Data Services version 24.1.1.r1201228 in CDB$ROOT | |
| 2024-05-04T20:21:22.849Z INFO … Verified database prerequisites | |
| 2024-05-04T20:21:23.206Z INFO … Created Oracle REST Data Services proxy user | |
| 2024-05-04T20:21:23.314Z INFO Completed installation for Oracle REST Data Services version 24.1.1.r1201228. Elapsed time: 00:00:01.584 | |
| 2024-05-04T20:21:24.078Z INFO Installing Oracle REST Data Services version 24.1.1.r1201228 in PDB$SEED | |
| 2024-05-04T20:21:24.340Z INFO … Verified database prerequisites | |
| 2024-05-04T20:21:24.727Z INFO … Created Oracle REST Data Services proxy user | |
| 2024-05-04T20:21:25.180Z INFO … Created Oracle REST Data Services schema | |
| 2024-05-04T20:21:25.811Z INFO … Granted privileges to Oracle REST Data Services | |
| 2024-05-04T20:21:28.582Z INFO … Created Oracle REST Data Services database objects | |
| 2024-05-04T20:21:38.674Z INFO Completed installation for Oracle REST Data Services version 24.1.1.r1201228. Elapsed time: 00:00:14.594 | |
| 2024-05-04T20:21:39.662Z INFO Installing Oracle REST Data Services version 24.1.1.r1201228 in FREEPDB1 | |
| 2024-05-04T20:21:39.792Z INFO … Verified database prerequisites | |
| 2024-05-04T20:21:40.038Z INFO … Created Oracle REST Data Services proxy user | |
| 2024-05-04T20:21:40.271Z INFO … Created Oracle REST Data Services schema | |
| 2024-05-04T20:21:40.729Z INFO … Granted privileges to Oracle REST Data Services | |
| 2024-05-04T20:21:43.429Z INFO … Created Oracle REST Data Services database objects | |
| 2024-05-04T20:21:51.552Z INFO Completed installation for Oracle REST Data Services version 24.1.1.r1201228. Elapsed time: 00:00:11.889 | |
| 2024-05-04T20:21:51.553Z INFO Completed CDB installation for Oracle REST Data Services version 24.1.1.r1201228. Total elapsed time: 00:00:29.882 | |
| 2024-05-04T20:21:51.554Z INFO Log file written to /home/oracle/ords/logs/ords_cdb_install_2024-05-04_202121_56151.log | |
| 2024-05-04T20:21:51.687Z INFO HTTP and HTTP/2 cleartext listening on host: 0.0.0.0 port: 8080 | |
| 2024-05-04T20:21:51.703Z INFO Disabling document root because the specified folder does not exist: /home/oracle/ordsconfig/global/doc_root | |
| 2024-05-04T20:21:51.704Z INFO Default forwarding from / to contextRoot configured. | |
| 2024-05-04T20:21:54.036Z INFO Configuration properties for: |default|lo| | |
| db.password=****** | |
| db.serviceNameSuffix=.localdomain | |
| db.tnsAliasName=FREE | |
| conf.use.wallet=true | |
| security.requestValidationFunction=ords_util.authorize_plsql_gateway | |
| standalone.static.context.path=/ords | |
| database.api.enabled=true | |
| db.username=ORDS_PUBLIC_USER | |
| standalone.http.port=8080 | |
| restEnabledSql.active=true | |
| resource.templates.enabled=false | |
| feature.sdw=true | |
| config.required=true | |
| db.connectionType=tns | |
| standalone.doc.root=/home/oracle/ordsconfig/global/doc_root | |
| db.tnsDirectory=/opt/oracle/product/23ai/dbhomeFree/network/admin | |
| 2024-05-04T20:21:54.037Z WARNING *** jdbc.MaxLimit in configuration |default|lo| is using a value of 10, this setting may not be sized adequately for a production environment *** | |
| 2024-05-04T20:21:54.037Z WARNING *** jdbc.InitialLimit in configuration |default|lo| is using a value of 10, this setting may not be sized adequately for a production environment *** | |
| 2024-05-04T20:21:56.689Z INFO | |
| Mapped local pools from /home/oracle/ordsconfig/databases: | |
| /ords/ => default => VALID | |
| 2024-05-04T20:21:56.782Z INFO Oracle REST Data Services initialized | |
| Oracle REST Data Services version : 24.1.1.r1201228 | |
| Oracle REST Data Services server info: jetty/10.0.20 | |
| Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 11.0.23+7-LTS-222 | |
| — | |
| ORDS will now start. You will see a lot of output, then the session may appear to hang. This is simply because the ORDS server is running in this session. We need to do some further manual configuration, so stop the server using CTRL-C. | |
Next, I’ll proceed to configure ORDS, enabling the MongoDB API and setting it to serve on a custom port (27003).
| [oracle@oradev01 ~]$ export ORDS_CONFIG=/home/oracle/ordsconfig | |
| [oracle@oradev01 ~]$ export PATH=/home/oracle/ords/bin:/opt/oracle/product/23ai/dbhomeFree/jdk/bin:$PATH | |
| [oracle@oradev01 ~]$ export JAVA_HOME=/opt/oracle/product/23ai/dbhomeFree/jdk | |
| [oracle@oradev01 ords]$ export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree | |
| [oracle@oradev01 ords]$ ords config set mongo.enabled true | |
| [oracle@oradev01 ords]$ ords config set mongo.port 27003 | |
| ORDS: Release 24.1 Production on Sat May 04 20:24:41 2024 | |
| Copyright (c) 2010, 2024, Oracle. | |
| Configuration: | |
| /home/oracle/ordsconfig | |
| The global setting named: mongo.enabled was set to: true | |
| [oracle@oradev01 ords]$ ords serve | |
| ORDS: Release 24.1 Production on Sat May 04 20:26:47 2024 | |
| Copyright (c) 2010, 2024, Oracle. | |
| Configuration: | |
| /home/oracle/ordsconfig | |
| 2024-05-04T20:26:48.929Z INFO HTTP and HTTP/2 cleartext listening on host: 0.0.0.0 port: 8080 | |
| 2024-05-04T20:26:48.957Z INFO Disabling document root because the specified folder does not exist: /home/oracle/ordsconfig/global/doc_root | |
| 2024-05-04T20:26:48.958Z INFO Default forwarding from / to contextRoot configured. | |
| 2024-05-04T20:26:49.003Z SEVERE ORAMLVERSION null | |
| 2024-05-04T20:26:49.007Z INFO Oracle API for MongoDB listening on port: 27003 | |
| 2024-05-04T20:26:49.007Z INFO The Oracle API for MongoDB connection string is: | |
| mongodb://[{user}:{password}@]localhost:27003/{user}?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true | |
| 2024-05-04T20:26:52.065Z INFO Configuration properties for: |default|lo| | |
| … |
Now that ORDS Installation and Configuration is complete, I’ll proceed to create a database user tailored for utilizing the MongoDB API and hosting JSON collections. This user will be granted the CONNECT, RESOURCE, and SODA_APP role privileges, along with an appropriate tablespace quota. I’ve chosen to name this user ‘INSANEDBA’. Once the user is created, I’ll connect to the database using that user and enable ORDS for that schema. Below are the sql commands I’ve used.
| [oracle@oradev01 ~]$ sqlplus system/oracle@FREEPDB1 | |
| SQL> create user insanedba identified by insane; | |
| SQL> grant connect,resource to insanedba; | |
| SQL> grant SODA_APP to insanedba; | |
| SQL> alter user insanedba quota unlimited on users; | |
| [oracle@oradev01 ~]$ sqlplus insanedba/insane@freepdb1 | |
| SQL*Plus: Release 23.0.0.0.0 – Production on Sat May 4 23:56:27 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> exec ords.enable_schema(true); | |
| PL/SQL procedure successfully completed. |
My server is called 192.168.60.203, my database username is ‘insanedba’ and my database password is ‘insane’ . If you are running ORDS over HTTP or over HTTPS with a self-signed certificate, you will need to to specify –tlsAllowInvalidCertificates
Let’s connect it.
[root@mongo01 ~]# mongosh --tlsAllowInvalidCertificates 'mongodb://insanedba:insane@192.168.60.203:27003/insanedba?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
Current Mongosh Log ID: 6636b1260bdb82c3d72202d7
Connecting to: mongodb://<credentials>@192.168.60.203:27003/insanedba?authMechanism=PLAIN&authSource=%24external&ssl=true&retryWrites=false&loadBalanced=true&tlsAllowInvalidCertificates=true&appName=mongosh+2.2.5
Using MongoDB: 4.2.14
Using Mongosh: 2.2.5
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
Hope it helps.


Leave your comment