一.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) 说明

 

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