Oracle 中极易混淆的几个 NAME 的分析和总结(2)

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = zlm_SN)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (SID_NAME = zlm)
    )
  )


经过上面的tnsnames.ora和linstener.ora的配置,当我们查看监听状态的时候,就会发现不同:

$lsnrctl status
......
 
Services Summary...
 Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
 Service "zlm_SN" has 1 instance(s).## 表示对应的SERVICE_NAME为zlm_SN
  Instance "zlm", status UNKNOWN, has 1 handler(s) for this service...  ##表示对应的INSTANCE_NAME为zlm,也即SID和ORACLE_SID
 The command completed successfully

而通常情况下,我们会设置SERVICE_NAME和INSTANCE_NAME一致。这里还要注意的是,SERVICE_NAME虽然可以脱离INSTANCE_NAME搞别名,但是必须对应listener.ora里配置的GLOBAL_DBNAME,否则就算配好了静态监听,也是注册不了服务的

注意,数据库数据文件存放的路径,是根据DB_NAME来确定的,而对于单实例数据库而言,默认与SID和INSTANCE_NAME是一致的,当然,也可以不一致(有DB_DOMAIN的情况下),DBCA的时候可以选择,通常这3个参数在DBCA的时候确认下来后,就基本不再去修改了,那么数据文件路径也就确定下来了,如我的环境中:
 
数据文件就放在/u01/app/oracle/oradata/zlm下面
 
而跟踪日志就放在/u01/app/oracle/admin/zlm/bdump下面

过了片刻以后,再查看监听状态,发现自动还是会去动态注册一个和INSTANCE_NAME(SID)一致的SERVICE_NAME

Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.91)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
 Services Summary...
 Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
 Service "zlm" has 1 instance(s).
  Instance "zlm", status READY, has 1 handler(s) for this service...
 Service "zlmXDB" has 1 instance(s).
  Instance "zlm", status READY, has 1 handler(s) for this service...
 Service "zlm_SN" has 1 instance(s).
  Instance "zlm", status UNKNOWN, has 1 handler(s) for this service...
 Service "zlm_XPT" has 1 instance(s).
  Instance "zlm", status READY, has 1 handler(s) for this service...
 The command completed successfully

这样的话,我个人判断,如果不配置静态监听的话,pmon进程始终会去监听那里注册一个名字和INSTANCE_NAME(SID)一致的SERVICE_NAME,即便是已经在tnsnames.ora中修改了SERVICE_NAME=zlm_SN,而只有通过静态监听强制注册一个与INSTANCE_NAME(SID)不一致的SERVICE_NAME,才会被监听到

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/b25f97cffe03609c54af2ad495df4418.html