🍒Check Database Uptime on Oracle
Get Started
ทำการตรวจสอบ Instance Start Time
select instance_name, to_char(startup_time,'DD/MM/YYYY HH24:MI:SS') as start_time from v$instance ;
INSTANCE_NAME START_TIME
---------------- -------------------
ORCL 01/01/2020 00:00:00
ทำการตรวจสอบ History Start Time
select instance_name, to_char(startup_time,'DD/MM/YYYY HH24:MI:SS') as start_time from dba_hist_database_instance order by startup_time desc ;
INSTANCE_NAME START_TIME
---------------- -------------------
ORCL 01/01/2020 00:00:00
ORCL 01/01/2019 00:00:00
ทำการตรวจสอบ PMON Start Time
select database_name, to_char(logon_time,'DD/MM/YYYY HH24:MI:SS') as start_time from v$session where program like '%PMON%' ;
DATABASE_NAME START_TIME
---------------- -------------------
ORCL 01/01/2020 00:00:00
ทำการตรวจสอบ SID Start Time
select database_name, to_char(logon_time,'DD/MM/YYYY HH24:MI:SS') as start_time from v$session where sid=1 ;
DATABASE_NAME START_TIME
---------------- -------------------
ORCL 01/01/2020 00:00:00
ทำการตรวจสอบ Database Uptime
select
'HOST_NAME : ' || host_name,
'INSTANCE_NAME : ' || instance_name,
'START_TIME : ' || to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') START_TIME,
'DATABASE_UPTIME : ' || floor(sysdate - startup_time) || ' days(s) ' || trunc( 24*((sysdate-startup_time) - trunc(sysdate-startup_time))) || ' hour(s) ' || mod(trunc(1440*((sysdate-startup_time) - trunc(sysdate-startup_time))), 60) ||' minute(s) ' || mod(trunc(86400*((sysdate-startup_time) - trunc(sysdate-startup_time))), 60) ||' seconds' DATABASE_UPTIME
from sys.v_$instance ;
HOST_NAME : lab-dcsite.lab.local
INSTANCE_NAME : ORCL
START_TIME : 01-JAN-2020 00:00:00
DATABASE_UPTIME : 120 days(s) 3 hour(s) 30 minute(s) 30 seconds
อ่านเพิ่มเติม : https://bit.ly/38meNhr
Last updated
Was this helpful?