目前总结的语句,在查看数据的连接情况很有用 ,写完程序一边测试代码一边查看数据库连接的释放情况有助于分析优化出一个健壮的系统程序来。
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;