必须声明 oracle 标识符 'ctx_ddl' - 添加 dbms_job
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5455675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
oracle identifier 'ctx_ddl' must be declared - adding a dbms_job
提问by Jean-Bernard Pellerin
I've added an index to my table with the command:CREATE INDEX patient_index ON radiology_record(patient_name) INDEXTYPE IS CTXSYS.CONTEXT;
我已经使用以下命令在我的表中添加了一个索引:CREATE INDEX patient_index ON radiology_record(patient_name) INDEXTYPE IS CTXSYS.CONTEXT;
And I'm trying to add a DBMS_JOB which will keep it up to date.
The way I've been running this script is by calling "@myscript.sql" from SQLPLUS
我正在尝试添加一个 DBMS_JOB 以使其保持最新状态。
我运行这个脚本的方式是从 SQLPLUS 调用“@myscript.sql”
set serveroutput on
declare
job number;
begin
dbms_job.submit(job, 'ctx_ddl.sync_index(''patient_index'');',
interval=>'SYSDATE+1/1440');
commit;
dbms_output.put_line('job '||job||'has been submitted.');
end;
/
The resulting error is PLS-00201: identifier 'CTX_DDL' must be declared
由此产生的错误是 PLS-00201: identifier 'CTX_DDL' must be declared
Through my searching I've found someone with a similar problem and his solutionwas
通过我的搜索,我找到了一个有类似问题的人,他的解决方案是
I spent enough time debugging this that I thought it merited sharing what i learned. It turns out that dbms_jobs only inherit your schema user's default privileges, not any privileges it might inherit from roles granted to that user. This means that the job will not run with the ctxsys privilege that you should have granted to your schema user. So what does this mean? It means that you have to run the job as the ctxsys user
我花了足够的时间调试这个,我认为值得分享我学到的东西。事实证明,dbms_jobs 只继承您的模式用户的默认权限,而不是它可能从授予该用户的角色继承的任何权限。这意味着作业将不会使用您应该授予架构用户的 ctxsys 权限运行。那么这是什么意思?这意味着您必须以 ctxsys 用户身份运行该作业
I unfortunately cannot use this to grant myself privileges since yes, this is homework, and I don't have permissions to grant execute on ctx_ddl to myself.
不幸的是,我无法使用它来授予自己特权,因为是的,这是作业,而且我无权将 ctx_ddl 上的执行授予自己。
Does anyone have clues as to how I can resolve this issue? Otherwise I will wait until later this week and consult the TA's.
Thanks
有没有人知道我如何解决这个问题?否则我会等到本周晚些时候再咨询 TA。
谢谢
回答by Vincent Malgrat
I don't think there's a workaround since the documentation of DBMS_JOB
explicitly specifies this restriction:
我认为没有解决方法,因为文档DBMS_JOB
明确指定了此限制:
You can execute procedures that are owned by the user or for which the user is explicitly granted EXECUTE. However, procedures for which the user is granted the execute privilege through roles cannot be executed.
您可以执行用户拥有的过程或用户被明确授予 EXECUTE 的过程。但是,不能执行通过角色授予用户执行权限的过程。