Introduction
The use of a local Ollama server or Oracle Private AI Services Container addresses many of Data Sovereignty, Governance and Security risks and associated issues and latency concerns with the use the internet and public Cloud AI service.
I have previously shared how the we can securely generate Vector Embeddings using the Oracle Private AI Services Container from within the Oracle AI Database 26ai using the UTL_HTTP and DBMS_VECTOR database packages.
In this post I share how we can also use a local Ollama server to generate Vector Embeddings, again keeping all data local, removing dependancies and security concerns with the use of Internet or Cloud AI services.
Note: The Oracle AI Database 26ai supports the secure generation of vector embeddings within database, however this does consume precious database server CPU cycles, this is currently limited to a single thread, to minimise impact.
Setup Ollama
We can install Ollama from the from Ollama’s Official Website or pasting:
$ curl -fsSL https://ollama.com/install.sh | sh
Check version using ollama -v, use ollama ls (or ollama list) to show all downloaded models.
Note: ollama ps only shows models currently active / loaded.
% ollama --version
ollama version is 0.32.1
% ollama ls
NAME ID SIZE MODIFIED
NAME ID SIZE MODIFIED
deepseek-r1:1.5b e0979632db5a 1.1 GB 6 days ago
qwen2.5-coder:7b dae161e27b0e 4.7 GB 6 days ago
gemma3:270m e7d36fb2c3b3 291 MB 6 days ago
nomic-embed-text:latest 0a109f422b47 274 MB 8 days ago
mxbai-embed-large:latest 468836162de7 669 MB 8 days ago
qwen3:8b 500a1f067a9f 5.2 GB 8 days ago
llama3.1:latest 46e0c10c039e 4.9 GB 9 days ago
gemma3:latest a2af6cc3eb7f 3.3 GB 6 weeks ago
Pull Model
For this blog post I will be using the small all-minilm model which has 512 dimensions.
As I have not previously downloaded this model, I will need to pull it from the Ollama repository using ollama pull <model name> command.
% ollama pull all-minilm:latest
pulling manifest
pulling 797b70c4edf8: 100% ▕████████████████████████████████████████████████████████████████████████████████████████▏ 45 MB
pulling c71d239df917: 100% ▕████████████████████████████████████████████████████████████████████████████████████████▏ 11 KB
pulling 85011998c600: 100% ▕████████████████████████████████████████████████████████████████████████████████████████▏ 16 B
pulling 548455b72658: 100% ▕████████████████████████████████████████████████████████████████████████████████████████▏ 407 B
verifying sha256 digest
writing manifest
success
% ollama ls
NAME ID SIZE MODIFIED
all-minilm:latest 1b226e2802db 45 MB 4 minutes ago
Show Model
Use ollama show <model> command to list model’s architecture, parameters, and license, for example:
$ ollama show all-minilm:latest
Model
architecture bert
parameters 23M
context length 512
embedding length 384
quantization F16
Capabilities
embedding
Parameters
num_ctx 256
License
Apache License
Version 2.0, January 2004
...
Ollama Test
Before attempting to use the Ollama server from Oracle AI Database 26ai, confirm you can create Vector Embeddings using curl, for example:
curl http://localhost:11434/api/embed \ -s -d '{ "model": "all-minilm:latest", "input": [ "A lovestruck Romeo sang the streets a serenade","Laying everybody low with a love song that he made" ]}' | jq -a
Curl Results:
{
"model": "all-minilm:latest",
"embeddings": [
[
-0.005925364,
-0.027802076,
0.054730162,
-0.000115416384,
...
0.06285159,
0.018251492,
-0.032693047
]
],
"total_duration": 64582458,
"load_duration": 38091897,
"prompt_eval_count": 25
}
What is the DBMS_VECTOR package?
The Oracle AI Database 26ai DBMS_VECTOR package provides APIs to support common operations with Oracle AI Vector Search, such as extracting chunks or embeddings from user data, generating text for a given prompt, creating a vector index, or reporting on index accuracy.
Using the DBMS_VECTOR.UTL_TO_EMEDDING database package we can securely, off-load the generation of Vector embeddings to an Ollama Server, or alternatively the Oracle Private AI Services Container or
Calling Ollama Server using DBMS_VECTOR
The Ollama Server does not support https and therefore does not require credentials to be set-up using DBMS_VECTOR.CREATE_CREDENTIAL to use DBMS_VECTOR.UTL_TO_EMEDDING database package.
set serveroutput onDECLARE input clob; v_embedding VECTOR; v_text_rep CLOB;BEGIN input := '"A lovestruck Romeo sang the streets a serenade","Laying everybody low with a love song that he made"'; dbms_output.put_line('Create Emeddings for '|| input ); v_embedding := DBMS_VECTOR.UTL_TO_EMBEDDING( input, json('{"provider": "ollama", "url": "http://localhost:11434/api/embed", "host": "local", "model": "all-minilm:latest" }')); -- Serialize the vector to a JSON-formatted string v_text_rep := vector_serialize(v_embedding); -- Output the serialized vector to the consoleNE dbms_output.put_line('Vector Embedding: ' || v_text_rep);EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE (SQLERRM); DBMS_OUTPUT.PUT_LINE (SQLCODE);END;/EXIT
For example:
$ sqlplus vector_user/vector_user@//localhost/pdb1 @create_embedding_ollama.sql
SQL*Plus: Release 23.26.1.0.0 - Production on Thu Jul 2 15:15:24 2026
Version 23.26.1.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Thu Jul 02 2026 14:47:57 +01:00
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
Create Emeddings for "A lovestruck Romeo sang the streets a serenade","Laying
everybody low with a love song that he made"
Vector Embedding:
[2.04757452E-002,-7.96012115E-003,6.13267981E-002,-6.94568269E-003,-2.60528512E-
002,4.29660734E-003,6.28224388E-002,8.35225284E-002,-4.63901274E-002,-9.1749765E
-002,-6.336967E-003,6.99065104E-002,5.36576398E-002,-2.2692224E-002,5.13577163E-
...
E-003,1.33269029E-002,-4.00617085E-002,-1.41914394E-002,-2.80153565E-002,-5.6419
6371E-002,-4.08778675E-002,-1.30573269E-002,-2.33848975E-003,-1.3885661E-002,-8.
10461771E-003,1.25096187E-001,-1.94024909E-002,-6.9306694E-002,-2.47027036E-002,
8.75540301E-002,3.0594185E-002,-8.01704526E-002]
PL/SQL procedure successfully completed.
Disconnected from Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
Summary
In this post I have shared how an Oracle AI Database 26ai can securely generate Vector embeddings without any dependancy on the public cloud or internet through the use of a local Ollama server.

Leave a Reply