Oracle 23ai Vector Search 系列之3 集成嵌入生成模型(Embedding Model)到数据库示例,以及常见错误

文章目录

【声明】文章仅供学习交流,观点代表个人,与任何公司无关。
来源|Walt@SQL和数据库技术(ID:SQLplusDB)

Windows 环境图形化安装 Oracle 23ai
Oracle 23ai Vector Search 系列之1 架构基础
Oracle 23ai Vector Search 系列之2 ONNX(Open Neural Network Exchange)

通常数据库要实现向量查询和RAG功能,就需要和嵌入生成模型(Embedding Model)交互,以便将文本等内容向量化,实现向量查询等功能。

Oracle通过将ONNX格式的嵌入生成模型集成到数据库中,更加简化了向量化的过程,能够在数据库内部对向量化数据进行操作。

使用安装了Oracle 23ai 的虚拟机(Oracle Database 23ai Free VirtualBox Appliance)

我们也可以使用安装了Oracle 23ai 的虚拟机学习Oracle 23ai Vector Search。

https://www.oracle.com/database/free/get-started/

1.下载Oracle VM VirtualBox

https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html

2.下载Oracle DB Developer VM

Oracle Database 23ai Free VirtualBox Appliance信息如下:

https://www.oracle.com/database/technologies/databaseappdev-vm.html

下载Oracle DB Developer VM:https://download.oracle.com/otn_software/virtualbox/dd/Oracle_Database_23ai_Free_Developer.ova

3. 导入Oracle DB Developer VM

打开Oracle VM VirtualBox。

管理 --》导入虚拟电脑

参考:

https://www.oracle.com/database/technologies/databaseappdev-vm.html

4. 连接Oracle 23ai

复制代码
[oracle@10 admin]$ sql system/oracle@localhost:1521/free


SQLcl: Release 24.4 Production on Sat Mar 29 13:52:30 2025

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

Last Successful login time: Sat Mar 29 2025 13:52:33 +00:00

Connected to:
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.7.0.25.01

SQL> show pdbs

   CON_ID CON_NAME    OPEN MODE     RESTRICTED    
_________ ___________ _____________ _____________ 
        2 PDB$SEED    READ ONLY     NO            
        3 FREEPDB1    READ WRITE    NO            
SQL> 

集成嵌入生成模型(Embedding Model)到数据库Oracle 23ai中

1.下载ONNX格式的嵌入生成模型

通过如下链接下载ONNX格式的嵌入生成模型all-MiniLM-L12-v2压缩包,并解压。

https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VBRD9P8ZFWkKvnfhrWxkpPe8K03-JIoM5h_8EJyJcpE80c108fuUjg7R5L5O7mMZ/n/adwc4pm/b/OML-Resources/o/all_MiniLM_L12_v2_augmented.zip

例:(有时候下载速度很慢)

复制代码
[oracle@10 ~]$ mkdir -p /u02/models
[oracle@10 ~]$ cd /u02/models
[oracle@10 models]$ wget https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VBRD9P8ZFWkKvnfhrWxkpPe8K03-JIoM5h_8EJyJcpE80c108fuUjg7R5L5O7mMZ/n/adwc4pm/b/OML-Resources/o/all_MiniLM_L12_v2_augmented.zip
--2025-04-01 12:22:43--  https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VBRD9P8ZFWkKvnfhrWxkpPe8K03-JIoM5h_8EJyJcpE80c108fuUjg7R5L5O7mMZ/n/adwc4pm/b/OML-Resources/o/all_MiniLM_L12_v2_augmented.zip
Resolving adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com (adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com)... 134.70.28.1, 134.70.32.1, 134.70.24.1
Connecting to adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com (adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com)|134.70.28.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 122597346 (117M) [application/x-zip-compressed]
Saving to: 'all_MiniLM_L12_v2_augmented.zip'

all_MiniLM_L12_v2_augme  84%[=======================>     ]  98.22M  --.-KB/s    in 90m 30s 

2025-04-01 13:53:17 (18.5 KB/s) - Connection closed at byte 102989824. Retrying.

--2025-04-01 13:53:18--  (try: 2)  https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VBRD9P8ZFWkKvnfhrWxkpPe8K03-JIoM5h_8EJyJcpE80c108fuUjg7R5L5O7mMZ/n/adwc4pm/b/OML-Resources/o/all_MiniLM_L12_v2_augmented.zip
Connecting to adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com (adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com)|134.70.28.1|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 122597346 (117M), 19607522 (19M) remaining [application/x-zip-compressed]
Saving to: 'all_MiniLM_L12_v2_augmented.zip'

