ora 12545連線錯誤解決一例

2021-09-03 06:06:54 字數 3424 閱讀 7733

我們看一下本地資料庫tnsnames的配置:

testrac =

(description =

(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521))

(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))

(load_balance = yes)

(connect_data =

(server = dedicated)

(service_name = 10.58.12.124)

(failover_mode =

(type = select)

(method = basic)

(retries = 180)

(delay = 5)))

oracle在文件note:364855.1:rac connection redirected to wrong host/ip ora-12545中進行了描述,並給出了解決方法:修改資料庫中的初始化引數local_listener(注:這種方法在修改初始化引數後,需要重啟監聽,重啟例項)

sql>conn / as sysdba;

connected.

sql> alter system set local_listener = '(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521)) 'sid = 'prodb1';

系統已更改。

登入另外乙個節點

sql>conn / as sysdba;

connected.

sql> alter system set local_listener = '(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))' sid = 'prodb2';

系統已更改。

設定之後,再次嘗試連線資料庫:

sql> conn sys/ted@123e@prodb as sysdba;

connected.

sql> conn sys/ted@789e@prodb as sysdba;

connected.

修改之後,沒有再次出現同樣的錯誤。

我們也可以通過只修改客戶端hosts檔案的方式,來解決這個問題。

首先在linux主機上修改hosts檔案

root@prodb1 # vi /etc/hosts

#10.58.12.120            prodb1-public   # public

10.58.12.124            prodb1          # virtual

23.23.23.120            prodb1-priv     # private

10.58.12.121            prodb2-public   # public

10.58.12.125            prodb2          # virtual

23.23.23.121            prodb2-priv     # private

10.58.12.126            prodb-scan      # scan

然後客戶端的tnsnames.ora中的配置如下:

$ more $oracle_home/network/admin/tnsnames.ora

# tnsnames.ora network configuration file: /data/oracle/product/11.2/database/network/admin/tnsnames.ora

# generated by oracle configuration tools.

listeners_prodb =

(address_list =

(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521))

(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))

)listener_prodb1 =

(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521))

listener_prodb2 =

(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))

prodb =

(description =

(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521))

(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))

(load_balance = yes)

(connect_data =

(server = dedicated)

(service_name = prodb)

(failover_mode =

(type = select)

(method = basic)

(retries = 180)

(delay = 5)))

)prodb1 =

(description =

(address = (protocol = tcp)(host = 10.58.12.124)(port = 1521))

(connect_data =

(server = dedicated)

(service_name = prodb)

(instance_name = prodb1)))

prodb2 =

(description =

(address = (protocol = tcp)(host = 10.58.12.125)(port = 1521))

(connect_data =

(server = dedicated)

(service_name = prodb)

(instance_name = prodb2)))

下面嘗試連線遠端rac資料庫:

sql> conn sys/ted@123e@prodb as sysdba;已連線。

sql> conn sys/ted@789e@prodb as sysdba;已連線。

其實在本地hosts檔案中加上rac例項所在伺服器的ip和主機名資訊,就可以避免這個錯誤。

另外注意在rac環境中,任何修改都一定要謹慎。rac 環境一旦安裝好後,主機名就不能隨意修改,除非先刪除節點,修改hostname,再新增節點。還有一點主機名必須和public名一致,這一點也非常重要。

ora 12545連線錯誤解決一例

在遠端客戶端連線rac資料庫時,通過統一的服務名連線時經常會出現ora 12545錯誤。在metalink上查詢了一下,竟是oracle的乙個小bug。環境 oracle 11g r2 rac資料庫,兩節點。現象 oracle ted35 sqlplus nolog sql plus release...

連線資料庫經常出現ORA 12545錯誤

連線到rac資料庫的時候經常會出現ora 12545錯誤,在metalink上查詢了一下,是oracle的乙個小bug。在遠端客戶端連線rac資料庫時,通過統一的服務名連線時經常會出現ora 12545錯誤。sql conn ndmain testrac輸入口令 已連線。sql conn ndmai...

LNK2005 連線錯誤解決辦法

nafxcwd.lib afxmem.obj error lnk2005 void cdecl operator new unsigned int 2 yapaxi z 已經在 libcmtd.lib new.obj 中定義 nafxcwd.lib afxmem.obj error lnk2005 ...