创新db_link出现ora-02085

今天一个同事在create public database link 后,使用db_link 时总是提示ora-02085 的错误。

报错信息如下: 
ora-2085  "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.
//

可以判断是global_name=true的问题

解决方案有两种

  1. 服务端修噶
  2. 修改创建dblink的语句

方案一 修改服务端:

SQL> show parameter global_names

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
global_names boolean TRUE

SQL>alter system set global_names = false scope =spfile;

SQL>shutdown immediate;

SQL>startup;

方案二 修改创建地dblink语句,注意dblinkname

create database link  orauat

  connect to username identified BY "password"

  using '(DESCRIPTION =

  (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST =XXX.X.X.X)(PORT = 1521))

  )

  (CONNECT_DATA =

    (SERVICE_NAME = orauat)

  )

dblink name SERVICE_NAME  一定要相同

 

 

posted on 2022-08-19 14:39  awei1391  阅读(129)  评论(0编辑  收藏  举报

导航