Oracle檢視允許的最大連線數和當前連線數

濤ZHAO發表於2014-09-02

目前總結的語句,在檢視資料的連線情況很有用 ,寫完程式一邊測試程式碼一邊檢視資料庫連線的釋放情況有助於分析優化出一個健壯的系統程式來。
1.
Sql程式碼
1.select count() from v$process
select count(
) from v$process –當前的資料庫連線數
2.
Sql程式碼
1.select value from v$parameter where name = `processes`
select value from v$parameter where name = `processes`–資料庫允許的最大連線數
3.
Sql程式碼
1.alter system set processes = 300 scope = spfile;
alter system set processes = 300 scope = spfile;–修改最大連線數:
4.
Sql程式碼
1.shutdown immediate;
2.startup;
shutdown immediate;
startup;–重啟資料庫
5.
Sql程式碼
1.SELECT osuser, a.username,cpu_time/executions/1000000||`s`, b.sql_text,machine
2.from v$session a, v$sqlarea b
3.where a.sql_address =b.address order by cpu_time/executions desc;
SELECT osuser, a.username,cpu_time/executions/1000000||`s`, b.sql_text,machine
from v$session a, v$sqlarea b
where a.sql_address =b.address order by cpu_time/executions desc;
–檢視當前有哪些使用者正在使用資料
6.
Sql程式碼
1.select count() from v$session
select count(
) from v$session –當前的session連線數
7.
Sql程式碼
1.select count() from v$session where status=`ACTIVE`
select count(
) from v$session where status=`ACTIVE` –併發連線數
8.
Sql程式碼
1.show parameter processes
show parameter processes –最大連線
9.
Sql程式碼
1.alter system set processes = value scope = spfile;

相關文章