SYSDATE - pl/sql 函数上出现 1 个错误

发布于 2024-07-18 01:50:24 字数 837 浏览 11 评论 0原文

我有一个问题:

当我在下面发出这个函数时,ti 给出了以下错误:

select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.NEW);'
 from v\$archived_log 
where name is not null;

select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.ADDFILE);' 
 from v\$archived_log 
where name is not null;


EXECUTE DBMS_LOGMNR.START_LOGMNR( STARTTIME => SYSDATE - 1, ENDTIME => SYSDATE,
OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE +
DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.PRINT_PRETTY_SQL);

Error:

*
ERROR at line 1:
ORA-01291: missing logfile
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1

但是我已经添加了几天前的所有存档日志,并且我的系统日期是今天。

请帮忙解决这个问题。

谢谢。

雷格兹·

阿约

I have an issue:

when i issue this function below ti gives me the following error:

select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.NEW);'
 from v\$archived_log 
where name is not null;

select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.ADDFILE);' 
 from v\$archived_log 
where name is not null;


EXECUTE DBMS_LOGMNR.START_LOGMNR( STARTTIME => SYSDATE - 1, ENDTIME => SYSDATE,
OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE +
DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.PRINT_PRETTY_SQL);

Error:

*
ERROR at line 1:
ORA-01291: missing logfile
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1

But i have added all the archived logs for several days before and my sysdate is at today.

Kindly help out on this issue.

thanks.

Reagrds

Ayo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

等数载,海棠开 2024-07-25 01:50:24

您需要从前两个查询中获取值并实际执行它们,无论如何您似乎都存在语法错误。

BEGIN
  FOR CUR_NEW IN ( 
    select 'CALL DBMS_LOGMNR.ADD_LOGFILE(' ||
           'LOGFILENAME =>'''||name||''','||
           'OPTIONS=>DBMS_LOGMNR.NEW);' as COMM
    from v$archived_log 
    where name is not null
  ) LOOP
    EXECUTE IMMEDIATE CUR_NEW.COMM;
  END LOOP;

  FOR CUR_ADD IN ( 
    select 'CALL DBMS_LOGMNR.ADD_LOGFILE(' ||
           'LOGFILENAME =>'''||name||''','||
           'OPTIONS=>DBMS_LOGMNR.ADDFILE);' as COMM
    from v$archived_log 
    where name is not null
  ) LOOP
    EXECUTE IMMEDIATE CUR_ADD.COMM;
  END LOOP;

  EXECUTE IMMEDIATE 'CALL DBMS_LOGMNR.START_LOGMNR( ' ||
    'STARTTIME => SYSDATE - 1, ' ||
    'ENDTIME => SYSDATE, ' ||
    'OPTIONS => ' ||
      '  DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG '||
      '+ DBMS_LOGMNR.CONTINUOUS_MINE '||
      '+ DBMS_LOGMNR.COMMITTED_DATA_ONLY '||
      '+ DBMS_LOGMNR.PRINT_PRETTY_SQL)';
END;

You need to take the values from the first two queries and actually execute them, and you seem to have a syntax error in there anyway.

BEGIN
  FOR CUR_NEW IN ( 
    select 'CALL DBMS_LOGMNR.ADD_LOGFILE(' ||
           'LOGFILENAME =>'''||name||''','||
           'OPTIONS=>DBMS_LOGMNR.NEW);' as COMM
    from v$archived_log 
    where name is not null
  ) LOOP
    EXECUTE IMMEDIATE CUR_NEW.COMM;
  END LOOP;

  FOR CUR_ADD IN ( 
    select 'CALL DBMS_LOGMNR.ADD_LOGFILE(' ||
           'LOGFILENAME =>'''||name||''','||
           'OPTIONS=>DBMS_LOGMNR.ADDFILE);' as COMM
    from v$archived_log 
    where name is not null
  ) LOOP
    EXECUTE IMMEDIATE CUR_ADD.COMM;
  END LOOP;

  EXECUTE IMMEDIATE 'CALL DBMS_LOGMNR.START_LOGMNR( ' ||
    'STARTTIME => SYSDATE - 1, ' ||
    'ENDTIME => SYSDATE, ' ||
    'OPTIONS => ' ||
      '  DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG '||
      '+ DBMS_LOGMNR.CONTINUOUS_MINE '||
      '+ DBMS_LOGMNR.COMMITTED_DATA_ONLY '||
      '+ DBMS_LOGMNR.PRINT_PRETTY_SQL)';
END;
廻憶裏菂餘溫 2024-07-25 01:50:24

看起来好像您运行了选择但没有执行句子。

It seem like if you ran the select but no execute the sentences.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文