欢迎投稿

今日深度:

在oracle中怎么给表格设置全文检索?,oracle全文

在oracle中怎么给表格设置全文检索?,oracle全文检索


1、首先查看CTXSYS用户状态(使用超级用户登陆,或者必须有dba的权限才能执行下面语句)

\

如果是过期了,如上图红色标记的状态“expired”,则需要对状态进行更改,执行下面语句:

UPDATE USER$ SET ASTATUS=0WHERENAME='CTXSYS';
commit;

再查看CTXSYS用户状态 看是否修改成功

select username,account_status from dba_users;
\

2、状态更改之后,给用户授权,这里zxg是用户,以下语句使用超级用户进行分配权限。

alter user ctxsys account unlock;
grant execute on ctx_ddl to zxg;

3、接下来使用zxg用户在控制台中进行登录,打开cmd命令窗口,输入sqlplus,在输入账号zxg,与其密码,并执行

exec ctx_ddl.create_preference ('my_lexer', 'chinese_lexer');  

\

4、创建表的分词索引,test为表格名称,content为字段名称

create index test_index on test (content) indextype is CTXSYS.CONTEXT parameters('lexer my_lexer');

5、创建一个过程进行分词操作

create or replace procedure hsp_sync_index as
begin
ctx_ddl.sync_index('test_index');
end;
/
variable jobno number;
begin
DBMS_JOB.SUBMIT(:jobno,'hsp_sync_index();',
SYSDATE, 'SYSDATE + (1/24/4)');
commit;
end;
/

6、进行索引优化

create or replace procedure hsp_optimize_index as
begin
ctx_ddl.optimize_index('test_index','full');
end;
/
variable jobno number;
begin
DBMS_JOB.submit(:jobno,'hsp_optimize_index();',sysdate,'sysdate+1');
commit;
end;
/

www.htsjk.Com true http://www.htsjk.com/oracle/24513.html NewsArticle 在oracle中怎么给表格设置全文检索?,oracle全文检索 1、首先查看CTXSYS用户状态(使用超级用户登陆,或者必须有dba的权限才能执行下面语句) 如果是过期了,如上图红色标记的状态...
评论暂时关闭