Oracle会话及连接数优化
一、修改Oracle會(huì)話及最大連接數(shù)
1、查看最大連接數(shù)
SQL> show parameter processes;
NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes????????????????????? integer???? 0
db_writer_processes????????????????? integer???? 3
gcs_server_processes???????????????? integer???? 0
global_txn_processes???????????????? integer???? 1
job_queue_processes????????????????? integer???? 1000
log_archive_max_processes??????????? integer???? 4
processes??????????????????????????? integer???? 150
2、修改最大連接數(shù)
SQL> alter system set processes=500 scope=spfile;
系統(tǒng)已更改。
3、查看最大會(huì)話數(shù)
SQL> show parameters sessions;
NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size?????????? integer???? 0
java_soft_sessionspace_limit???????? integer???? 0
license_max_sessions???????????????? integer???? 0
license_sessions_warning???????????? integer???? 0
sessions???????????????????????????? integer???? 264
shared_server_sessions?????????????? integer
4、修改最大會(huì)話數(shù)
SQL> alter system set sessions=555 scope=spfile;
系統(tǒng)已更改。
5、連接數(shù)和會(huì)話數(shù)計(jì)算關(guān)系
?????? sessions = 1.1 * process + 5
??? 說明:連接數(shù)和會(huì)話數(shù)參數(shù)修改,Oracle必須重啟
二、常用會(huì)話及連接數(shù)查詢方法
1、查詢數(shù)據(jù)庫(kù)最大連接數(shù)
SQL> show parameter processes;
或者
SQL>select value from v$parameter where name = 'processes';
2、修改數(shù)據(jù)庫(kù)最大連接數(shù)(默認(rèn)150)
SQL> alter system set processes=500 scope=spfile;
3、查詢數(shù)據(jù)庫(kù)當(dāng)前連接數(shù)
SQL> select count(*) from v$process;
4、查看數(shù)據(jù)庫(kù)最大會(huì)話數(shù)
SQL> show parameters sessions;
或者
SQL> select value from v$parameter where name = 'sessions';
5、修改數(shù)據(jù)庫(kù)最大會(huì)話數(shù)(默認(rèn)248)
SQL> alter system set sessions=555 scope=spfile;
6、查看當(dāng)前會(huì)話數(shù)
SQL> select count(*) from v$session;
7、查看當(dāng)前并發(fā)(活動(dòng))會(huì)話數(shù)
SQL> select count(*) from v$session where status='ACTIVE';
8、查看當(dāng)前會(huì)話詳細(xì)信息
SQL> select sid,serial#,username,program,machine,status from v$session;
9、查看正在使用的用戶
select osuser,
?????? t1.username as username,
?????? cpu_time / executions / 1000000 || 's' as runtimes,
?????? sql_fulltext,
?????? machine
? from v$session t1, v$sqlarea t2
?where t1.sql_address = t2.address
?order by runtimes desc;
三、OS的參數(shù)區(qū)別
1、Linux和Windows系統(tǒng),對(duì)sessions的處理是有區(qū)別的
??? Linux系統(tǒng)1會(huì)話對(duì)應(yīng)1個(gè)進(jìn)程處理
??? Windows系統(tǒng)1會(huì)話對(duì)應(yīng)1個(gè)線程處理
總結(jié)
以上是生活随笔為你收集整理的Oracle会话及连接数优化的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle 用shutdown+imm
- 下一篇: brtools备份与恢复