Oracle 23ai Vector Search 系列之3 集成嵌入天生模型(Embedding Model) ...

打印 上一主题 下一主题

主题 1676|帖子 1676|积分 5028

【声明】文章仅供学习交流,观点代表个人,与任何公司无关。
泉源|Walt@SQL和数据库技术(ID:SQLplusDB)
Windows 环境图形化安装 Oracle 23ai
Oracle 23ai Vector Search 系列之1 架构基础
Oracle 23ai Vector Search 系列之2 ONNX(Open Neural Network Exchange)
Oracle 23ai Vector Search 系列之3 集成嵌入天生模型(Embedding Model)到数据库示例,以及常见错误

通常数据库要实现向量查询和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

  1. [oracle@10 admin]$ sql system/oracle@localhost:1521/free
  2. SQLcl: Release 24.4 Production on Sat Mar 29 13:52:30 2025
  3. Copyright (c) 1982, 2025, Oracle.  All rights reserved.
  4. Last Successful login time: Sat Mar 29 2025 13:52:33 +00:00
  5. Connected to:
  6. Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
  7. Version 23.7.0.25.01
  8. SQL> show pdbs
  9.    CON_ID CON_NAME    OPEN MODE     RESTRICTED   
  10. _________ ___________ _____________ _____________
  11.         2 PDB$SEED    READ ONLY     NO            
  12.         3 FREEPDB1    READ WRITE    NO            
  13. 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
例:(有时间下载速率很慢)
  1. [oracle@10 ~]$ mkdir -p /u02/models
  2. [oracle@10 ~]$ cd /u02/models
  3. [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
  4. --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
  5. 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
  6. 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.
  7. HTTP request sent, awaiting response... 200 OK
  8. Length: 122597346 (117M) [application/x-zip-compressed]
  9. Saving to: ‘all_MiniLM_L12_v2_augmented.zip’
  10. all_MiniLM_L12_v2_augme  84%[=======================>     ]  98.22M  --.-KB/s    in 90m 30s
  11. 2025-04-01 13:53:17 (18.5 KB/s) - Connection closed at byte 102989824. Retrying.
  12. --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
  13. 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.
  14. HTTP request sent, awaiting response... 206 Partial Content
  15. Length: 122597346 (117M), 19607522 (19M) remaining [application/x-zip-compressed]
  16. Saving to: ‘all_MiniLM_L12_v2_augmented.zip’
  17. all_MiniLM_L12_v2_augmented.zip                       86%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++==>                ] 101.19M ugmented.zip             86%[++++++++++++++++++++++++>    ] 101.19M  --.-KB/s    eta 28m 2s
  18. gmented.zip              86%[++++++++++++++++++++++++>    ] 101.19M  --.-KB/s    eta 28m 12s
  19. all_MiniLM_L12_v2_augmented.zip                       86%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++==>                ] 101.19M  --.-KB/s    in 5m 24s  
  20. 2025-04-01 13:58:45 (9.38 KB/s) - Connection closed at byte 106102784. Retrying.
  21. --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
  22. 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.
  23. HTTP request sent, awaiting response... 206 Partial Content
  24. Length: 122597346 (117M), 16494562 (16M) remaining [application/x-zip-compressed]
  25. Saving to: ‘all_MiniLM_L12_v2_augmented.zip’
  26. all_MiniLM_L12_v2_augmented.zip                      100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++===============>] 116.92M  20.3KB/s    in 22m 28s
  27. 2025-04-01 14:21:19 (12.0 KB/s) - ‘all_MiniLM_L12_v2_augmented.zip’ saved [122597346/122597346]
  28. [oracle@10 models]$
  29. [oracle@10 models]$ ls -larth
  30. total 117M
  31. -rw-rw-r--. 1 oracle oracle 117M Jul 15  2024 all_MiniLM_L12_v2_augmented.zip
  32. drwxrwxrwx. 3 root   root     20 Apr  1 12:21 ..
  33. drwxrwxrwx. 2 root   root     45 Apr  1 12:22 .
  34. [oracle@10 models]$ unzip -oq all_MiniLM_L12_v2_augmented.zip
  35. [oracle@10 models]$ ls -la
  36. total 249932
  37. drwxrwxrwx. 2 root   root         121 Apr  2 13:18 .
  38. drwxrwxrwx. 3 root   root          20 Apr  1 12:21 ..
  39. -rw-rw-r--. 1 oracle oracle 122597346 Jul 15  2024 all_MiniLM_L12_v2_augmented.zip
  40. -rw-rw-r--. 1 oracle oracle 133322334 Jul 15  2024 all_MiniLM_L12_v2.onnx
  41. -rw-rw-r--. 1 oracle oracle      4232 Jul 15  2024 README-ALL_MINILM_L12_V2-augmented.txt
  42. [oracle@10 models]$
