oracle监听文件tnsname.ora listener.ora配置

listener.ora

 LISTENER =
     (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
 )

 #记录了监听器LISTENER服务的全局数据库名、数据库路径和数据库实例名
 SID_LIST_LISTENER=
     (SID_LIST =
         (SID_DESC =
             (GLOBAL_DBNAME = ORCL)
             (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
             (SID_NAME = ORCL)
         )
     )

tnsnames.ora

ORCL1 =
     (DESCRIPTION =
         (ADDRESS = (PROTOCOL = TCP)(HOST = oraclehost)(PORT = 1521))
         (CONNECT_DATA =
             (SERVER = DEDICATED)
             (SERVICE_NAME = orcl)
         )
     )

启动监听程序

[oracle@oraclehost admin]$ lsnrctl start LISTENER

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 23-JUN-2022 10:42:56

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oraclehost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclehost)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                23-JUN-2022 10:42:56
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclehost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclehost)(PORT=1521)))
The listener supports no services
The command completed successfully

连接测试

[oracle@oraclehost admin]$ sqlplus sys/oracle@orcl1 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 23 10:44:01 2022

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

lsnrctl status/start/stop orcl(监听名称)//启动,关闭,查看监听状态
tnsping orcl1 //查看是否可以正常通过监听通信

 [oracle@oraclehost admin]$ tnsping orcl1

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 23-JUN-2022 10:48:38

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

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraclehost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (0 msec)
[oracle@oraclehost admin]$
posted @ 2022-06-23 10:52  南大仙  阅读(1402)  评论(0编辑  收藏  举报