Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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!!!