all_MiniLM_L12_v2_augmented.zip                       86%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++==>                ] 101.19M ugmented.zip             86%[++++++++++++++++++++++++>    ] 101.19M  --.-KB/s    eta 28m 2s 

gmented.zip              86%[++++++++++++++++++++++++>    ] 101.19M  --.-KB/s    eta 28m 12s
all_MiniLM_L12_v2_augmented.zip                       86%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++==>                ] 101.19M  --.-KB/s    in 5m 24s  

2025-04-01 13:58:45 (9.38 KB/s) - Connection closed at byte 106102784. Retrying.

--2025-04-01 13:58:47--  (try: 3)  https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VBRD9P8ZFWkKvnfhrWxkpPe8K03-JIoM5h_8EJyJcpE80c108fuUjg7R5L5O7mMZ/n/adwc4pm/b/OML-Resources/o/all_MiniLM_L12_v2_augmented.zip
Connecting to adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com (adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com)|134.70.28.1|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 122597346 (117M), 16494562 (16M) remaining [application/x-zip-compressed]
Saving to: 'all_MiniLM_L12_v2_augmented.zip'

all_MiniLM_L12_v2_augmented.zip                      100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++===============>] 116.92M  20.3KB/s    in 22m 28s 

2025-04-01 14:21:19 (12.0 KB/s) - 'all_MiniLM_L12_v2_augmented.zip' saved [122597346/122597346]

[oracle@10 models]$ 
[oracle@10 models]$ ls -larth
total 117M
-rw-rw-r--. 1 oracle oracle 117M Jul 15  2024 all_MiniLM_L12_v2_augmented.zip
drwxrwxrwx. 3 root   root     20 Apr  1 12:21 ..
drwxrwxrwx. 2 root   root     45 Apr  1 12:22 .
[oracle@10 models]$ unzip -oq all_MiniLM_L12_v2_augmented.zip
[oracle@10 models]$ ls -la
total 249932
drwxrwxrwx. 2 root   root         121 Apr  2 13:18 .
drwxrwxrwx. 3 root   root          20 Apr  1 12:21 ..
-rw-rw-r--. 1 oracle oracle 122597346 Jul 15  2024 all_MiniLM_L12_v2_augmented.zip
-rw-rw-r--. 1 oracle oracle 133322334 Jul 15  2024 all_MiniLM_L12_v2.onnx
-rw-rw-r--. 1 oracle oracle      4232 Jul 15  2024 README-ALL_MINILM_L12_V2-augmented.txt
[oracle@10 models]$ 

2.连接数据库创建用户和赋予相关权限

创建用户vector,并赋予相关权限

复制代码
[oracle@10 models]$ sqlplus /nolog

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 2 13:32:03 2025
Version 23.7.0.25.01

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

SQL> conn system/oracle@freepdb1
Connected.
SQL> create user if not exists vector_user identified by vector_user quota unlimited on users;

User created.

SQL> grant create session, db_developer_role, create mining model to vector_user;

Grant succeeded.

SQL> create or replace directory model_dir as '/u02/models';

Directory created.

SQL> grant read, write on directory model_dir to vector_user;

Grant succeeded.

DB_DEVELOPER_ROLE是Oracle 23ai引入的新角色,整合了CONNECT和RESOURCE角色,并增加了更多现代开发所需的权限,比如创建多维数据模型、机器学习模型等。

3.连接创建的用户,并导入嵌入模型到数据库中

连接创建的用户,并导入嵌入模型到数据库中。

DBMS_VECTOR.LOAD_ONNX_MODEL 是Oracle提供的存储过程,用于加载ONNX格式的机器学习模型,可以通过这个存储导入嵌入模型到数据库中。

复制代码
SQL> conn vector_user/vector_user@freepdb1
Connected.
SQL> column model_name format a30
SQL> column algorithm format a10
SQL> column mining_function format a15
SQL> 
SQL> select model_name, algorithm, mining_function
from   user_mining_models
where  model_name = 'ALL_MINILM_L12_V2';  2    3  

no rows selected

SQL> begin
  dbms_vector.drop_onnx_model (
    model_name => 'ALL_MINILM_L12_V2',
    force => true);
  dbms_vector.load_onnx_model (
    directory  => 'model_dir',
    file_name  => 'all_MiniLM_L12_v2.onnx',
    model_name => 'ALL_MINILM_L12_V2');
