1.静态注册默认端口多个服务名配置,listener.ora
[oracle@db01 admin]$ pwd
/u01/app/oracle/product/19.3.0/dbhome_1/network/admin
[oracle@db01 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db01)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl1)
(ORACLE_HOME =/u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl2)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = orcl)
)
)
上边是构建数据库自动创建监听时候的一些配置,如果采用默认,全部为动态注册,以下是追加,后边不在显示
修改完listener之后使用lsnrctl reload重新加载
如果监听比数据库启动的晚,默认一分钟之后数据库PMON进程会注册,否则可以使用alter system register手动注册
重新加载监听文件即可,lsnrct reload,可以看到提供了两个服务名orcl1和orcl2
[oracle@db01 admin]$ lsnrctl reload
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 30-OCT-2021 10:17:11
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db01)(PORT=1521)))
The command completed successfully
[oracle@db01 admin]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 30-OCT-2021 10:17:19
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db01)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 30-OCT-2021 08:38:49
Uptime 0 days 1 hr. 38 min. 30 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/db01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01)(PORT=1521)))
Services Summary...
Service "orcl1" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl2" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
连接oracle
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1521/orcl1
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Oct 30 10:18:40 2021
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Sat Oct 30 2021 10:15:15 +08:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
或者
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1521/orcl2
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Oct 30 10:18:58 2021
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Sat Oct 30 2021 10:18:40 +08:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.13.0.0.0
2.非默认端口多个监听配置
修改listener.ora文件
[oracle@db01 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db01)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = db01)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl1)
(ORACLE_HOME =/u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl2)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = orcl)
)
)
[oracle@db01 admin]$ lsnrctl reload
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1521/orcl1
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1521/orcl2
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1522/orcl1
[oracle@db01 admin]$ sqlplus c##hbhe/wwwwww@192.168.56.101:1522/orcl2
版权声明:本文为博主原创文章,未经博主允许不得转载。
Linux,oracle