ITPub博客

首页 > 数据库 > Oracle > ORA-01861: literal does not match format string

ORA-01861: literal does not match format string

原创 Oracle 作者:路途中的人2012 时间:2017-03-08 14:09:20 0 删除 编辑
在创建基线过程中遇到了这个错误:

SYS@db1> BEGIN
2  DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE (
3    start_time  =>'2017-03-06 7:00:00' ,
4    end_time   => '2017-03-06 8:00:00' ,
5    baseline_name  => 'AWR_bs3',
6    expiration     => NULL );
7  END;
8  /
BEGIN
*
ERROR at line 1:
ORA-01861: literal does not match format string
ORA-06512: at line 2

原因是日期需要用to_date从字符串转化成日期格式,改成如下格式即可:

BEGIN 
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE ( 
  start_time  => to_date('2017-03-06 7:00:00' , 'yyyy-mm-dd hh24:mi:ss'), 
  end_time   => to_date('2017-03-06 8:00:00' , 'yyyy-mm-dd hh24:mi:ss'), 
  baseline_name  => 'AWR_bs3', 
  expiration     => NULL ); 
END;



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29067253/viewspace-2134928/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-01-08

  • 博文量
    495
  • 访问量
    768398