概述
方法:限制某个用户的访问进程
使用PROFILE 先创建一个PROFILE
create profile ses_conn limit sessions_per_user n; n为最大连接数。
然后将该PROFILE付给需要限制的用户。
alter user xxx profile ses_conn;
最后别忘了确认RESOURCE_LIMIT参数已设为TRUE。 如果没有,用 alter system set recource_limit=TRUE;
实验:限制某个用户的访问进程
命令如下:
SQL> create user test3 identified by 123456;User created.SQL> create profile ses_conn limit sessions_per_user 1;Profile created.SQL> alter user test3 profile ses_conn;User altered.SQL> alter system set resource_limit=TRUE;System altered.SQL> grant create session to test3;Grant succeeded.
#测试结果:
可以看到其他session连接进来会提示exceeded simultaneous SESSIONS_PER_USER limit
提示:上面的实验很有必要做一下的,生产环境这种需求不在少数。
觉得有点实用的走波关注哦,后期会分享更多oracle的内容。