今天晚上加班,有個存儲過程,裏面已經有4個dblink了,但是由於業務需要,還需要再加幾個,在加到第五個的時候,系統忽然拋出一個錯誤:ora-02020 too many database links in use。諮詢oracle工程師,得出的結論是在oracle的系統參數中,OPEN_LINKS和open_links_per_instanse兩個參數設置問題,系統默認爲4,並沒有對這個參數修改。
操作:
1)用sys登錄,
2)show parameter spfile;
看到下面有文件,說明oracle用的的是spfile。
3) 備份SPFILE,放置設置有問題需要倒回
create pfile='/opt/oracle/spfile2011***.ora' from spfile;
4)show parameter open
SQL> show parameter open
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
open_cursors integer 300
open_links integer 4
open_links_per_instance integer 4
read_only_open_delayed boolean FALSE
session_max_open_files integer 10
5)修改兩個參數:open_links,open_links_per_instance
alter system set open_links=50 scope=spfile
alter system set open_links_per_instance=50 scope=spfile
6)重啓數據庫,設置完成。
原來以爲open_links這個參數是指整個數據庫允許用多少個dblink,open_links_per_instance這個參數是指每個實例最多允許的dblink個數。後來查資料才發現第一個參數的意思理解錯了,open_links oracle的官方解釋是每個session最多允許的dblink數量。至於其他的區別,在看了英文的解釋以後,還是不大明白。希望又看到了,懂得這些的兄弟姐妹能夠給補充一下。哈哈