Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle Uptime Query

Tags:

oracle

Is there a way for a non admin user to check the uptime of an Oracle instance? I.e. I don't have sysdba privileges.

like image 571
Greg Reynolds Avatar asked Apr 14 '10 14:04

Greg Reynolds


People also ask

What does Current_date return in Oracle?

CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of datatype DATE. The following statement shows the current date in 'DD-MON-YYYY HH24:MI:SS' format : SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS'; Session altered.


1 Answers

Try this. It doesn't require an admin user, although SELECT access to the v_$instance table.

SELECT to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time"
FROM sys.v_$instance;

Or, if you assume that PMON startup time is the same as the database startup time, you can get the uptime like this:

SELECT to_char(logon_time,'DD/MM/YYYY HH24:MI:SS')
FROM v$session
WHERE sid=1;
like image 79
Simeon Avatar answered Oct 12 '22 14:10

Simeon