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.
+2
A:
Try this:
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;
Simeon
2010-04-14 14:17:56
These need to be run as the db admin unfortunately.
Greg Reynolds
2010-04-14 14:24:56
@Greg: No, I'm not an admin for our database but I can query sys.v_$instance. You only need to be a db admin to *grant* select privilege on the v$ tables.
Jeffrey Kemp
2010-04-15 05:45:59
Thanks - still needs a bit of intervention though. In this case it didn't matter too much, so we gave up in the end.
Greg Reynolds
2010-04-15 09:40:46
+3
A:
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.
APC
2010-04-14 14:38:09