Yes, you need to create an environment before you can create domain indexes. You need to have ctxsys
user and necessary ctxapp
privileges to create it. Follow the steps explained in this link to have one for your environment. This user is not created by default while installing Oracle.
Once you have the all the grants and packages you can create preferences and index as shown.
SQL> begin
2 ctx_ddl.create_preference('SUBSTRING_PREF', 'BASIC_WORDLIST');
3 ctx_ddl.set_attribute('SUBSTRING_PREF', 'SUBSTRING_INDEX','TRUE');
4 end;
5 /
Now create a domain index as shown.
SQL> create index test_idx on test(object_name)
2 indextype is ctxsys.context parameters ('wordlist SUBSTRING_PREF MEMORY 50M');
Index created.
select * from test where contains( object_name,'%EXEC%') > 0;
See the link below which explains this with the execution plan. Update 2018: The original link is dead and not backed up on archive.org, unfortunately.
http://www.oraclebin.com/2012/12/oracle-text-and-domain-indexes.html