1.查詢數(shù)據(jù)庫當(dāng)前進(jìn)程的連接數(shù):
select count(*) from v$process;
2.查看數(shù)據(jù)庫當(dāng)前會(huì)話的連接數(shù):
elect count(*) from v$session;
3.查看數(shù)據(jù)庫的并發(fā)連接數(shù):
select count(*) from v$session where status='ACTIVE';
4.查看當(dāng)前數(shù)據(jù)庫建立的會(huì)話情況:
select sid,serial#,username,program,machine,status from v$session;
5.查詢數(shù)據(jù)庫允許的最大連接數(shù):
select value from v$parameter where name = 'processes';
或者命令:show parameter processes;
6.修改數(shù)據(jù)庫允許的最大連接數(shù):
alter system set processes = 300 scope = spfile;
(需要重啟數(shù)據(jù)庫才能實(shí)現(xiàn)連接數(shù)的修改)
重啟數(shù)據(jù)庫:
SQL>shutdown immediate;
SQL>startup;
查看當(dāng)前有哪些用戶正在使用數(shù)據(jù):
SQL>select osuser,a.username,cpu_time/executions/1000000||'s',sql_fulltext,machine
SQL>from v$session a,v$sqlarea b
SQL>where a.sql_address = b.address
SQL>order by cpu_time/executions desc;
備注:UNIX 1個(gè)用戶session對應(yīng)一個(gè)操作系統(tǒng)process,而Windows體現(xiàn)在線程。
啟動(dòng)oracle
su - oracle
SQL>sqlplus system/pwd as sysdba //進(jìn)入sql
SQL>startup //啟動(dòng)數(shù)據(jù)庫
SQL>lsnrctl start //啟動(dòng)監(jiān)聽
sqlplus "/as sysdba"
SQL>shutdown immediate; //關(guān)閉數(shù)據(jù)庫
SQL>startup mount;
SQL>alter database open;