ITPub博客

首页 > 数据库 > Oracle > 修改服务端监听器端口号为1526

修改服务端监听器端口号为1526

原创 Oracle 作者:skyin_1603 时间:2016-11-03 23:46:00 0 删除 编辑
----修改服务端监听的端口号为1526:

--配置服务端listener.ora文件:
[oracle@enmo admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LSNR2 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1526))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1526))
    )
  )
  
--配置服务端tnsnames.ora文件:
[oracle@enmo admin]$ vi tnsnames.ora 
LSNR2 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1526))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1526))
    )
  )
~

--修改服务端的默认监听:
SQL> alter system set local_listener='LSNR2';
System altered.

--启动端口号为1526的监听:
[oracle@enmo admin]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 23:31:36
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> 
LSNRCTL> start lsnr2
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/enmo/lsnr2/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=enmo)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias                     lsnr2
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                03-NOV-2016 23:31:54
Uptime                    0 days 0 hr. 0 min. 1 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/enmo/lsnr2/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))
The listener supports no services
The command completed successfully
LSNRCTL> 

--主动注册数据库到监听器:
SQL> alter system register;
System altered.

--再次查看监听的状态:
LSNRCTL> status lsnr2
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=enmo)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias                     lsnr2
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                03-NOV-2016 23:31:54
Uptime                    0 days 0 hr. 1 min. 44 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/enmo/lsnr2/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))
Services Summary...
Service "PROD" has 1 instance(s).
  Instance "PROD", status READY, has 1 handler(s) for this service...
Service "PRODXDB" has 1 instance(s).
  Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> 
#看到端口号为1526的监听器正常工作。

--客户端配置tnsnames.ora文件:
[oracle@host01 admin]$ vi tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORA11 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1526))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PROD)
    )
  )
  
--尝试使用连接串tnsping通服务端:
 [oracle@host01 admin]$ tnsping ora11

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 23:36:33
Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1526)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK (0 msec)
[oracle@host01 admin]$ 
[oracle@host01 admin]$ 

--尝试连接服务端数据库PROD库:
[oracle@host01 admin]$ sqlplus sys/oracle@ora11 as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 23:37:52 2016
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> show parameter service
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      PROD
SQL> 

--在Windows使用EZCONNECT连接:
C:\Users\Asus>
C:\Users\Asus>sqlplus sys/oracle@192.168.2.6:1526/PROD as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 11月 3 23:40:45 2016
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:
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> show parameter service
NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
service_names                        string
PROD
SQL>
修改成功。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2127791/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: DBLINK
请登录后发表评论 登录
全部评论

注册时间:2016-09-06

  • 博文量
    231
  • 访问量
    215135