zoukankan      html  css  js  c++  java
  • Oracle Text 组件 说明

    一.OracleText 组件说明

    在说明之前,我们先用如下SQL 查看一下DB中的组件:

    SQL> col comp_id for a15

    SQL> col version for a15

    SQL> col comp_name for a30

    SQL> select comp_id,comp_name,versionfrom dba_registry ;

    COMP_ID         COMP_NAME                      VERSION

    --------------- ---------------------------------------------

    XDB             Oracle XML Database            11.2.0.3.0

    AMD             OLAP Catalog                   11.2.0.3.0

    EM              Oracle Enterprise Manager      11.2.0.3.0

    SDO             Spatial                        11.2.0.3.0

    ORDIM           Oracle Multimedia              11.2.0.3.0

    CONTEXT         Oracle Text                    11.2.0.3.0

    ODM             Oracle Data Mining             11.2.0.3.0

    EXF             Oracle Expression Filter       11.2.0.3.0

    RUL             Oracle Rules Manager           11.2.0.3.0

    OWM             Oracle Workspace Manager       11.2.0.3.0

    CATALOG         Oracle Database Catalog Views  11.2.0.3.0

    COMP_ID         COMP_NAME                      VERSION

    --------------- ---------------------------------------------

    CATPROC         Oracle Database Packages and T11.2.0.3.0

                    ypes

    JAVAVM          JServer JAVA Virtual Machine   11.2.0.3.0

    XML             Oracle XDK                     11.2.0.3.0

    CATJAVA         Oracle Database Java Packages  11.2.0.3.0

    XOQ             Oracle OLAP API                11.2.0.3.0

    APS             OLAP Analytic Workspace        11.2.0.3.0

    17 rows selected.

    MOS上的说明:

    Oracle 8i/9i/10g/11g 组件(Components) 说明

    http://blog.csdn.net/tianlesoftware/article/details/5937382

    Oracle Text(全文索引) is available for no extra Licensing in all four database editions:Oracle Database Standard Edition One, Oracle Database Standard Edition (SE),Oracle Database Enterprise Edition (EE) and Oracle Database Personal Edition.Oracle Text uses standard SQL to index, search, and analyze text and documentsstored in the Oracle database, in files, and on the Web. Oracle Text canperform linguistic analysis on documents; search text using a variety ofstrategies including keyword searching, boolean operations, pattern matching,mixed thematic queries, HTML/XML section searching, etc. Oracle Text can rendersearch results in various formats including unformatted text, HTML withhighlighting, and original document format. Oracle Text supports multiplelanguages including Japanese, Korean, Traditional and Simplified Chinese.

    Oracle Textindexes any document or textual content to add fast, accurate retrieval ofinformation to internet content management applications, e-Business catalogs,news services, job postings, and so on. It can index content stored in filesystems, databases, or on the Web.

           --Oracle text(全文检索) 可以把任何文档和文件编入索引,从而是访问更快,更容易检索相关的信息。 Text 的索引可以存储在文件系统,数据库或者Web。

    Oracle Text allows text searches to be combined with regular database searches in a singleSQL statement. It can find documents based on their textual content, metadata,or attributes. The Oracle Text SQL API makes it simple and intuitive to createand maintain Text indexes and run Text searches. 

    Text 组件使用的用户:

    CTXSYS/CTXSYS The Oracle Text account

    二. Oracle Text 组件重建

    MOS 文档:

    Note579601.1 Manual installation, deinstallation and verification ofOracle Text 11gR1
    Note.970473.1 Manualinstallation, deinstallation and verification of Oracle Text 11gR2
    Note.280713.1 Manualinstallation, deinstallation of Oracle Text 10gR1 and 10gR2 
    Note.275689.1 Manualinstallation, deinstallation of Oracle Text 9.2.0.x 
    Note.150316.1 Manualinstallation of Oracle Text version 9.0.1 
    Note.73605.1 Installationof Oracle Text version 8.1.x (formally interMedia Text) 
    Note.177233.1 Manualdeinstallation of Oracle Text (Intermedia Text) 
    Note.159959.1 Howto Install Oracle Text 9.0.1 using Scripts

    2.1 Oracle 10g中重建


    2.1.1 Manualinstallation of Text 10gR1 (10.1.0.x)
    --安装Text 组件

    1. Text dictionary, schema name CTXSYS, iscreated by calling following script from SQL*Plus connected as SYSDBA:

    --使用如下脚本。

    SQL> connect SYS/password@tns_ as SYSDBA
    SQL> spool text_install.txt
    SQL> @?/ctx/admin/catctx.sql CTXSYS SYSAUX TEMP NOLOCK


    --脚本中各个参数含义:

    CTXSYS - is the ctxsys user password
    SYSAUX - is the default tablespace for ctxsys
    TEMP - is the temporary tablespace for ctxsys
    LOCK|NOLOCK - ctxsys user account will be locked or not

    2. The next step is to install appropriatelanguage-specific default preferences.

      --指定默认的安装语言

    There is scriptwhich creates language-specific default preferences for every language Oracletext supports in /ctx/admin/defaults directory, such as English(US),Danish(DK), Dutch(NL), Finnish(SF), French(F), German(D), Italian(IT),Portuguese(PT), Spanish(E), and Swedish(S). They are named in the formdrdefXX.sql, where XX is the international license plate code. 

    To manuallyinstall US default preferences, for example, log into sqlplus as CTXSYS, andrun 'drdefus.sql' as described below: 

    --如果使用US作为默认语言,执行drdefus.sql.

    SQL> connect CTXSYS/password@tns_alias
    SQL> @?/ctx/admin/defaults/drdefus.sql 
    SQL> spool off


    注意:

    If you haveinstalled Oracle Data Mining (ODM) before Text you will see in thetext_install.txt logfile ORA-955 errors for public synonyms, e.g. dm_svm_build,which can be ignored. We have a dummy package that mimics the API in CTXSYSschema, and we attempt to create public synonyms to it. Now, if ODM has beeninstalled, these public synonym creates fail and the public synonyms point toODM objects, which is what we want.

    2.1.2 Text 10gR1 (10.1.0.x) Installation verification
    --在10gR1中检查Text 的安装

    1. Check to make sure that all Text objectswere created in CTXSYS schema and correct version is installed。

    --确认所有的Text 对象已经安装在CTXSYS用户下。
    2. Check to make sure that there are not invalid objects for CTXSYS.

    --确保没有无效对象。


    You should get: "no rows selected".
    If there are then you can compile each invalid object manually.

    -------------------示例------------------------------
    connect SYS/password as SYSDBA

    set pages 1000
    col object_name format a40
    col object_type format a20
    col comp_name format a30
    column library_name format a8 
    column file_spec format a60 wrap
    spool text_install_verification.log

    -- check on setup
    select comp_name, status, substr(version,1,10) as version from dba_registrywhere comp_id = 'CONTEXT';
    select * from ctxsys.ctx_version;
    select substr(ctxsys.dri_version,1,10) VER_CODE from dual;

    select count(*) from dba_objects where owner='CTXSYS';

    -- Get a summary count
    select object_type, count(*) from dba_objects where owner='CTXSYS' group byobject_type;

    -- Any invalid objects
    select object_name, object_type, status from dba_objects where owner='CTXSYS'and status != 'VALID' order by object_name;

    spool off
    ------------------- cut here ------------------------------

    2.1.3 A valid 10.1.0.2.0 Text installation shows the followingoutput
    --在10gR2中检查安装:

    Note: The number of CTXSYS objects might bedifferent on other Patch set version

      

    SQL> select comp_name, status,substr(version,1,10) as version
              from dba_registry where comp_id = 'CONTEXT';

    COMP_NAME                     STATUS      VERSION 
    ------------------------------ ----------- ------------------------------ 
    OracleText                   VALID       10.1.0.2.0 

    SQL> select count(*) from dba_objects where owner='CTXSYS';

      COUNT(*) 
    ---------- 
           338 

    SQL> select object_type, count(*) from dba_objects 
             where owner='CTXSYS' group byobject_type;

    OBJECT_TYPE            COUNT(*) 
    -------------------- ---------- 
    FUNCTION                     5 
    INDEX                       46 
    INDEXTYPE                    4 
    LIBRARY                      1 
    LOB                          1 
    OPERATOR                     6 
    PACKAGE                     71 
    PACKAGE BODY                 58 
    PROCEDURE                    3 
    SEQUENCE                     3 
    TABLE                       37 
    TYPE                        42 
    TYPE BODY                    7 
    VIEW                        54 

    14 rows selected.

    SQL> select object_name, object_type, status from dba_objects 
           where owner='CTXSYS' and status !='VALID' 
            order by object_name;

    no rows selected

    SQL> spool off


    2.1.4 Steps to Deinstall Oracle Text Manually
    --卸载Text 组件

    Before deinstalling Oracle Text, it is best to first drop all Text Indexes built inschemas other than CTXSYS.

           --在卸载Oracle Text 组件之前,最好先drop 掉CTXSYS 用户上的所有Textindexes。

    Text dictionary,schema name CTXSYS, is removed by calling following script from SQL*Plusconnected as SYSDBA:

    --调用如下脚本删除Text dictionary,CTXSYS用户:

    SQL> connect SYS/password as SYSDBA
    SQL> spool text_deinstall.log
    SQL> @?/ctx/admin/catnoctx.sql
    SQL> drop procedure sys.validate_context;
    SQL> spool off


    Review the output file text_deinstall.log for errors.

    注意事项:

    (1)ORA-04043 for droppingsys.validate_context can be ignored, as in base release version this procedurewas owned by ctxsys and needs to be owned by sys.

    (2)When Data Mining is not installedand we deinstall Oracle Text, catnoctx.sql will not drop the Data Mining publicsynonyms and they must be removed manually

           --如果没有安装Data Mining 组件,那么在删除Text 组件时,DataMining 的公共同义词不会被删除,需要手工的移除,命令如下:

    -- Drop CTXSYS publicsynonyms using the commands:

    SQL> set hea off 
    SQL> spool /path/drop_ctxsys_synonyms.sql 
    SQL> select 'Drop public synonym ' || SYNONYM_NAME || ' ;' from DBA_SYNONYMSwhere TABLE_OWNER = 'CTXSYS'; 
    SQL> spool off 
    SQL> @/path/drop_ctxsys_synonyms.sql


    Deinstallation of Oracle Text is now complete.

    2.2 Oracle 11gR2 中重建

    2.2.1 Manual installation of Text 11gR2 (11.2.0.1.0)

    1. Text dictionary, schema name CTXSYS, iscreated by calling following script from SQL*Plus connected as SYSDBA:

    SQL> connect SYS/password as SYSDBA
    SQL> spool text_install.txt
    SQL> @?/ctx/admin/catctx.sql change_on_install SYSAUX TEMP NOLOCK


    --各个参数含义:

    change_on_install - is the ctxsys userpassword
    SYSAUX - is the default tablespace for ctxsys
    TEMP - is the temporary tablespace for ctxsys
    LOCK|NOLOCK - ctxsys user account will be locked or not

    2. The next step is to install appropriatelanguage-specific default preferences.

    There is scriptwhich creates language-specific default preferences for every language OracleText supports in $O_H/ctx/admin/defaults directory, such as English(US),Danish(DK), Dutch(NL), Finnish(SF), French(F), German(D), Italian(IT),Portuguese(PT), Spanish(E), and Swedish(S). They are named in the formdrdefXX.sql, where XX is the international license plate code.

    To manuallyinstall American default preferences, for example, log into sqlplus as CTXSYS,and run following statement:

    SQL> connect"CTXSYS"/"change_on_install"
    SQL> @?/ctx/admin/defaults/dr0defin.sql "AMERICAN";
    SQL> connect SYS/password as SYSDBA
    SQL> alter user ctxsys account lock password expire;
    SQL> spool off

    注意:

    Due to the usageoff  Oracle Outside in HTML Export filtering technology on some platformsthe LD_LIBRARY_PATH or SHLIB_PATH or LIBPATH must be set properly in order towork.

    --在一些系统上使用Text 必须指定相关参数。

    The followingtable shows in which operating system the ctxhx relies on the shared librarypath setting and which environment variable needs to be set:

    --下表列出了不同操作系统上ctxhx依赖的变量,这些变量必须指定:

    Platform:            Requires path set:    ENV variable:
    --------------------- --------------------- -------------------
    Linux x86-64         YES                  LD_LIBRARY_PATH
    Solaris SPARC64      YES                  LD_LIBRARY_PATH
    IBMAIX              YES                  LIBPATH
    HP PA-RISC           YES                   SHLIB_PATH
    HP Itanium           YES                  LD_LIBRARY_PATH



    - If you have the C Shell (csh or tcsh), enter the following:
    $ setenv LD_LIBRARY_PATH $ORACLE_HOME/ctx/lib:$LD_LIBRARY_PATH

    - If you have the Bourne shell (sh), Bash shell (bash),or Korn shell (ksh), enter the following:
     $ export LD_LIBRARY_PATH=$ORACLE_HOME/ctx/lib:$LD_LIBRARY_PATH

    Run thefollowing command to check if the LD_LIBRARY_PATH environmental variable is setcorrectly:
    $ echo $LD_LIBRARY_PATH


    2.2.2 Text 11gR2 (11.2.0.1.0) Installation verification
    --验证安装

    1. Check to make sure that all Text objectswere created in CTXSYS schema and correct version is installed
    2. Check to make sure that there are not invalid objects for CTXSYS.
    You should get: "no rows selected".

    If there are then you can compile eachinvalid object manually.

    ------------------- 示例------------------------------
    connect SYS/password as SYSDBA

    set pages 1000
    col object_name format a40
    col object_type format a20
    col comp_name format a30
    column library_name format a8
    column file_spec format a60 wrap
    spool text_install_verification.log

    -- check on setup
    select comp_name, status, substr(version,1,10) as version from dba_registrywhere comp_id = 'CONTEXT';
    select * from ctxsys.ctx_version;
    select substr(ctxsys.dri_version,1,10) VER_CODE from dual;

    select count(*) from dba_objects where owner='CTXSYS';

    -- Get a summary count
    select object_type, count(*) from dba_objects where owner='CTXSYS' group byobject_type;

    -- Any invalid objects
    select object_name, object_type, status from dba_objects where owner='CTXSYS'and status != 'VALID' order by object_name;

    spool off
    ------------------- cut here ------------------------------


    (1)A valid 11.2.0.1.0 Text installation showsthe following output


    SQL> select comp_name, status,substr(version,1,10) as version from dba_registry where comp_id = 'CONTEXT';

    COMP_NAME           STATUS  VERSION
    ------------------- -------- ---------- 
    Oracle Text        VALID    11.2.0.1.0

    SQL> select * from ctxsys.ctx_version;

    VER_DICT   VER_CODE
    ---------- ----------
    11.2.0.1.0 11.2.0.1.0

    SQL> select substr(ctxsys.dri_version,1,10) VER_CODE from dual;

    VER_CODE 
    ----------
    11.2.0.1.0

    SQL> select count(*) from dba_objects where owner='CTXSYS';

      COUNT(*)
    ----------
           366

    SQL> 
    SQL> -- Get a summary count
    SQL> select object_type, count(*) from dba_objects where owner='CTXSYS'group by object_type;

    OBJECT_TYPE          COUNT(*)
    ------------------- ----------
    SEQUENCE                    3
    PROCEDURE                   2
    OPERATOR                    6
    PACKAGE                    73
    PACKAGEBODY               62
    LIBRARY                     1
    LOB                         2
    TYPEBODY                   6
    VIEW                       71
    INDEXTYPE                   4
    FUNCTION                    2
    TABLE                      47
    INDEX                      56
    TYPE                       31

    SQL> 
    SQL> -- Any invalid objects
    SQL> select object_name, object_type, status from dba_objects whereowner='CTXSYS' and status != 'VALID' order by object_name;

    no rows selected

    SQL>
    SQL> spool off

    (2)A valid 11.2.0.2.0Text installation shows the following output


    SQL> select comp_name, status,substr(version,1,10) as version from dba_registry where comp_id = 'CONTEXT';

    COMP_NAME          STATUS   VERSION
    ------------------- -------- ----------
    Oracle Text        VALID    11.2.0.2.0

    SQL> select * from ctxsys.ctx_version;

    VER_DICT   VER_CODE
    ---------- ----------
    11.2.0.2.0 11.2.0.2.0

    SQL> select substr(ctxsys.dri_version,1,10) VER_CODE from dual;

      VER_CODE
    ----------
    11.2.0.2.0

    SQL> select count(*) from dba_objects where owner='CTXSYS';

      COUNT(*)
    ----------
           382

    SQL>
    SQL> -- Get a summary count
    SQL> select object_type, count(*) from dba_objects where owner='CTXSYS'group by object_type;

    OBJECT_TYPE           COUNT(*)
    ------------------- ----------
    SEQUENCE                    3
    PROCEDURE                   2
    OPERATOR                    6
    LOB                         2
    LIBRARY                     1
    PACKAGE                    74
    PACKAGE BODY                63
    TYPE BODY                   6
    TABLE                      49
    INDEX                      59
    VIEW                       76
    FUNCTION                    2
    INDEXTYPE                   4
    TYPE                       35

    SQL>
    SQL> -- Any invalid objects
    SQL> select object_name, object_type, status from dba_objects where owner='CTXSYS'and status != 'VALID' order by object_name;

    no rows selected

    SQL>
    SQL> spool off



    2.2.3 Steps to Deinstall Oracle Text 11gR2 manually


    Before deinstalling Oracle Text, it is best to first drop all Text Indexes built inschemas other than CTXSYS.

    When deinstalling Oracle Text, for example to get rid of an invalid or corrupt Textenvironment, it should immediately be followed by a reinstallation of Text dueto the dependency of other components on Text objects.

    Text dictionaryis removed by calling following script from SQL*Plus connected as SYSDBA:

    SQL> connect SYS/password as SYSDBA
    SQL> spool text_deinstall.log
    SQL> @?/ctx/admin/catnoctx.sql
    SQL> drop procedure sys.validate_context;
    SQL> spool off

    三.全文索引的常见问题

    MOS:Frequently Asked Questions for Oracle Text[ID 153264.1]

       What is Oracle Text?
         Can you enumerate the main features ofOracle Text?
         What is the official Web page forOracle Text?
         What's the official documentation forOracle Text?
         What is the difference between ConTextand Oracle Text?
         How do you determine what version ofOracle Text you are running?
         Are there any books on Oracle Text?
         How do you manually install Oracle Text?
         How do I check my Text installationand setup?
         How do you configure Oracle Text withan existing database using Database Configuration Assistant (DBCA)?
         Does Text work with Replication?
         Can you partition an text index?
         Does Text work with Real ApplicationCluster(RAC)?
         How do you tune a Text Query?
         How do you empty CTX_INDEX_ERRORSview?
         How do you drop an index that is inFAILED or LOADING state?
         Should I use CTX_DDL or ALTER INDEX tomaintain my index?
         Can you query an text index during theoptimization process?
         Does Oracle Text create theme indexesby default?
         What does "ABOUT" mean in aquery?
         Where can I find working code samples?
         My index creation seemed to succeed,but my searches don't find any information. Why not?
         What are Document Services?
         What are the Filters used by OracleText?
         Can I Build Indexes on XML AttributeValues?
         Can I Create a Text Index on More ThanOne Column?
         How Fast is Text at Indexing?
         How do I increase the score for adocument?
         The CTXSYS account is locked. How do Iunlock the account?
         ORA-28575: unable to open RPCconnection to external procedure agent while using CTX_DOC.IFILTER 
         Create index error: ORA-00955: name isalready used by an existing object

    -------------------------------------------------------------------------------------------------------

    版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

    Skype: tianlesoftware

    Email:   tianlesoftware@gmail.com

    Blog:     http://www.tianlesoftware.com

    Weibo: http://weibo.com/tianlesoftware

    Twitter: http://twitter.com/tianlesoftware

    Facebook: http://www.facebook.com/tianlesoftware

    Linkedin: http://cn.linkedin.com/in/tianlesoftware

    -------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

    DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

    DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

    DBA6 群:158654907    DBA7 群:172855474   DBA总群:104207940

  • 相关阅读:
    小程序升级实时音视频录制及播放能力,开放 Wi-Fi、NFC(HCE) 等硬件连接功能
    12306网站将新增微信通知方式
    QQ-AR助人教版小学英语“动”起来
    【福利】公众平台全面开放原创功能
    12月微信的新规来了
    微信公众平台原创声明和留言功能面向微信认证帐号公测
    微信公众平台支持开通微信小店小程序了
    腾讯2017年第三季度财报:微信广告收入大幅增长
    2017微信数据报告 截至9月日登录用户超9亿日发送消息380亿次
    iOS版微信6.5.21发布 适配iPhone X
  • 原文地址:https://www.cnblogs.com/tianlesoftware/p/3609333.html
Copyright © 2011-2022 走看看