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

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1092|回复: 0
打印 上一主题 下一主题

[Oracle] Oracle静态监听中SID_NAME区分大小写吗?

[复制链接]
跳转到指定楼层
楼主
发表于 2024-9-22 16:19:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

如果静态监听中ORACLE_SID不注意大小写的话,可能导致数据库连接不上的问题。如下案例所示:

$ sqlplus system/***@GPSUAT

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 18 15:48:37 2024
Version 19.24.0.0.0

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 4480
Additional information: -1989017509
Process ID: 0
Session ID: 0 Serial number: 0


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied

检查数据库实例正常。使用tnsping检查服务的网络是否正常,如下所示:

$ tnsping GPSUAT

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 07-NOV-2023 08:35:42

Copyright (c) 1997, 2022, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.40)(PORT = 15021)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = GPSUAT)))
OK (10 msec)


数据库中tnsnames.ora的配置如下所示:

GPSUAT =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.40)(PORT = 15021))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = GPSUAT)
    )
  )

此时,监听的配置如下

$ more listener.ora
GPS =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = GPS))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.40)(PORT = 15021))
      (ADDRESS = (PROTOCOL = TCPS)(HOST =192.168.9.40)(PORT = 15022))
    )
  )

SID_LIST_GPS =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = GPS)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = GPSUAT)
      (SID_NAME = GPS)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = GPSUAT2)
      (SID_NAME = GPS)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
  )
SECURE_REGISTER_GPS = (IPC)
SECURE_CONTROL_GPS =(TCPS,IPC)
ADMIN_RESTRICTIONS_GPS = ON
DIAG_ADR_ENABLED_GPS = OFF

正确的配置如下(SID_NAME必须使用小写,跟实例的大小写一致。这里ORACLE_SID值为gps)

$ more listener.ora
GPS =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = GPS))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.40)(PORT = 15021))
      (ADDRESS = (PROTOCOL = TCPS)(HOST =192.168.9.40)(PORT = 15022))
    )
  )

SID_LIST_GPS =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = gps)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = GPSUAT)
      (SID_NAME = gps)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = GPSUAT2)
      (SID_NAME = gps)
      (ORACLE_HOME=/opt/oracle19c/product/19.3.0/db_1)
    )
  )
SECURE_REGISTER_GPS = (IPC)
SECURE_CONTROL_GPS =(TCPS,IPC)
ADMIN_RESTRICTIONS_GPS = ON

结论如下所示:

在监听静态注册的环境中,listener.ora文件中写的实例名,要区分大小写,否则虽然远程telnet 监听端口是通的,但依旧会报出数据库不可用的问题。

之所以会报出数据库不可用问题,是由于远程连接通过监听连到的是另外一个库,而该库没有启动或者不存在。

总结:以后在处理问题中,注意区分实例名大小写问题,在监听层面,动态监听和静态监听很容易混淆实例名问题,尤其当服务器上存在大小写不同的数据库时候。


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-25 02:59 , Processed in 0.124166 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表