Oracle: idle_time appears to be ignored

萝らか妹 提交于 2019-12-08 08:04:34

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9687463/oracle-idle-time-appears-to-be-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!