Reputation: 12600
In my understanding, creating a profile with the idle_time
set to a certain value (in minutes) and creating a user with this profile should force the SNIPED
status for that user's session in case he is idle for longer than idle_time
. When the user tries to execute a query after this has happened, he receives a message that he must connect again.
First question: Is that right? If so, read on:
I'm running a test script as follows in sqlplus (without the placeholders obviously):
connect system/<password>@<tns>
CREATE PROFILE test_profile LIMIT idle_time 1;
CREATE USER test_user PROFILE test_profile IDENTIFIED BY test_user;
GRANT CREATE SESSION TO test_user;
GRANT ALTER SESSION TO test_user;
GRANT SELECT ON <schema>.<table> TO test_user;
disconnect;
connect test_user/test_user@<tns>
SELECT * FROM <schema>.<table>;
Everything works up to this point; the sqlplus window is still open. Now I open an additional sqplus window and connect using the system account, running the following query after doing other stuff for a while:
SELECT username, status, seconds_in_wait FROM v$session WHERE username = 'test_user';
I get something like:
USERNAME STATUS SECONDS_IN_WAIT
--------- -------- ---------------
TEST_USER INACTIVE 1166
Why has the status not been set to SNIPED
?
Obviously, If I run another query from the test_user's sqlplus window, I do not get a message asking me to reconnect.
Upvotes: 1
Views: 3872
Reputation: 231781
You need to set the database's RESOURCE_LIMIT
parameter to TRUE
in order for resource limits in profiles to take effect. Assuming you use a spfile (otherwise omit the scope = BOTH
part)
ALTER SYSTEM SET resource_limit = TRUE scope = BOTH
Once you do that, PMON
should start sniping the sessions that have exceeded your IDLE_TIME
when it wakes up every few minutes.
Upvotes: 4