Home » SQL & PL/SQL » SQL & PL/SQL » unable to get data from V$SESSION table
unable to get data from V$SESSION table [message #659480] Wed, 18 January 2017 12:31 Go to next message
asliyanage
Messages: 60
Registered: January 2017
Member
I need to see the data in V$SESSION table.I tried with below query in sql developer.
SELECT * FROM V$SESSION;

Then it gives me below.Why it says table not exist.

ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
Error at Line: 9 Column: 15
Re: unable to get data from V$SESSION table [message #659481 is a reply to message #659480] Wed, 18 January 2017 12:40 Go to previous messageGo to next message
joy_division
Messages: 4899
Registered: February 2005
Location: East Coast USA
Senior Member
Your DBA needs to give you rights to this.
Re: unable to get data from V$SESSION table [message #659483 is a reply to message #659481] Wed, 18 January 2017 22:01 Go to previous messageGo to next message
asliyanage
Messages: 60
Registered: January 2017
Member
i looged as a hr user. if i logged as a SYS or Admin can i do this ?
Re: unable to get data from V$SESSION table [message #659485 is a reply to message #659483] Wed, 18 January 2017 23:51 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8884
Registered: November 2002
Location: California, USA
Senior Member
You can login as sys to grant select on v_$session, which is the underlying table of the v$session view. Then, you can login as hr and select from v$session. Please see the demonstration below.

-- reproduction of problem:
SYS@orcl_12.1.0.2.0> connect hr
Connected.
HR@orcl_12.1.0.2.0> select count(*) from v$session
  2  /
select count(*) from v$session
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

-- connect as sys and grant select on v_$session to hr:
HR@orcl_12.1.0.2.0> connect sys as sysdba
Connected.
SYS@orcl_12.1.0.2.0> grant select on v_$session to hr
  2  /

Grant succeeded.

-- login as hr and select from v$session view:
SYS@orcl_12.1.0.2.0> connect hr
Connected.
HR@orcl_12.1.0.2.0> select count(*) from v$session
  2  /

  COUNT(*)
----------
        37

1 row selected.
Re: unable to get data from V$SESSION table [message #659497 is a reply to message #659483] Thu, 19 January 2017 06:39 Go to previous message
EdStevens
Messages: 976
Registered: September 2013
Senior Member
asliyanage wrote on Wed, 18 January 2017 22:01
i looged as a hr user. if i logged as a SYS or Admin can i do this ?
"Admin" is not a standard oracle account. If it exists in your database, it is because some DBA has created it. Therefore, it is impossible for anyone else to say what you can do with it.

Other than that, Barbara gave you a very comprehensive answer regarding SYS.
Previous Topic: Help with REGEXP_SUBSTR
Next Topic: Collections
Goto Forum:
  


Current Time: Tue Oct 16 02:33:37 CDT 2018