复制代码
2.毗连数据库创建用户和赋予相关权限

创建用户vector,并赋予相关权限
  1. [oracle@10 models]$ sqlplus /nolog
  2. SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 2 13:32:03 2025
  3. Version 23.7.0.25.01
  4. Copyright (c) 1982, 2025, Oracle.  All rights reserved.
  5. SQL> conn system/oracle@freepdb1
  6. Connected.
  7. SQL> create user if not exists vector_user identified by vector_user quota unlimited on users;
  8. User created.
  9. SQL> grant create session, db_developer_role, create mining model to vector_user;
  10. Grant succeeded.
  11. SQL> create or replace directory model_dir as '/u02/models';
  12. Directory created.
  13. SQL> grant read, write on directory model_dir to vector_user;
  14. Grant succeeded.
复制代码
DB_DEVELOPER_ROLE是Oracle 23ai引入的新角色,整合了CONNECT和RESOURCE角色,并增加了更多当代开发所需的权限,比如创建多维数据模型、机器学习模型等。
3.毗连创建的用户,并导入嵌入模型到数据库中

毗连创建的用户,并导入嵌入模型到数据库中。
DBMS_VECTOR.LOAD_ONNX_MODEL 是Oracle提供的存储过程,用于加载ONNX格式的机器学习模型,可以通过这个存储导入嵌入模型到数据库中。
  1. SQL> conn vector_user/vector_user@freepdb1
  2. Connected.
  3. SQL> column model_name format a30
  4. SQL> column algorithm format a10
  5. SQL> column mining_function format a15
  6. SQL>
  7. SQL> select model_name, algorithm, mining_function
  8. from   user_mining_models
  9. where  model_name = 'ALL_MINILM_L12_V2';  2    3  
  10. no rows selected
  11. SQL> begin
  12.   dbms_vector.drop_onnx_model (
  13.     model_name => 'ALL_MINILM_L12_V2',
  14.     force => true);
  15.   dbms_vector.load_onnx_model (
  16.     directory  => 'model_dir',
  17.     file_name  => 'all_MiniLM_L12_v2.onnx',
  18.     model_name => 'ALL_MINILM_L12_V2');
  19. end;
  20. /  2    3    4    5    6    7    8    9   10  
  21. PL/SQL procedure successfully completed.
  22. SQL> select model_name, algorithm, mining_function
  23. from   user_mining_models
  24. where  model_name = 'ALL_MINILM_L12_V2';
  25.   2    3  
  26. MODEL_NAME                       ALGORITHM  MINING_FUNCTION
  27. ------------------------------ ---------- ---------------
  28. ALL_MINILM_L12_V2               ONNX          EMBEDDING
  29. SQL>
复制代码
参数阐明:
  1. dbms_vector.drop_onnx_model :删除数据库中的同名模型。
  2. dbms_vector.load_onnx_model :加载ONNX格式的机器学习模型。
  3. directory => 'model_dir':指定数据库目录对象(Directory Object),需提前创建并授权访问。
  4. file_name => 'all_MiniLM_L12_v2.onnx':模型文件名。
  5. model_name => 'ALL_MINILM_L12_V2':模型在数据库中的注册名称。
复制代码
4. 验证使用数据库中的embedding模型的有效性

