alter system set processes=500; alter system set sessions=555;
$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 19:21:25 2009Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing optionsSQL> show parameters resourceNAME TYPE VALUE ------------------------------------ ----------- ------------------------------ resource_limit boolean FALSE resource_manager_plan string SQL> alter system set resource_limit=true;System altered.SQL> CREATE PROFILE testprofile LIMIT SESSIONS_PER_USER 1 2 /Profile created. SQL> CREATE USER testuser IDENTIFIED BY test 2 PROFILE testprofile 3 /User created.SQL> grant connect to testuser;Grant succeeded.--开第一个进程后开第二个---$ sqlplus testuser/testSQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 19:27:08 2009Copyright (c) 1982, 2007, Oracle. All Rights Reserved.ERROR: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
使用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文查看: select * from dba_profiles;
alter system set sessions=555;
$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 19:21:25 2009Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing optionsSQL> show parameters resourceNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
resource_limit boolean FALSE
resource_manager_plan string
SQL> alter system set resource_limit=true;System altered.SQL> CREATE PROFILE testprofile LIMIT SESSIONS_PER_USER 1
2 /Profile created.
SQL> CREATE USER testuser IDENTIFIED BY test
2 PROFILE testprofile
3 /User created.SQL> grant connect to testuser;Grant succeeded.--开第一个进程后开第二个---$ sqlplus testuser/testSQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 19:27:08 2009Copyright (c) 1982, 2007, Oracle. All Rights Reserved.ERROR:
ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
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文查看:
select * from dba_profiles;