解决DGMGRL Unable to connect to database ORA-12541: TNS:no listener问题

简介:
晚上配了一套11.2.0.2 的DataGuard物理备库,准备用DGMGRL做切换测试,结果发现在切换过程中会遇到"Unable to connect to database"的问题,具体日志如下:  
DGMGRL> switchover to dgogg
Performing switchover NOW, please wait...
New primary database "dgogg" is opening...
Operation requires shutdown of instance "SBDB" on database "sbdb"
Shutting down instance "SBDB"...
ORACLE instance shut down.
Operation requires startup of instance "SBDB" on database "sbdb"
Starting instance "SBDB"...
Unable to connect to database
ORA-12541: TNS:no listener

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
        start up instance "SBDB" of database "sbdb"
  ORA-12541: TNS:no listener显然是因为DGMGRL使用的连接串ConnectIdentifier存在问题,但是在创建DGMGRL的Configuration之前我已经将SERIVCENAME_DGMGLR形式的静态信息添加到listener.ora文件中了,如:  
DGLSN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vrh3.oracle.com)(PORT = 1588))
  )

SID_LIST_DGLSN =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = DGOGG)
      (ORACLE_HOME = /s01/orabase/product/11.2.0/dbhome_1)
      (SID_NAME = DGOGG)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = DGOGG_DGB)
      (ORACLE_HOME = /s01/orabase/product/11.2.0/dbhome_1)
      (SID_NAME = DGOGG)
    )

    (SID_DESC =
      (GLOBAL_DBNAME = DGOGG_DGMGRL)
      (ORACLE_HOME = /s01/orabase/product/11.2.0/dbhome_1)
      (SID_NAME = DGOGG)
    )
  )
  查了半天最后终于发现时因为监听端口的问题,我创建的LISTENER DGLSN使用1588端口,而dgmgrl中的静态连接串默认使用1521端口,如:  
DGMGRL> show database dgogg

Database - dgogg

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    DGOGG

Database Status:
SUCCESS

DGMGRL> show database verbose dgogg

Database - dgogg

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    DGOGG

  Properties:
    DGConnectIdentifier             = 'dgogg_dgb'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'sync'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'MANUAL'
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    SidName                         = 'DGOGG'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vrh3.oracle.com)
    (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=DGOGG_DGMGRL)(INSTANCE_NAME=DGOGG)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '/s01/orabase/arch'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.dbf'
    TopWaitEvents                   = '(monitor)'
  了解到问题所在后就容易解决了,只需要修改Broker中的StaticConnectIdentifier就可以了:  
edit database dgogg set property StaticConnectIdentifier='(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vrh3.oracle.com)(PORT = 1588)) (CONNECT_DATA =
(SERVER = DEDICATED) (SERVICE_NAME = DGOGG_DGMGRL)))';

edit database sbdb set property StaticConnectIdentifier='(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = vrh4.oracle.com)(PORT = 1588))) (CONNECT_DATA =
(SERVICE_NAME = SBDB_DGMGRL)))';
  再次尝试切换Switchover DataGuard,不再需要手动启动standby 实例了:  
 

SUCCESS



本文转自maclean_007 51CTO博客,原文链接:
http://blog.51cto.com/maclean/1278070

相关文章
|
7月前
|
数据库
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
121 0
|
7月前
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
65 1
|
安全 关系型数据库 MySQL
【报错】sqli-labs靶场搭建出现“Unable to connect to the database: security”
【报错】sqli-labs靶场搭建出现“Unable to connect to the database: security”
1183 0
|
关系型数据库 MySQL 数据库
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
1282 0
|
XML 关系型数据库 MySQL
已解决Failed to connect mysql database,please check username and password,or mysql is version8? true
已解决Failed to connect mysql database,please check username and password,or mysql is version8? true
348 0
|
关系型数据库 MySQL 数据库
mysql 数据库中出现no database selected
mysql 数据库中出现no database selected
1427 1
|
SQL Oracle 关系型数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection wit...
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection wit...
262 0
|
Oracle 关系型数据库 数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection with the following error; ORA-12505,TNS:listener does
一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结 首先应该保证数据库的服务启动 在myeclipse的数据库视图中点 右键->new 弹出database driver的窗口, Driver template选择oracle(thin driver), Driver name 输入...
1134 0
|
人工智能 Oracle 关系型数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection with the following error; ORA-12505,TNS:listener does
欢迎关注大数据和人工智能技术文章发布的微信公众号:清研学堂,在这里你可以学到夜白(作者笔名)精心整理的笔记,让我们每天进步一点点,让优秀成为一种习惯! 一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结 首先应该保证数据库的服务启动 在myeclipse的数据库视图中点 右键->ne...
1776 0