Oracle Uptime Query

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;

Your question specifies "non admin user" so I'm afraid the answer is probably no. The usual mechanisms require selecting from V$ views - V$INSTANCE or V$SESSION. Neither of these are granted to PUBLIC by default.

If you ask your DBA nicely they might be prepared to grant you access to those views, or at least write a wrapping function (or functions) to expose those values.

Tags:

Oracle