Oracle 系统下的程序无效
我有一个在系统模式下成功编译的过程Oracle 系统下的程序无效,oracle,plsql,Oracle,Plsql,我有一个在系统模式下成功编译的过程 create or replace procedure get_file_list as ns varchar2(1024); cursor c_my_directory is select directory_name, directory_path from all_directories where directory_path like '/home/oracle/EDI%'; begin -- b
create or replace procedure get_file_list as
ns varchar2(1024);
cursor c_my_directory is
select directory_name, directory_path from all_directories where directory_path like '/home/oracle/EDI%';
begin
-- before generating the file list, the temporary table is deleted
delete from edi.temp_EDI_file_list;
for each_directory in c_my_directory loop
-- it reads the contents of my_directory into a table called X$FRBMSFT
sys.dbms_backup_restore.searchfiles (each_directory.directory_path, ns);
for each_file in (select fname_krbmsft as name from X$KRBMSFT) loop
insert into edi.temp_edi_file_list
values (each_directory.directory_name, each_file.name);
end loop;
end loop;
commit;
exception
when others then
raise_application_error (-20001,sqlcode || ' ' || sqlerrm);
end get_file_list;
[…它是在系统架构下创建的,因为我不允许将select on X$FRBMSFT授予用户“edi”]
我授予用户“edi”执行此过程的权限。
[…作为系统连接,角色为SYSDBA,我执行了grant execute on SYSTEM.get_file_list to EDI;
]
当我试图使用用户“edi”执行过程(executesystem.get\u file\u list;
)时,它返回错误
PLS-00905:对象系统。获取文件列表无效
有人能告诉我我做错了什么吗
谢谢,在@APC提供的帮助下,我终于创建了这个过程 。。。被称为系统
create or replace view file_list as select fname_krbmsft from X$KRBMSFT readonly;
create or replace procedure searchfiles (pattern in out nocopy varchar2, ns in out nocopy varchar2) authid definer as
begin
dbms_backup_restore.searchfiles(pattern, ns);
end searchfiles;
GRANT SELECT ON FILE_LIST TO EDI;
GRANT EXECUTE ON SEARCHFILES TO EDI;
。。。称为电子数据交换
create or replace procedure get_file_list as
ns varchar2(1024);
cursor c_my_directory is
select directory_name, directory_path from all_directories where directory_path like '/home/oracle/EDI%';
begin
-- before generating the file list, the temporary table is deleted
delete from edi.temp_EDI_file_list;
for each_directory in c_my_directory loop
-- it reads the contents of all directories into a table called X$FRBMSFT via procedure SEARCHFILES
sys.SEARCHFILES (each_directory.directory_path, ns);
-- it interogate the X$FRBMSFT via file_list view
for each_file in (select fname_krbmsft as name from sys.file_list) loop
insert into temp_edi_file_list
values (each_directory.directory_name, each_file.name);
end loop;
end loop;
commit;
exception
when others then
raise_application_error (-20001,sqlcode || ' ' || sqlerrm);
end get_file_list;
区别在于它们被称为用户系统创建的对象的方式。它们是用SYS.xxx而不是SYSTEM.xxx调用的,它已成功编译-未报告任何错误?对于该过程,
user\u errors
视图显示了什么(当作为系统连接时)?系统是否具有查看edi表的权限,并且具有直接授予的权限(而不是通过角色)?(不知道为什么你不能授予edi权限,而不是在系统模式中创建它,正如你所知道的那样,这是应该避免的。)这是一个非常奇怪的DBA,他更喜欢在系统模式中创建过程,而不是授予对内部系统视图的访问权限。因此,这段代码是Dan Morgan发布在其网站上的第一个代码。为什么不实施他在本文后面提供的更安全的解决方案呢?链接很好。为什么你说它“无法到达”?另外:当作为系统连接时,你能执行程序吗?