2024年1月25日 星期四

Point in time recovery 產生 ORA-00285 錯誤

Oracle 版本: 19.15

OS 版本: Linux 7.5


問題描述:

使用 SQL*PLUS 進行 Point in Time Recovery 時產生 ORA-00285 錯誤 :

SQL> recover database until time to_date"('2023-02-17 06:27:00','YYYY-MM-DD HH24:MI:SS')";

ORA-00285: TIME not given as a string constant


嘗試不使用 to_date 轉換也報錯 :

SQL> recover database until time '2023-02-17 06:27:00';

ORA-01861: literal does not match format string


設定 NLS_DATE_FORMAT 日期格式也是不行 :

SQL> alter session set nls_date_format ='YYYY-MM-DD HH24:MI:SS';

Session altered.

SQL> recover database until time '2023-02-17 06:27:00';

ORA-00285: TIME not given as a string constant


問題分析:

ORA-00285 表示日期格式錯誤, SQL*PLUS 所接受的 Point in Time Recovery 的時間格式為 'YYYY-MM-DD:HH24:MI:SS' 。


解決方法:

使用 'YYYY-MM-DD:HH24:MI:SS' 這個時間格式即可 :

SQL> recover database until time '2023-02-17:06:27:00';


ORA-00279: change 6212906414919 generated at 02/17/2023 06:20:24 needed for thread 2

ORA-00289: suggestion : /oradata/FRA/ORCL/archivelog/2023_02_17/o1_mf_2_62700_%u.arc

ORA-00280: change 6212906414919 for thread 2 is in sequence #62700


specify log: {<RET>=suggested | filename | AUTO |CANCEL}



沒有留言:

張貼留言