可以通过VECTOR_EMBEDDING调用嵌入模型将非结构化文本转换为高维向量,用于支持语义相似性搜索。
例:
  1. SQL> SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;
  2. EMBEDDING
  3. --------------------------------------------------------------------------------
  4. [-6.43850565E-002,5.03143901E-003,1.80688109E-002,-8.61809477E-002,
  5. SQL>
  6. SQL> set linesize 200
  7. SQL> set pagesize 200
  8. SQL> set long 1000000
  9. SQL>  SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;
  10. EMBEDDING
  11. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  12. [-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
  13. 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
  14. 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
  15. 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
  16. 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,-
  17. 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.
  18. 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
  19. 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
  20. 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-
  21. 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,
  22. -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.
  23. 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
  24. 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
  25. -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
  26. 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
  27. 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
  28. 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
  29. ,-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.
  30. 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
  31. 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
  32. 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
  33. 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-
  34. 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,
  35. 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,-
  36. 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
  37. 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
  38. 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.
  39. 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
  40. 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
  41. 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,-
  42. 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
  43. 04997E-002,7.07522407E-002,8.56206864E-002,-1.42212138E-002,-5.07563865E-003]
复制代码
VECTOR_EMBEDDING 函数语法结构:
  1. 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,导入嵌入模型时会发生如下错误。
  1. SQL> BEGIN
  2.   2     DBMS_VECTOR.LOAD_ONNX_MODEL(
  3.   3          directory => 'model_dir',
  4.   4          file_name => 'all_MiniLM_L12_v2.onnx',
  5.   5          model_name => 'ALL_MINILM_L12_V2',
  6.   6          metadata => JSON('{"function" : "embedding", "embeddingOutput" : "embedding", "input": {"input": ["DATA"]}}'));
  7.   7  END;
  8.   8  /
  9. BEGIN
  10. *
  11. 第 1 行出现错误:
  12. ORA-40216: 不支持的功能
  13. ORA-06512: 在 "SYS.DBMS_VECTOR", line 2150
  14. ORA-06512: 在 "SYS.DBMS_DATA_MINING", line 5767
  15. ORA-06512: 在 "SYS.DBMS_VECTOR", line 2145
  16. ORA-06512: 在 line 2
  17. 帮助: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权限后,导入模型报如下错误:
  1. SQL> BEGIN
  2.   2     DBMS_VECTOR.LOAD_ONNX_MODEL(
  3.   3          directory => 'DM_DUMP',
  4.   4          file_name => 'all_MiniLM_L12_v2.onnx',
  5.   5          model_name => 'ALL_MINILM_L12_V2',
  6.   6          metadata => JSON('{"function" : "embedding", "embeddingOutput" : "embedding", "input": {"input": ["DATA"]}}'));
  7.   7  END;
  8.   8* /
  9. BEGIN
  10. *
  11. ERROR at line 1:
  12. ORA-01950: The user VECTOR has insufficient quota on tablespace USERS.
  13. ORA-06512: at "SYS.DBMS_VECTOR", line 2150
  14. ORA-06512: at "SYS.DBMS_DATA_MINING", line 5767
  15. ORA-06512: at "SYS.DBMS_VECTOR", line 2145
  16. ORA-06512: at line 2
  17. Help: https://docs.oracle.com/error-help/db/ora-01950/
  18. More Details :
  19. https://docs.oracle.com/error-help/db/ora-01950/
  20. https://docs.oracle.com/error-help/db/ora-06512/
复制代码
办理方案:
用户 VECTOR 在表空间 USERS 上没有足够的存储配额(Quota),导致无法执行 DBMS_VECTOR.LOAD_ONNX_MODEL 利用。Oracle 要求用户在目标表空间上具有明确的 ​存储配额 或 ​无穷配额权限,才能创建或修改对象(如存储 ONNX 模型)。
例:
  1. GRANT UNLIMITED TABLESPACE TO VECTOR;
复制代码
错误3:ORA-17001

导入模型后,对文本进行向量化时发生如下错误:
  1. SQL> SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding;
  2. Error starting at line : 1 in command -
  3. SELECT VECTOR_EMBEDDING(ALL_MINILM_L12_V2 USING '测试模型向量化的有效性' as DATA) AS embedding
  4. Error report -
  5. ORA-17001: Internal error: Unknown or unimplemented accessor type: 127
  6. https://docs.oracle.com/error-help/db/ora-17001/
  7. More Details :
  8. https://docs.oracle.com/error-help/db/ora-17001/
  9. 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

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

写过一篇

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表