How to install Oracle Context manually?

    Oracle Context is a good solution for the text search in enterprise, How to install Context in Oracle manually?

  1, create tablespace drsys
  2, run ?/ctx/admin/dr0csys ctxsys drsys temp01
  3, conn to ctxsys user
  4, run ?/ctx/admin/dr0inst ?/ctx/lib/libctxx9.so
  5, run ?/ctx/admin/defaults/drdefus.sql

    Then, create a demo table to verify the result as following:

SQL> create table  cr_ctxdemo (col1 number not null primary key,
  2  col2 varchar2(100));

Table created.

SQL> insert into cr_ctxdemo values (1,'Oracle A B C');

1 row created.

SQL> commit;

Commit complete.

SQL> create index idx_cr_ctxdemo_col2 on cr_ctxdemo(col2)
  2  indextype is ctxsys.context;

Index created.

SQL> select col1 from cr_ctxdemo where contains(col2,'A or C') > 0;

      COL1
----------
        1

SQL> select col1 from cr_ctxdemo where contains(col2,'A and B')> 0;

      COL1
----------
        1
SQL>  select col1 from cr_ctxdemo where contains (col2,'A') > 0;

Execution Plan
----------------------------------------------------------
  0      SELECT STATEMENT Optimizer=RULE (Cost=2 Card=1 Bytes=72)
  1    0  TABLE ACCESS (BY INDEX ROWID) OF 'CR_CTXDEMO' (Cost=2 ..)
  2    1    DOMAIN INDEX OF 'IDX_CR_CTXDEMO_COL2' (Cost=0)

    There is a more detail article on Eygle.com about how to install Oracle context.

Post a comment

SCode:
Mail(*, but will not be displayed):
Home: