重庆思庄Oracle、Redhat认证学习论坛

标题: 记一次搭建备库,使用连接串主库无法连接到备库 [打印本页]

作者: mahan    时间: 2022-12-4 17:09
标题: 记一次搭建备库,使用连接串主库无法连接到备库
主库使用连接串连接备库失败
SQL> conn sys/oracle@orcldg as sysdba
ERROR:
ORA-12528: TNS:listener: all appropriate instances are blocking new connections


备库已经建立了静态监听
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = orcldg)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =      
       (GLOBAL_DBNAME = orcldg)                  
       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)                  
       (SID_NAME = orcldg)                                               
     )
    )

主库tns文件
$ cat tnsnames.ora
orcldb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orcldb)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pacsdb1)
    )
  )

ORCLDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orcldg)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pacsdb1)
    )
  )

发现主库tns中的服务名跟备库静态监听的服务名不一致,导致主库识别不到备库,上面标记红色的部分需要一样的服务名,这样就可以连接了







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2