【转】Modify Oracle Process and Session

java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=12519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))  at oracle.jdbc.dbaccess.DBError.throwSqlException

这样的问题,先前我让他检查一下程序,他说已确定程序没什么问题。后来我也和他们一起检测过程序,确实程序是没有问题的。这时我想到了可能是数据库连接数的问题

我先用select *  from   sys.v_$session

SQL> select count(*) from v$process;

  COUNT(*)
----------
        44

SQL> select count(*) from v$session;

  COUNT(*)
----------
        39

这个sql查看了一下当前的用户连接数。这个结果也基本正常,接下来我想由于他的这个业务比较复杂,可能是oracle默认的连接数不够,所以我们修改了一下oracle的init.ora文件的配置。在此和大家一起分享一下在oracle的安装目录下:%oracle_home%\admin\orcl\pfile\有一个init.ora文件



我们来分析一下这个文件的内容

######################################################### Copyright (c) 1991, 2001 by Oracle Corporation
#########################################################
MTS
dispatchers="(PROTOCOL=TCP)(SER=MODOSE)", "(PROTOCOL=TCP)(PRE=oracle.aurora.server.GiopServer)", "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
###########################################
# 其他
###########################################
compatible=9.0.0db_name=orcl
###########################################
# 分布式, 复制和快照

###########################################
db_domain=""remote_login_passwordfile=EXCLUSIVE
###########################################
# 排序, 散列联接, 位图索引

###########################################
sort_area_size=524288
###########################################
# 文件配置
###########################################
control_files=("D:\oracle\oradata\orcl\CONTROL01.CTL", "D:\oracle\oradata\orcl\CONTROL02.CTL", "D:\oracle\oradata\orcl\CONTROL03.CTL")
###########################################
# 池

###########################################
java_pool_size=33554432large_pool_size=1048576shared_pool_size=33554432
###########################################
# 游标和库高速缓存

###########################################
open_cursors=300
###########################################
# 系统管理的撤销和回退段

###########################################
undo_management=AUTOundo_tablespace=UNDOTBS
###########################################
# 网络注册
###########################################
instance_name=orcl
###########################################
# 诊断和统计
###########################################
background_dump_dest=D:\oracle\admin\orcl\bdumpcore_dump_dest=D:\oracle\admin\orcl\cdumptimed_statistics=TRUEuser_dump_dest=D:\oracle\admin\orcl\udump
###########################################
# 进程和会话
###########################################
processes=150
###########################################
# 重做日志和恢复
###########################################
fast_start_mttr_target=300
###########################################
# 高速缓存和 I/O
###########################################
db_block_size=4096db_cache_size=33554432



在这个文件的processes=150我们把这个值改为260之后就没问题了!但是要注意的是:用户最大连接数跟你的硬件配置有关,所以要谨慎

当然还有其他两种修改的方式:



第一种方法:
在 Oracle 企业管理器例程-->会话中可以查看当前连接到数据库的详细信息


第二种方法:
SQLPLUS下运行:alter system set processes=250 scope=spfile;



其他:

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 等默认设置都为零,也就是没有限制。


以上转自:http://blog.sina.com.cn/s/blog_53d27b3a01008o5r.html


从Oracle9i开始,ALTER SYSTEM命令增加了一个新的选项scope。scope参数有3个可选值:memory、spfile和both。

       ●memory:只改变当前实例运行,重新启动数据库后失效。

       ●spfile    :只改变spfile的设置,不改变当前实例运行,重新启动数据库后生效。

       ●both     :同时改变实例及spfile,当前更改立即生效,重新启动数据库后仍然有效。

        可以通过ALTER SYSTEM或者导入导出来更改spfile的内容。

       针对RAC环境,ALTER SYSTEM还可以指定SID参数,对不同实例进行不同设置。

       通过spfile修改参数的完整命令如下:

       alter system set <parameter_name>=<value> scope=memory|spfile|both [sid=<sid_name>]

from offical doc:官方的文档的确是个好东西啊,仔细研读啊,什么都有....

===================================

SCOPE Clause Description
SCOPE = SPFILE The change is applied in the server parameter file only. The effect is as follows:
For dynamic parameters, the change is effective at the next startup and is persistent.

For static parameters, the behavior is the same as for dynamic parameters. This is the only SCOPE specification allowed for static parameters.

SCOPE = MEMORY The change is applied in memory only. The effect is as follows:
For dynamic parameters, the effect is immediate, but it is not persistent because the server parameter file is not updated.

For static parameters, this specification is not allowed.

SCOPE = BOTH The change is applied in both the server parameter file and memory. The effect is as follows:
For dynamic parameters, the effect is immediate and persistent.

For static parameters, this specification is not allowed.



It is an error to specify SCOPE=SPFILE or SCOPE=BOTH if the server is not using a server parameter file. The default is SCOPE=BOTH if a server parameter file was used to start up the instance, and MEMORY if a text initialization parameter file was used to start up the instance.

For dynamic parameters, you can also specify the DEFERRED keyword. When specified, the change is effective only for future sessions.

An optional COMMENT clause lets you associate a text string with the parameter update. When you specify SCOPE as SPFILE or BOTH, the comment is written to the server parameter file.

The following statement changes the maximum number of job queue processes allowed for the instance. It includes a comment, and explicitly states that the change is to be made only in memory (that is, it is not persistent across instance shutdown and startup).

ALTER SYSTEM SET JOB_QUEUE_PROCESSES=50 COMMENT='temporary change on Nov 29' SCOPE=MEMORY;

以上转自:http://blog.sina.com.cn/s/blog_5fbb16590100krtn.html

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值