天天看點

ORA-12519錯誤的解決方案

OERR: ORA-12519 TNS:no appropriate service handler found

用戶端連接配接間歇性失敗,報錯ORA-12519

Cause: the listener could not find any available service handlers that are

       appropriate for the client connection.

Action:  檢查lsnrctl service ,instance已經注冊,狀态顯示ready時,可以連接配接。

When the listener believes the current number of connections has reached maximum load,

it may set the state of the service handler for an instance to "blocked" and begin refusing

incoming client connections with either of the following errors: ora-12519 or ora-12516

采用服務動态注冊的方式,由PMON 通過SERVICE_UPDATE 來得到目前連接配接情況,但SERVICE_UPDATE 有時間間隔,

是以,listener顯示的連接配接數和目前實際的連接配接數可能不同。

查詢解決方法:

檢視一下資料庫現有的程序數,是否已經達到參數processes的大小。

   1.select count(*) from v$process;                         取得資料庫目前的程序數。

2.select value from v$parameter where name = 'processes'; 取得程序數的上限。

3.如已達到上限,修改initSID.ora中的processes的大小。

4.重新啟動資料庫到nomount狀态下,執行create spfile from pfile; 并startup open。

查詢資料庫自啟動以來最大的并發數量

select * from v$license

=====================================================================================

在壓力測試的時候,JDBC連接配接出現了ORA-12519錯誤。

連接配接是報錯如下:

<2008-8-23 上午01時34分38秒 CST> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool "rac11g1": Listener refused the connection with the following error:

ORA-12519, TNS:no appropriate service handler found

The Connection descriptor used by the client was:

172.0.2.58:1521:rac11g1

檢查了半天metalink,最終發現是由于Oracle初始化參數的設定問題導緻了bug。

SQL> SHOW PARAMETER SESSION

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

java_max_sessionspace_size integer 0

java_soft_sessionspace_limit integer 0

license_max_sessions integer 0

license_sessions_warning integer 0

session_cached_cursors integer 50

session_max_open_files integer 10

sessions integer 600

shared_server_sessions integer

SQL> SHOW PARAMETER PROCESS

aq_tm_processes integer 0

db_writer_processes integer 2

gcs_server_processes integer 2

global_txn_processes integer 1

job_queue_processes integer 1000

log_archive_max_processes integer 4

processes integer 150

根據Oracle文檔,SESSIONS和TRANSACTIONS的初始化參數應該源于PROCESSES參數,根據預設設定SESSIONS = PROCESSES * 1.1 + 5。

但是目前SESSIONS的設定達到了600,而PROCESSES的設定沒有改變,仍然為150,導緻了過多的使用者會話連接配接到Oracle上時,Oracle沒有足夠的背景程序來支援這些會話。

詳細的問題描述可以參考metalink的文檔:Doc ID: Note:240710.1。

解決方法很簡單,直接設定合适的PROCESSES産生就可以了。

修改process的值的方法二(針對LINUX系統):

先到ORACLE_BASE/admin/你的執行個體名/profile/目錄下找到一個init.ora的檔案,然後修改裡面的process的值,然後将該檔案拷貝到ORACLE_HOME/dbs目錄下,并将檔案重命名為initorcl.ora(其中的orcl為你的資料庫執行個體名,我的資料庫執行個體為orcl是以命名為 initorcl.ora)

用sys使用者同時以sysoper身份登入sqlplus

即 sqlplus sys/sa as sysoper;

進入SQLPLUS後,先把資料庫關閉,可以使用shutdown abort指令,也可以使用shutdown immediate指令,推薦使用shutdown abort指令。然後使用指令startup force即可,說白了就是重新開機資料庫。