oracle全文检索

问题提出:

在oracle 10.2.0.3中创建oracle全文检索索引时,报错:

CREATE INDEX FILES_CONTENT_IDX ON FILES(CONTENT_URL) INDEXTYPE IS CTXSYS.CONTEXT
*
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-11422: linguistic initialization failed
DRG-11446: supplied knowledge base file
/u01/app/oracle/product/10.2.0/db_1/ctx/data/enlx/droldUS.dat not installed
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364
 
解决办法:
1、这是由于oracle全文检索组件在安装时需要用到companion cd,在oracle网站下载相应平台上相应版本的数据库的companion cd,以我的环境为例,需要下载10gr2_aix5l64_companion.cpio.gz
2、解压缩 gunzip 10gr2_aix5164_companion.cpio.gz
              cpio -idmv <10gr2_aix5164_commpanion.cipo
这时候又出现了一个小问题,报错信息如下
cpio: 0511-903 Out of phase!
         cpio attempting to continue...
cpio: 0511-904 skipping 732944 bytes to get back in phase!
         One or more files lost and the previous file is possibly corrupt!
cpio: 0511-027 The file name length does not match the expected value.
查看cpio命令的用法
$ man cpio
c  Reads and writes header information in ASCII character form. If a cpio archive
was created using the c flag, it must be extracted with c flag.
发现需要加上参数c,再次执行
           cpio -idmvc <10gr2_aix5164_commpanion.cpio
ok了。
3、进入解压后的目录Disk1/stage/Components/oracle.ctx.companion/10.2.0.1.0/1/DataFiles
下面有一些jar包,我们这里需要filegroup1.jar和filegroup2.jar这连个包。
bash-3.2$ unzip filegroup1.jar
Archive:  filegroup1.jar
  inflating: ctx/data/enlx/drofdUS.dat 
  inflating: ctx/data/enlx/drofiUS.dat 
  inflating: ctx/data/enlx/droldUS.dat 
  inflating: ctx/data/enlx/droliUS.dat 
  inflating: ctx/data/enlx/drolkUS.dat 
  inflating: ctx/data/enlx/drolsUS.dat 
bash-3.2$ unzip filegroup2.jar
Archive:  filegroup2.jar
  inflating: ctx/data/frlx/drofdF.dat 
  inflating: ctx/data/frlx/drofiF.dat 
  inflating: ctx/data/frlx/droldF.dat 
  inflating: ctx/data/frlx/droliF.dat 
  inflating: ctx/data/frlx/drolkF.dat 
  inflating: ctx/data/frlx/drolsF.dat 
然后将这些dat文件拷贝到$ORACLE_HOME/ctx/data/对应的目录下。
这下就大功告成了。再次创建oracle text索引错误解除。
 
 
扩展知识:
1、oracle 10g全文检索组件是oracle text,安装/卸载方法如下:
The steps of context install on Oracle 10g.
1), create tablespace drsys
2), run @?/ctx/admin/catctx.sql ctxsys drsys temp01 nolock
3), run @?/ctx/admin/defaults/drdefus.sql
4), grant execute on ctxsys.ctx_ddl to public

The steps of context uninstall (remove) on Oracle 10g.

-- run as sys  
?/ctx/admin/catnoctx.sql
2、检查是否安装了oracle text组件。
SQL> select comp_name,status from dba_registry;
 
COMP_NAME                                                                        STATUS
-------------------------------------------------------------------- ---------------------------------
Oracle Database Catalog Views                                        VALID
Oracle Database Packages and Types                            VALID
Oracle Text                                                                              VALID
 
请使用浏览器的分享功能分享到微信等