首页 > 数据库 >oracle的listener.ora和tnsnames.ora文件模板

oracle的listener.ora和tnsnames.ora文件模板

时间:2023-02-28 10:04:40浏览次数:46  
标签:PROTOCOL ADDRESS listener oracle tnsnames SID vcenter ora


oracle 经常要用到这2个文件。在这里提供下模板,方便参考。
2个文件的位置在 ​​​$ORACLE_HOME​​​ 下的 ​​network/admin​​ 文件夹下。

文章目录

  • ​​oracle11g版本​​
  • ​​listener.ora 样板文件​​
  • ​​tnsnames.ora 样板文件​​
  • ​​添加新sid​​
  • ​​listener.ora修改​​
  • ​​tnsnames.ora修改​​

oracle11g版本

listener.ora 样板文件

SID_LIST_LISTENER =
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME = helowin)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
(SID_NAME = helowin)
)
)

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

tnsnames.ora 样板文件

LISTENER_HELOWIN =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

HELOWIN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = helowin)
)
)

添加新sid

实际中添加新sid有很多数据库的操作,这里只说配置文件。
例如要添加的sid为vcenter。

listener.ora修改

复制​​SID_DESC​​​内容,
​​​GLOBAL_DBNAME​​​ 和 ​​SID_NAME​​​ 都写为 vcenter(新sid名称),
添加到SID_LIST模块下。

(SID_DESC=
(GLOBAL_DBNAME = vcenter)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
(SID_NAME = vcenter)
)

tnsnames.ora修改

2部分都要复制:
​​​LISTENER_******​​​ 改为 LISTENER_vcenter
模块名改为vcenter
​​​SERVICE_NAME​​ 改为 vcenter

LISTENER_HELOWIN =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

vcenter=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vcenter)
)
)

修改完配置文件不用重启服务,重启监听服务即可。
linux中好像连监听也不用重启。


标签:PROTOCOL,ADDRESS,listener,oracle,tnsnames,SID,vcenter,ora
From: https://blog.51cto.com/u_7341513/6090160

相关文章