ORA-02058錯誤解決

djb1008發表於2011-12-09

一個開發商反映,使用DB_LINK的時候,資料庫報ORA-02085的錯誤,DB_LINK 以前是可以用的,現在突然不可以用了.

檢查了資料庫的環境,大致情況如下:

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

XSDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 12.56.123.97 )(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 12.56.123.98 )(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

建立db_link的語句:
SQL>Create database link "SJLL" connect to USER1 identified by "PWD_USER1" using 'XSDB';


透過DB_LINK訪問遠端資料庫的物件是報了ORA-02058的錯誤
SQL>select * from ;
ORA-02058 "database link %s connects to %s"

[@more@]

問題解決的步驟

1.透過oracle的工具oerr,查詢這個錯誤的描述
[oracle@localhost admin]$ oerr ora 2085
02085, 00000, "database link %s connects to %s"
// *Cause: a database link connected to a database with a different name.
// The connection is rejected.
// *Action: create a database link with the same name as the database it
// connects to, or set global_names=false.
//

2.更改global_names引數
[oracle@localhost admin]$ sqlplus / as sysdba

SQL> show parameter global_names
NAME TYPE----------------------VALUE
------------------------------
global_names boolean TRUE

SQL> alter system set global_names=false scope=both;
System altered.
SQL> exit

3.遠端資料庫訪問正常
SQL>select * from ;
......

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/32980/viewspace-1056768/,如需轉載,請註明出處,否則將追究法律責任。

相關文章