1. Check that the database has full-text indexing (this is for a database that is already in use)
See if there are Ctxsys users in the user, and whether the Ctxapp role exists in the query role. 1 of the above two are not satisfied (not present), then the full-text search function has not been installed.
When using the CONTAINS function, there will be an error if no full-text search is available.
2. If not, you need to set up a manual, first set up a full-text search to use the space
Sqlplus/as SYSDBA--Enter the console
Create tablespace idx_ctxsys datafile '/oradata/sg186fx/ctxsys01.dbf size 10240M autoextend on next 32M maxsize 20480m;--Chong Table space used for full-text search
3. To create a user and role for the full-text search and the corresponding package, you need to execute a script that comes with ORACLE: CD $ORACLE _home/ctx/admin/catctx.sql
Or do you do it in Sqlplus:
@?/ctx/admin/catctx.sql Ctxsys Idx_ctxsys Temp nolock
In the execution of this script, entered a few parameters, the first parameter Ctxsys to Ctxsys user's password
The second parameter idx_ctxsys the tablespace to be used by the Ctxsys user
The third parameter, temp, is the temporary tablespace used by the Ctxsys user
The fourth parameter, NOLOCK, is unlocked for the Ctxsys user.
4. After the creation is complete, to log in to the Ctxsys user
Connect Ctxsys/ctxsys
Execute the following script: @?/ctx/admin/defaults/drdefus.sql (This is a very important script that is created using the information created by the script later)
5. Creating a full-text index parser
To explicitly use a full-text index user, I want to use the full-text index of the SGPM user
Therefore, grant execute on CTXSYS.CTX_DDL to sgpm with GRANT option;
Connect SGPM/SGPM
Set up the parser: exec ctx_ddl.drop_preference (' chinalexer ');
exec ctx_ddl.create_preference (' chinalexer ', ' chinese_lexer ');
Set lexical properties: Exec ctx_ddl.drop_preference (' Idx_c_store ');
Begin
Ctx_ddl.create_preference (' Idx_c_store ', ' basic_storage ');
Ctx_ddl.set_attribut (' Idx_c_store ', ' i_table_clause ', ' tablespaces idx_ctxsy ');
Ctx_ddl.set_attribute (' Idx_c_store ', ' i_index_clause ', ' tablespace idx_ctxsy compress 2 ');
End
/
6. Create an index
Create INDEX Sgpm.idx_c_cons_name on sgpm.c_cons (cons_name) indextype is ctxsys.context parameters (' Lexer chinalexer Storage Idx_c_store ');
7. Synchronizing indexes
Variable jobno number;
Begin
Dbms_job.submit (: Jobno, ' pkg_sp_tools.p_cont_sys_index (); ', Sysdate, ' trunc (sysdate) +19/24+1 '); --A personalized approach is performed.
End
/
Common is used: exec ctx_ddl.sync_index (' idx_c_cons_name ');
In this case, the full-text search was created successfully, and the contains function would work as expected.
Note: Ora-29879:cannot Create multiple domain index on a column listusing same indextype will appear during the creation process, indicating that the index has been established under other users.
Oracle Full-Text indexing