zhoumingqing
2017-01-03 04:01 阅读 1.5k

oracle utl_file.fopen错误

--sys用户创建目录并授权给yljkjx用户 (数据库为linux 红帽子)
create or replace directory FILENAME as '/usr/software/';
grant read,write on directory FILENAME to yljkjx;
grant execute on utl_file to yljkjx;
alter system set utl_file_dir='/usr/software/' scope=spfile;

--在yljkjx下创建存储过程 PRC_Check_TransData
create or replace procedure PRC_Check_TransData is
filehandle utl_file.file_type;
begin
filehandle := utl_file.fopen('FILENAME','a.txt','w');
utl_file.put_line(filehandle,'test');
utl_file.fclose(filehandle);

END;

--在yljkjx下执行报错
SQL> exec PRC_Check_TransData;
begin PRC_Check_TransData; end;
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at "YLJKJX.PRC_CHECK_TRANSDATA", line 4
ORA-06512: at line 1

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

相关推荐