This document describes how to set up the ConText Option, and gives an example
of setting up an Indexed column.
(1) MAKE A FULL BACKUP OF YOUR DATABASE
(2) Use the Oracle Installer from CD-Rom to install the ConText Option. Choose
CUSTOM install, and INSTALL SOFTWARE - CREATE DB OBJECTS. It does not matter
whether or not you install the DEMO objects.
(3) Add the following line to the init.ora file and restart the instance:
text_enable=TRUE
(4) Grant CTXAPP to all users that own objects that will be indexed in Oracle:
GRANT CTXAPP TO CTXTEST;
(Note that I created the CTXTEST user and copied over the
EXPORT_LIST table)
(5) Start up a ConText Server in UNIX:
ctxsrv -user ctxsys/ctxsys -logfile $ORACLE_ADMIN/$ORACLE_SID/bdump/ctx.log &
(6) Make sure that the table has a Primary Key (or Unique Key). As for
EXPORT_LIST, there was none and so I generated an extra column, X,
*** Note: I ran into an error that the textkey can be 64 bytes maximum! So,
you may have to add a sequence to some tables and define it as PK/UK.
with a sequence number and defined it as Primary Key.
(7) Log in as the table owner and create a "Policy" for the table and column to
be indexed. In this case, I called the policy "MY_POLICY". The "DESCRIPTION"
column will be indexed, and the "X" column will be the textkey:
BEGIN
ctx_ddl.create_policy('MY_POLICY','EXPORT_LIST.DESCRIPTION',null,'Thi
s is my policy','EXPORT_LIST.X');
END;
/
(8) Once the Policy has been created, you can now index the policy:
BEGIN
ctx_ddl.create_index('MY_POLICY');
END;
/
(9) Everything is set to go. Below is an example to show all records in the
EXPORT_LIST table. Note the new SQL function "contains".
select * from spice_export_source
where contains (description,'savannah') > 0
/
(10) For any end-user that will be querying tables using the ConText option,
they must be granted the CTXUSER privilege:
GRANT CTXUSER TO end_user;
Back to Ari Kaplan's Home Page