教你修改Oracle數(shù)據(jù)庫的連接數(shù)

2010-08-28 10:55:55來源:西部e網(wǎng)作者:

 測試了這個,不錯。

  摘(一)

  1. 查看processes和sessions參數(shù)

  SQL> show parameter processes

  NAME                                  TYPE         VALUE

  db_writer_processes                  integer     1

  gcs_server_processes                 integer     0

  job_queue_processes                  integer     10

  log_archive_max_processes            integer     2

  processes                            integer     50

  SQL> show parameter sessions

  NAME                                  TYPE         VALUE

  license_max_sessions                 integer     0

  license_sessions_warning             integer     0

  logmnr_max_persistent_sessions       integer     1

  sessions                             integer     60

  shared_server_sessions               integer

  2. 修改processes和sessions值

  SQL> alter system set processes=300 scope=spfile;

  系統(tǒng)已更改。

  SQL> alter system set sessions=335 scope=spfile;

  系統(tǒng)已更改。

  3. 修改processes和sessions值必須重啟oracle服務(wù)器才能生效

  ORACLE的連接數(shù)(sessions)與其參數(shù)文件中的進(jìn)程數(shù)(process)有關(guān),它們的關(guān)系如下:

  sessions=(1.1*process+5)

  摘(二)

  查詢數(shù)據(jù)庫當(dāng)前進(jìn)程的連接數(shù):

  select count(*) from v$process;

  查看數(shù)據(jù)庫當(dāng)前會話的連接數(shù):

  elect count(*) from v$session;

  查看數(shù)據(jù)庫的并發(fā)連接數(shù):

  select count(*) from v$session where status='ACTIVE';

  查看當(dāng)前數(shù)據(jù)庫建立的會話情況:

  select sid,serial#,username,program,machine,status from v$session;

  查詢數(shù)據(jù)庫允許的最大連接數(shù):

  select value from v$parameter where name = 'processes';

  或者:show parameter processes;

  修改數(shù)據(jù)庫允許的最大連接數(shù):

  alter system set processes = 300 scope = spfile;

  (需要重啟數(shù)據(jù)庫才能實(shí)現(xiàn)連接數(shù)的修改)

  重啟數(shù)據(jù)庫:

  shutdown immediate;

  startup;

  查看當(dāng)前有哪些用戶正在使用數(shù)據(jù):

  select osuser,a.username,cpu_time/executions/1000000||'s',sql_fulltext,machine

  from v$session a,v$sqlarea b

  where a.sql_address = b.address

  order by cpu_time/executions desc;

  備注:UNIX 1個用戶session對應(yīng)一個操作系統(tǒng)process,而Windows體現(xiàn)在線程。

  啟動oracle

  su - oracle

  sqlplus system/pwd as sysdba   //進(jìn)入sql

  startup                                      //啟動數(shù)據(jù)庫

  lsnrctl start                               //啟動監(jiān)聽

  sqlplus "/as sysdba"

  shutdown immediate;

  startup mount;

  alter database open;

關(guān)鍵詞:Oracle

贊助商鏈接: