在创建基线过程中遇到了这个错误:
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;
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;