1753834 Members
8363 Online
108806 Solutions
New Discussion юеВ

Disconnecting Users

 
SOLVED
Go to solution
Allen Karczmarek
Occasional Contributor

Disconnecting Users

Hi,
I am trying to kill certain sessions from a stored procedure in an Oracle database. I've tried to create a cursor to get a list of the sid's and serial#'s to kill. The cursor selects from v$session in a stored procedure (see below). I keep getting the error also listed below. I am connected as system when trying to compile the code. Any suggestions?

Thanks,
Allen

CURSOR TO_BE_KILLED IS
SELECT username, sid, serial#
FROM v$session;

PLS-00201: identifier 'SYS.V_$SESSION' must be declared
2 REPLIES 2
Brian Crabtree
Honored Contributor
Solution

Re: Disconnecting Users

You should grant select against the view directly to the user. Stored procedures do not hold grants given through roles in some cases, and almost always when using SYS owned tables.

Format is:
grant select on sys.v_$session to ;

Thanks,

Brian
Allen Karczmarek
Occasional Contributor

Re: Disconnecting Users

Worked like a champ!!!!! THANKS!!!