脚本内容
SELECT VERSION,
TO_CHAR(CURRENT_SCN),
DATE_TIME,
TO_CHAR(ROUND(HEADROOM, 2))
FROM (SELECT VERSION,
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER CURRENT_SCN,
TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') DATE_TIME,
case
when replace(version, '.', '') < 112020 then
((((((TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')) - 1988) * 12 * 31 * 24 * 60 * 60) +
((TO_NUMBER(TO_CHAR(SYSDATE, 'MM')) - 1) * 31 * 24 * 60 * 60) +
(((TO_NUMBER(TO_CHAR(SYSDATE, 'DD')) - 1)) * 24 * 60 * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')) * 60 * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'MI')) * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))) * (16 * 1024)) -
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER) /
(16 * 1024 * 60 * 60 * 24))
else
((((((TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')) - 1988) * 12 * 31 * 24 * 60 * 60) +
((TO_NUMBER(TO_CHAR(SYSDATE, 'MM')) - 1) * 31 * 24 * 60 * 60) +
(((TO_NUMBER(TO_CHAR(SYSDATE, 'DD')) - 1)) * 24 * 60 * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')) * 60 * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'MI')) * 60) +
(TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))) * (32 * 1024)) -
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER) /
(32 * 1024 * 60 * 60 * 24))
end HEADROOM
FROM V$INSTANCE);
评论
贡献排行榜