同步 CONTEXT 索引时出错
error when synchronizing CONTEXT index
我有一个全文数据库应用程序,它有一个简单的过程,可以将值插入 table:
create or replace PROCEDURE put_file
(
p_file_name IN my_doc.file_name%TYPE,
p_upload_date IN my_doc.upload_date%TYPE,
p_filesize IN my_doc.filesize%TYPE,
p_filetype IN my_doc.filetype%TYPE,
p_creation_date IN my_doc.creation_date%TYPE,
p_modification_date IN my_doc.modification_date%TYPE,
p_accessed_date IN my_doc.accessed_date%TYPE
) AS
dummy pls_integer;
BEGIN
select count(*) into dummy from my_doc where file_name = p_file_name;
if dummy = 0
then
INSERT INTO my_doc (id, file_name, upload_date, filesize, filetype, content, creation_date, modification_date, accessed_date)
VALUES (my_doc_seq.NEXTVAL, p_file_name, p_upload_date, p_filesize, p_filetype, BFILENAME('DOCUMENTS',p_file_name), p_creation_date, p_modification_date, p_accessed_date);
end if;
ctx_ddl.sync_index; -- the error occurs here
COMMIT;
END;
为了成功执行此程序,我向当前用户提供了所有必要的权限:
grant resource, connect, ctxapp to my_user;
/
grant execute on ctxsys.ctx_adm to my_user;
grant execute on ctxsys.ctx_cls to my_user;
grant execute on ctxsys.ctx_ddl to my_user;
grant execute on ctxsys.ctx_doc to my_user;
grant execute on ctxsys.ctx_output to my_user;
grant execute on ctxsys.ctx_query to my_user;
grant execute on ctxsys.ctx_report to my_user;
grant execute on ctxsys.ctx_thes to my_user;
grant execute on ctxsys.ctx_ulexer to my_user;
...但是,不幸的是,当我执行该过程时,我收到以下错误:
Error starting at line 1 in command:
EXECUTE put_file('text.txt', sysdate, 12, '.txt', sysdate, sysdate, sysdate);
Error report:
ORA-20000: Oracle Text error: DRG-10017: you must be CTXSYS to do
this: SYNC
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at
"CTXSYS.CTX_DDL", line 847
ORA-06512: at "my_user.PUT_FILE", line
24
ORA-06512: at line 1
- 00000 - "%s"
*Cause: The stored procedure 'raise_application_error' was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact the application administrator or DBA for more information.
你能告诉我我做错了什么吗?
谢谢,
我认为我向您展示的问题正在调用 ctx_ddl.sync_index
。您没有传递任何参数。这是允许的,但是 the documentation tells us:
"When idx_name is null, all CONTEXT, CTXRULE, and CTXXPATH indexes that have pending changes are synchronized. You must be connected as ctxsys to perform this operation. "
所以解决方案是您需要在调用中包含索引的名称。
我有一个全文数据库应用程序,它有一个简单的过程,可以将值插入 table:
create or replace PROCEDURE put_file
(
p_file_name IN my_doc.file_name%TYPE,
p_upload_date IN my_doc.upload_date%TYPE,
p_filesize IN my_doc.filesize%TYPE,
p_filetype IN my_doc.filetype%TYPE,
p_creation_date IN my_doc.creation_date%TYPE,
p_modification_date IN my_doc.modification_date%TYPE,
p_accessed_date IN my_doc.accessed_date%TYPE
) AS
dummy pls_integer;
BEGIN
select count(*) into dummy from my_doc where file_name = p_file_name;
if dummy = 0
then
INSERT INTO my_doc (id, file_name, upload_date, filesize, filetype, content, creation_date, modification_date, accessed_date)
VALUES (my_doc_seq.NEXTVAL, p_file_name, p_upload_date, p_filesize, p_filetype, BFILENAME('DOCUMENTS',p_file_name), p_creation_date, p_modification_date, p_accessed_date);
end if;
ctx_ddl.sync_index; -- the error occurs here
COMMIT;
END;
为了成功执行此程序,我向当前用户提供了所有必要的权限:
grant resource, connect, ctxapp to my_user;
/
grant execute on ctxsys.ctx_adm to my_user;
grant execute on ctxsys.ctx_cls to my_user;
grant execute on ctxsys.ctx_ddl to my_user;
grant execute on ctxsys.ctx_doc to my_user;
grant execute on ctxsys.ctx_output to my_user;
grant execute on ctxsys.ctx_query to my_user;
grant execute on ctxsys.ctx_report to my_user;
grant execute on ctxsys.ctx_thes to my_user;
grant execute on ctxsys.ctx_ulexer to my_user;
...但是,不幸的是,当我执行该过程时,我收到以下错误:
Error starting at line 1 in command:
EXECUTE put_file('text.txt', sysdate, 12, '.txt', sysdate, sysdate, sysdate);
Error report:ORA-20000: Oracle Text error: DRG-10017: you must be CTXSYS to do this: SYNC
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.CTX_DDL", line 847
ORA-06512: at "my_user.PUT_FILE", line 24
ORA-06512: at line 1
- 00000 - "%s"
*Cause: The stored procedure 'raise_application_error' was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact the application administrator or DBA for more information.
你能告诉我我做错了什么吗?
谢谢,
我认为我向您展示的问题正在调用 ctx_ddl.sync_index
。您没有传递任何参数。这是允许的,但是 the documentation tells us:
"When idx_name is null, all CONTEXT, CTXRULE, and CTXXPATH indexes that have pending changes are synchronized. You must be connected as ctxsys to perform this operation. "
所以解决方案是您需要在调用中包含索引的名称。