Oracle Text Index-part1

Oracle全文索引需要使用CTXSYS组件来提供功能。

组件的安装

默认DBCA建库会安装这个组件,创建的用户为CTXSYS,在11.2.0.4版本下CTXSYS用户下包含389个对象,并且每个对象的状态都应该是VALID的。对默认安装后存在这个用户的情况下,账户的状态是LOCKED的,在生产环境(10g+)上这个用户可以不解锁,不影响使用Text Index这个技术。

检查Text Index的版本,如果数据库是升级到11.2.0.4版本的话请确认组件的版本号,如果版本不够请升级。
正常下的版本号

SQL> SELECT * FROM ctxsys.ctx_version;

VER_DICT             VER_CODE
-------------------- --------------------
11.2.0.4.0           11.2.0.4.0

如果检查数据库发现没有安装这个组件,请按照下面的方式进行组件安装
请登录数据库服务器所在主机,使用SQLPLUS方式登录数据库
安装Oracle Text

conn SYS/syspasswd AS SYSDBA
@?/ctx/admin/catctx.sql passwd SYSAUX TEMP NOLOCK     --passwd为给ctxsys设置的密码

执行完毕之后用CTXSYS登录数据库进行组件的安装

conn CTXSYS/mypasswd
@?/ctx/admin/defaults/drdefzhs.sql

需要的权限

GRANT RESOURCE, CONNECT, CTXAPP TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_CLS TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_DDL TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_DOC TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_OUTPUT TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_QUERY TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_REPORT TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_THES TO BLUE;
GRANT EXECUTE ON CTXSYS.CTX_ULEXER TO BLUE;
GRANT CREATE JOB TO BLUE;

Text Index的特性

Oracle Text search functionality includes: Boolean operators (AND, OR, NOT, NEAR etc), exact phrase match, section searching, fuzzy (words that are spelled similarly), stemming (search for mice and find mouse), wildcard, thesaurus (synonyms), stopwords, case sensitivity, search scoring proximity (Searches for words near one another), results ranking, and keyword highlighting.
Oracle Text can perform linguistic analysis on documents; search text using a variety of strategies including keyword searching, Boolean operations, pattern matching, mixed queries (combining both relational and unstructured data), HTML/XML section searching, etc.
Oracle Text can render search results in various formats including unformatted text, HTML with highlighting, and original document format.
Oracle Text supports multiple languages including Japanese, Korean, Traditional and Simplified Chinese.

Oracle Text Index类型

CONTEXT

A CONTEXT index is not transactional. When a record is deleted, the index change is immediate. That is, your own session will no longer find the record from the moment you make the change, and other users will not find the record as soon as you commit. For inserts and updates, the new information will not be visible to text searches until an index synchronization has occurred. Therefore, when you perform inserts or updates on the base table, you must explicitly synchronize the index with CTX_DDL.SYNC_INDEX.

CTXCAT

The CTXCAT index does not support table and index partitioning, documents services (highlighting, markup, themes, and gists) or query services (explain, query feedback, and browse words.)
A CTXCAT index is transactional. When you perform DML (inserts, updates, and deletes) on the base table, Oracle Text automatically synchronizes the index. Unlike a CONTEXT index, no CTX_DDL.SYNC_INDEX is necessary.

CTXRULE

You use the CTXRULE index to build a document classification application. In such an application, a stream of incoming documents is classified based on their content. Document routing is achieved by creating a CTXRULE index on a table or queries.

CTXXPATH

CTXXPATH在11.2.0.4版本下已经废弃,为做兼容保留。

此条目发表在Index, Uncategorized分类目录。将固定链接加入收藏夹。

One Response to Oracle Text Index-part1

  1. Pingback引用通告: Oracle Text Index-part6-preference and stoplist | LEO Notes

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s