ORACLE用户连接的管理(含杀掉oracle进程)
ORACLE用户连接的管理
用系统管理员,查看当前数据库有几个用户连接:
SQL> select username,sid,serial# from v$session;
如果要停某个连接用
SQL> alter system kill session sid,serial#;
如果这命令不行,找它UNIX的进程数
SQL> select pro.spid from v$session ses,v$process pro where ses.sid=21 and ses.paddr=pro.addr;
说明:21是某个连接的sid数
然后用 kill 命令杀此进程号。
如何增加ORACLE连接数
ORACLE的连接数(sessions)与其参数文件中的进程数(process)有关,它们的关系如下:
sessions=(1.1*process+5)
但是我们增加process数时,往往数据库不能启动了。这因为我们还漏调了一个unix系统参数:它是/etc/system/ 中semmns,这是unix系统的信号量参数。每个process会占用一个信号量。semmns调整后,
需要重新启动unix操作系统,参数才能生效。不过它的大小会受制于硬件的内存或ORACLE SGA。范围
可从200--2000不等。
semmns的计算公式为:SEMMNS>processes+instance_processes+system
processes=数据库参数processes的值 instance_processes=5(smon,pmon,dbwr,lgwr,arch)
system=系统所占用信号量。系统所占用信号量可用下列命令查出:#ipcs -sb
其中列NSEMS显示系统已占用信号量。
其它一些跟连接有关的参数,如 licence_max_sessions, licence_sessions_warning 等默认设置都为
零,也就是没有限制。我们可以放心大胆地使用数据库了。
java.sql.SQLException: ORA-00020: maximum number of processes (150) exceeded
解决办法:
加大oracle的连接数
SQL> alter system set processes=300 scope=spfile;
System altered.
重起数据库后该设定才会生效。
SQL> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 252777592 bytes
Fixed Size 451704 bytes
Variable Size 218103808 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> show parameter processes;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
job_queue_processes integer 10
log_archive_max_processes integer 2
processes integer 300
参考:http://study.99net.net/study/database/oracle/1085461824.html
http://study.99net.net/study/database/oracle/1085461836.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/54212/viewspace-976937/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/54212/viewspace-976937/