end;
/  2    3    4    5    6    7    8    9   10  

PL/SQL procedure successfully completed.

SQL> select model_name, algorithm, mining_function
from   user_mining_models
where  model_name = 'ALL_MINILM_L12_V2';
  2    3  
MODEL_NAME		       ALGORITHM  MINING_FUNCTION
------------------------------ ---------- ---------------
ALL_MINILM_L12_V2	       ONNX	  EMBEDDING

SQL> 

参数说明:

复制代码
dbms_vector.drop_onnx_model :删除数据库中的同名模型。
dbms_vector.load_onnx_model :加载ONNX格式的机器学习模型。

directory => 'model_dir':指定数据库目录对象(Directory Object),需提前创建并授权访问。
file_name => 'all_MiniLM_L12_v2.onnx':模型文件名。
model_name => 'ALL_MINILM_L12_V2':模型在数据库中的注册名称。

4. 验证使用数据库中的embedding模型的有效性

可以通过VECTOR_EMBEDDING调用嵌入模型将非结构化文本转换为高维向量,用于支持语义相似性搜索。

例:

复制代码
SQL> SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;

EMBEDDING
--------------------------------------------------------------------------------
[-6.43850565E-002,5.03143901E-003,1.80688109E-002,-8.61809477E-002,

SQL> 
SQL> set linesize 200
SQL> set pagesize 200
SQL> set long 1000000
SQL>  SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;

EMBEDDING
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[-6.43850565E-002,5.03143901E-003,1.80688109E-002,-8.61809477E-002,-4.99122478E-002,-8.3715409E-002,1.43890858E-001,5.20461276E-002,-4.45289575E-002,5.04111163E-002,5.35465404E-002,-3.6635343E-002,5.0
1451083E-002,4.8450999E-002,-3.35157067E-002,1.34193935E-002,-4.48238626E-002,-2.00252961E-002,-4.71122302E-002,-6.7698285E-002,-6.7364715E-002,2.39551272E-002,3.05007547E-002,4.39321697E-002,-3.45703
363E-002,-1.40973898E-002,-1.97449443E-003,-3.17168608E-002,2.54482701E-002,-7.70462006E-002,4.26407866E-002,3.52319591E-002,-3.72547507E-002,2.08648369E-002,5.51127158E-002,-1.85566079E-002,4.2715370
7E-002,-2.00223532E-002,6.17853962E-002,2.03687139E-002,-2.81144921E-002,1.27106467E-002,4.3069087E-002,3.92189948E-003,8.14345628E-002,-6.31049424E-002,3.46092097E-002,-5.73917255E-002,3.63145396E-00
2,5.36485687E-002,1.69530627E-003,-7.27072284E-002,1.82723179E-002,6.82432353E-002,4.14318265E-003,-9.51752514E-002,1.74094271E-002,-3.32689681E-003,-1.93911593E-003,2.31539831E-003,-1.55733433E-003,-
6.28412142E-003,7.25491866E-002,-1.97887477E-002,-7.15509709E-003,5.40855043E-002,-3.41396295E-002,-2.56884005E-002,4.33707945E-002,5.23059107E-002,-5.13249226E-002,4.53912057E-002,4.44020936E-003,-1.
47001715E-002,6.61578104E-002,2.58654021E-002,1.86825078E-002,-1.23911109E-002,-1.10124405E-002,7.22084055E-003,-2.86916569E-002,-5.70247211E-002,6.33795336E-002,3.98731343E-002,-3.08062769E-002,-1.70
696247E-002,3.58993523E-002,5.88589795E-002,-5.67766577E-002,4.22158204E-002,-1.85518025E-003,6.22229315E-002,5.74523099E-002,-6.49972782E-002,-2.97813788E-002,3.20451818E-002,2.47529875E-002,-5.95198
609E-002,-5.83154261E-002,3.37650776E-001,-4.54414487E-002,8.30924138E-003,2.65924949E-002,2.01659221E-002,-4.23384234E-002,-3.77495289E-002,1.68698449E-002,-1.00797964E-002,2.995391E-002,1.71289667E-
002,-4.48190495E-002,-4.8588356E-003,-2.68799942E-002,9.14681256E-002,1.2878214E-002,-2.57672295E-002,6.7953527E-002,1.43582551E-002,-7.23189041E-002,2.02958733E-002,-4.62799391E-004,-3.97189148E-002,
-9.83916074E-002,-5.30900471E-002,1.94755774E-002,-1.76234961E-001,2.76067406E-002,-2.0204328E-002,-2.0005377E-002,6.3489534E-002,1.31017849E-001,-6.57900609E-003,-6.55860528E-002,-1.58854611E-002,-2.
03559436E-002,-9.10902862E-003,-7.3361814E-002,1.08494225E-003,-2.1784611E-002,-1.00225255E-001,1.29981562E-002,3.86199951E-002,4.45611887E-002,-8.12717825E-002,3.51700373E-002,-6.91951066E-003,4.4587
0571E-002,-3.90922576E-002,9.32496134E-003,-1.66717973E-002,8.63657743E-002,7.6263167E-002,3.25510204E-002,5.79238683E-003,-2.40888558E-002,-8.86389315E-002,-5.78965805E-003,-1.78106688E-002,1.631088E
-002,-9.74288732E-002,-4.0102236E-002,4.39315513E-002,-1.68476067E-002,-8.62947628E-002,2.57447269E-002,-3.11112851E-002,3.01416218E-002,-1.69337913E-003,3.53706405E-002,-6.42254204E-002,7.1062278E-00
3,3.75487432E-002,8.67136102E-003,1.96516514E-002,2.88740993E-002,-6.9221735E-002,2.84080207E-002,1.58961546E-002,-2.31828708E-002,-2.43958682E-002,1.8273497E-002,3.40319239E-002,1.26943197E-002,-1.35
59768E-002,-4.62375209E-002,6.48473278E-002,-1.0695783E-001,-5.65654598E-003,4.07952741E-002,3.22725512E-002,3.00344564E-002,-2.34780069E-002,-1.79869181E-003,3.72297526E-003,3.04003526E-003,-8.142019
06E-002,-5.98497828E-003,-4.4241637E-002,-5.64990677E-002,1.6877966E-002,1.29090054E-002,1.54750166E-003,-6.09726571E-002,4.03976962E-002,1.8584918E-003,3.43348123E-002,9.58639532E-002,5.28544895E-002
,-4.17789221E-002,-7.08777457E-002,3.60478414E-003,3.81915574E-003,-7.96151464E-004,3.10286484E-003,-3.58613767E-003,4.88146432E-002,5.31559922E-002,2.94029154E-002,-6.99412301E-002,3.13350782E-002,6.
30677715E-002,-2.24168114E-002,-3.37830409E-002,1.96636945E-032,2.70832088E-002,5.57848364E-002,3.99512909E-002,-2.91080941E-002,-9.72486138E-002,-9.20571834E-002,2.91378703E-002,7.8784205E-002,-3.205
36084E-002,-7.9791192E-003,2.92499326E-002,3.07855569E-002,-2.2638388E-002,-1.52478479E-002,-6.42165765E-002,-2.59112492E-002,6.60942793E-002,4.22334634E-002,-8.01744536E-002,-1.46621121E-002,4.197075
96E-002,-8.44968855E-002,-3.76881734E-002,2.39902977E-002,-4.40311618E-002,4.54232618E-002,1.36466315E-002,3.61464694E-002,2.00967044E-002,-1.9774409E-002,-2.61314958E-002,-2.01844778E-002,-1.62788946
E-002,7.95767382E-002,3.47683728E-002,-4.11939211E-002,1.04025435E-002,-4.4798281E-002,-2.07655337E-002,-3.05905443E-004,-1.07589166E-003,-6.86475933E-002,1.31746186E-002,2.41918713E-002,-3.04036587E-
002,-8.21446031E-002,2.35029589E-002,-1.4030233E-002,-3.53255011E-002,1.44660957E-002,1.06620146E-002,1.0070066E-002,-1.58226956E-002,-5.26152439E-002,5.31952968E-003,9.48400572E-002,-1.16352044E-001,
2.26590559E-002,2.38021687E-002,-1.84772741E-002,-6.15235651E-003,-5.21332063E-002,-1.63819306E-002,1.13838211E-001,4.48200442E-002,-9.04860049E-002,-5.38678207E-002,-2.68039368E-002,2.58102641E-003,-
1.15668029E-002,1.2591131E-001,3.4166418E-002,-4.4202622E-002,7.33007491E-002,-4.4973325E-002,2.81945132E-002,5.16783707E-002,-1.76605675E-003,3.99598889E-002,9.6527366E-003,1.10464143E-002,6.15496859
E-002,9.05746222E-002,5.33685461E-002,7.55730346E-002,3.98361497E-003,9.08175185E-002,4.51306812E-002,-7.25189224E-002,-6.84641749E-002,-5.85429836E-003,3.67497765E-002,-5.03788814E-002,2.63811648E-00
2,5.64975478E-002,-5.18632927E-032,-1.34708732E-002,-6.275855E-002,3.72533798E-002,-5.79499602E-002,6.62106946E-002,5.05438745E-002,-2.1197997E-002,-5.47126159E-002,9.99535844E-002,-2.95496732E-002,7.
71534517E-002,-1.71193431E-004,-3.74059863E-002,1.685738E-002,2.94081867E-002,5.80498809E-003,2.44863816E-002,7.36626834E-002,1.63544163E-001,5.34656085E-002,7.21592307E-002,-4.35319617E-002,-9.400469
25E-003,-6.31896313E-003,2.81287953E-002,5.14827594E-002,8.61992966E-003,8.77619442E-003,-7.91860521E-002,-3.6200799E-002,6.97061466E-003,2.87681539E-003,4.91503701E-002,-5.61311133E-002,9.92581993E-0
03,-4.70721126E-002,9.58866403E-002,-5.4556448E-003,5.13598211E-002,-1.39459698E-002,8.95485505E-002,1.03006519E-001,5.05814105E-002,-2.92308703E-002,-1.32064344E-002,1.60010681E-002,3.15095037E-002,-
3.43251862E-002,-1.42749362E-002,-7.98928924E-003,1.11576973E-003,1.28171267E-002,4.90052663E-002,2.58564614E-002,-2.1103248E-002,1.18297068E-002,-9.08823609E-002,3.85137796E-002,1.44213354E-002,-2.66
04997E-002,7.07522407E-002,8.56206864E-002,-1.42212138E-002,-5.07563865E-003]

VECTOR_EMBEDDING 函数语法结构:

复制代码
VECTOR_EMBEDDING ( [ schema.] model_name USING mining_attribute_clause )

参考:
Oracle AI Vector Search User's Guide

VECTOR_EMBEDDING

常见错误

错误1:Windows环境导入嵌入模型时的错误ORA-40216: feature not supported on 23ai Windows version

在windows环境中安装的23ai,导入嵌入模型时会发生如下错误。

复制代码
SQL> BEGIN
  2     DBMS_VECTOR.LOAD_ONNX_MODEL(
  3          directory => 'model_dir',
  4          file_name => 'all_MiniLM_L12_v2.onnx',
  5          model_name => 'ALL_MINILM_L12_V2',
  6          metadata => JSON('{"function" : "embedding", "embeddingOutput" : "embedding", "input": {"input": ["DATA"]}}'));
  7  END;
  8  /
BEGIN
*
第 1 行出现错误:
ORA-40216: 不支持的功能
ORA-06512: 在 "SYS.DBMS_VECTOR", line 2150
ORA-06512: 在 "SYS.DBMS_DATA_MINING", line 5767
ORA-06512: 在 "SYS.DBMS_VECTOR", line 2145
ORA-06512: 在 line 2
帮助:https://docs.oracle.com/error-help/db/ora-40216/

解决方法:

可能原因也许是由于Windows不支持,所以使用linux 或者Oracle Database 23ai Free VirtualBox Appliance。

https://forums.oracle.com/ords/apexds/post/ora-40216-feature-not-supported-on-23ai-windows-version-9728

This feature is supported for Linux only. One option is to use the Oracle Database 23ai Free VirtualBox Appliance. (link). Note that the distiluse-base-multilingual-cased-v2 model is not preconfigured with OML4Py and will require a custom configuration. Refer to the section titled "Create a Custom Model Configuration" in this blog and the Properties table in the OML4Py User's Guide for a complete list of properties that can be defined with custom configurations. Note that preconfigured models already have these properties set to specific values.
There are many ways to work around the "missing feature" error. Assuming you want to keep using Windows as your host you may want to invest some time into Microsoft's Windows Subsystem for Linux (WSL). It's more lightweight compared to classic VMs and allows you to run Oracle Linux on Windows. This way, you an use the Linux port, either installed directly in the Linux environment, or via a container runtime like podman.

错误2:ORA-01950

仅赋予DB_DEVELOPER_ROLE, CREATE CREDENTIAL权限后,导入模型报如下错误:

复制代码
SQL> BEGIN
  2     DBMS_VECTOR.LOAD_ONNX_MODEL(
  3          directory => 'DM_DUMP',
  4          file_name => 'all_MiniLM_L12_v2.onnx',
  5          model_name => 'ALL_MINILM_L12_V2',
  6          metadata => JSON('{"function" : "embedding", "embeddingOutput" : "embedding", "input": {"input": ["DATA"]}}'));
  7  END;
  8* /
BEGIN
*
ERROR at line 1:
ORA-01950: The user VECTOR has insufficient quota on tablespace USERS.
ORA-06512: at "SYS.DBMS_VECTOR", line 2150
ORA-06512: at "SYS.DBMS_DATA_MINING", line 5767
ORA-06512: at "SYS.DBMS_VECTOR", line 2145
ORA-06512: at line 2
Help: https://docs.oracle.com/error-help/db/ora-01950/


More Details :
https://docs.oracle.com/error-help/db/ora-01950/
https://docs.oracle.com/error-help/db/ora-06512/

解决方案:

用户 VECTOR 在表空间 USERS 上没有足够的存储配额(Quota),导致无法执行 DBMS_VECTOR.LOAD_ONNX_MODEL 操作。Oracle 要求用户在目标表空间上具有明确的 ​存储配额 或 ​无限配额权限,才能创建或修改对象(如存储 ONNX 模型)。

例:

复制代码
 GRANT UNLIMITED TABLESPACE TO VECTOR;

错误3:ORA-17001

导入模型后,对文本进行向量化时发生如下错误:

复制代码
SQL> SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;

Error starting at line : 1 in command -
SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding
Error report -
ORA-17001: Internal error: Unknown or unimplemented accessor type: 127
https://docs.oracle.com/error-help/db/ora-17001/

More Details :
https://docs.oracle.com/error-help/db/ora-17001/
SQL> 

使用Oracle的vector_embedding函数时遇到了ORA-17001错误,提示"Unknown or unimplemented accessor type: 127"。

这个错误通常与模型输入输出的数据类型或格式不匹配有关。

虽然最终没有确认原因,重新导入虚拟机和下载模型后,问题得到了解决。

参考

Oracle AI Vector Search User's Guide

https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-ai-vector-search.html

Now Available! Pre-built Embedding Generation model for Oracle Database 23ai

https://blogs.oracle.com/machinelearning/post/use-our-prebuilt-onnx-model-now-available-for-embedding-generation-in-oracle-database-23ai

https://oracle-base.com/articles/23/ai-vector-search-23

VirtualBox网络配置超全详解

https://zhuanlan.zhihu.com/p/554893004?utm_id=0

https://blogs.oracle.com/oracle4engineer/post/ja-getting-started-with-vectors-in-23ai

相关推荐
团象科技9 分钟前
从一线实操案例拆解不同出海团队落地海外VPS运维独立站的路径细节
大数据·数据库·人工智能
小马爱打代码23 分钟前
框架 - 组件 - 中间件:生产级参数配置指引
数据库·中间件
asdfg125896340 分钟前
一文通俗理解JDBC中的核心概念+案例
java·数据库·oracle·jdbc
点灯小铭1 小时前
基于单片机与DAC0832的双路波形信号发生系统设计
数据库·单片机·mongodb·毕业设计·课程设计·期末大作业
小陈phd1 小时前
Text2SQL智能体学习笔记(二)——NL2SQL落地的隐形基石:元数据库
数据库·笔记·学习
霸道流氓气质1 小时前
阿里云 OSS 从零到实战:概念、配置与 Spring Boot 集成指南
数据库·spring boot·阿里云
茉莉玫瑰花茶1 小时前
综合案例 - AI 智能租房助手 [ 4 ]
数据库·python·ai·langgraph
ULIi096kr1 小时前
MySQL查看表创建时间、修改时间、最后更新时间(精准排查僵尸表)
数据库·mysql
折哥的程序人生 · 物流技术专研1 小时前
Tomcat 严重警告:JDBC 驱动未注销 + 工作线程泄漏 —— 原因、影响与彻底修复(生产级终极指南)
java·运维·数据库·mysql·oracle·tomcat
初圣魔门首席弟子1 小时前
Qt C++ 项目实战:修改共享头文件后的高效增量编译与快速发布流程
数据库