tags:

views:

56

answers:

3

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
These need to be run as the db admin unfortunately.
Greg Reynolds
@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
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
A: 

I'd suggest something like this - but you should give more details, for example what OS you are on, and what version of Oracle.

p.marino
+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
Thanks for that - it's what I thought.
Greg Reynolds