Listener refused the connection with the following error 錯誤解決

查詢數據庫當前進程的連接數: 

  select count(*) from v$process; 

  查看數據庫當前會話的連接數: 

  elect count(*) from v$session; 

  查看數據庫的併發連接數: 

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

  查看當前數據庫建立的會話情況: 

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

  查詢數據庫允許的最大連接數: 

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

  或者:show parameter processes; 

  修改數據庫允許的最大連接數: 

  alter system set processes = 300 scope = spfile; 

  (需要重啓數據庫才能實現連接數的修改) 

  重啓數據庫: 

  shutdown immediate; 

  startup; 

  查看當前有哪些用戶正在使用數據: 

  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對應一個操作系統process,而Windows體現在線程。 

  啓動oracle 

  su - oracle 

  sqlplus system/pwd as sysdba //進入sql 

  startup //啓動數據庫 

  lsnrctl start //啓動監聽 

  sqlplus "/as sysdba" 

  shutdown immediate; 

  startup mount; 

  alter database open; 

--

web應用連接oracle數據庫時,經常在查詢數據時發生

Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found The Connection descriptor used by the client was: 127.0.0.1:1521:ORCL

這種錯誤,網上查了很多,都說是ip地址改變之後的問題,要把tnsnames.ora中的實例配置中改爲計算機名,我試過之後問題還是不能解決,今天終於找到問題所在了,是數據庫連接數量的問題,12519錯誤爲監聽不能提供服務,通常爲數據庫進程達到上限導致。

      可以先執行下 select count(*) from v$process ,看下現在系統有多少連接數,然後再查詢 select value from v$parameter where name = 'processes' ,看下oracle設置中設置了多少連接數,一般一個應用都會使用20個,所以如果你開了幾個應用的話(web、pl/sql、……)就會出這個問題了,這時只需要執行下

alter system set processes = 300 scope = spfile;

就可以了,當然300可以根據實際情況設置。

發佈了22 篇原創文章 · 獲贊 11 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章